Incredibly slow compile time CB / Arduino IDE

Hi everyone!
Fantastically exciting phone. The compile time is incredibly slow, 5 min or more.

It is slow both on Arduino IDE and CB. Approximately equally slow. It is slow both for building a bin and for uploading directly.

Any advice?

I just installed CB today, and Ringo library for Arduino IDE 26 September 2020.
Windows 10, i5. Compiling for Arduino Uno is normal compile speed. I have McAfee, but it is turned off.

Any advice or ideas appreciated!!

Well, I bet your Ringo sketch has statements like the following near the beginning:

#include <MAKERphone.h>

MAKERphone mp;

As such, you are asking the compiler to compile the entire Ringo library, many tens of thousands of lines of source code every time you compile your (relatively tiny) sketch. Depending on the speed of your computer that could take quite a while. On my Dell Optiplex 9020 it takes 2-3 minutes; the Arduino IDE compiler is not very speedy.

Try compiling a simple sketch that does not include the library header (MAKERphone.h) nor instantiate an instance of the library (MAKDRphone mp;). You can’t write a very interesting sketch that way, but if you try one, like adding two integers together over and over, you will see that it compiles very quickly. The Arduino IDE is not very smart and seems to always compile everything even if it has been compiled previously and is unchanged.

Hey there!

Wow, this really is slow, and it shouldn’t be this slow in any circumstances.
Do you have another computer maybe to try it there? Just to see if it’s going to work any better.

What Frank says is true, but it still shouldn’t be that long, especially since Arduino has upped its speed a lot over the past year. CB uses the same compiler as Arduino (it’s actually Arduino CLI running in the background), so they should be equally fast (CB should be a bit faster actually because it is optimized for this).

Maybe a stupid idea but - try switching the cable or switching an USB port. Might just work.

Stay in touch,
Robert

Thank you. Is there no way to precompile Makerphone, I and my 10 year old daughter is just trying to make her first app and a compile time of 5 min is a bit hefty. The cable is the one that came with the phone.

Arduino IDE is indeed fast when we compile for Arduino Uno, it takes about 5-7 seconds, so I am sure Frank is quite correct. However, is there any trick to making Makerphone have a reasonable compile time? Is it possible to precompile or link binaries or something like this?

I havent used Arduino much. Any ideas would be most welcome.

I shall try an older Linux computer tomorrow and see if it makes any difference.

Might I suggest a little benchmark? Here is a simple program that does not use the MAKERphone library. It simply opens a text file on the SD card that contains whitespace separated integer values and reads and prints the first two integer values read from the file.

On my Intel Core i5-4590T @ 2.00GHz, Arduino compiles this program in 30 seconds the first time it is compiled, and in 15 seconds on each subsequent time in a given Arduino session. Let us know how fast it compiles (first and subsequent times) on your system.

I might also suggest you change
build.verbose=false
to
build.verbose=true
in preferences.txt before launching Arduino so that you can see the progress of the compilation and linking, and what all is being compiled each time.

EDIT: I added the line “SD.begin();” which is necessary if the program is actually going to work.

tester.ino:

#include <SD.h>
#include <iostream>
#include <string>
#include <sstream>

void setup()
{
  Serial.begin(115200);
  SD.begin();
  File objectdef = SD.open("/galimber/object.obj","r");
  char file[objectdef.size()+1];
  objectdef.read((unsigned char*)file,objectdef.size());
  file[objectdef.size()] = '\0'; //null C-string terminator
  std::string s(file);
  std::istringstream is(s);
  int nump,first;
  is >> nump >> first;
  Serial.printf("%d %d\n",nump,first);
}

void loop() {
  // put your main code here, to run repeatedly:

}

Also - there should be a little button in CB called ‘Minimal’. When you press it, some of the stuff won’t compile, as it is already compiled, and everything should be faster.

So, try that as well! :smiley:

Robert

Update:

  1. Tried to compile on Linux instead. Failed due to not being able to upload, seem to be unable to set permissions correctly. [Permission denied on /dev/ttyACM0]
  2. Went back to Windows. Tried compiling ing verbosely. Log became 1.2 MB! Tried again. It worked! It used the precompiled code like it should. Tried to compile for .bin instead, then it didnt use the precompiled code. I will tinker a bit with this.

@frankprindle - I am compiling to .bin to the harddrive and that is really quick. When I am compiling / uploading straight to “firmware upload”(?) or something like this, the upload takes some time, but not crazy amount of time. Maybe 20-30 seconds.

I will run your profiling script next, but I am not sure if I should upload it as firmware or write a bin and copy the bin to the SD-card manually by removing the SD card form the phone and back.

Is there a way to upload to the SD-card directly via the USB cable? Is that what you are referring to?

@robertCM tried to minimal. the button is on or off, but it doesnt explain when it is on or off (grey or yellow, it is unclear). It doesnt seem to make any difference in speed anyway.

I am unable to figure out how to edit the code, I can only edit the blocks, and then compile. That means my daughter isunable to make an app that we can exit and compile it from inside CB. So we are focusing on Arduino IDE instead now :slight_smile:

There is no way to upload to SD card without taking it out and writing it on another computer. But for my test program, there is no need to write to SD card, just upload it to the Ringo and it will run. You need to have the Arduino serial monitor terminal up and running at 115200 baud before you select upload. Once it has finished uploading (the stuff in dark red in the console window after the compile) and it resets the Ringo, the program should run but you need to have a text file somewhere on the SD card that contains at least two integer numbers separated by a space or on separate lines, and then specify the full path to that filename in the SD.open() call (obviously you don’t have a file “/galimber/object.obj”). In order to test this program, just upload it (Sketch/Upload) and it will run. This program just loops forever after printing those two integers, so you’ll need to re-flash the stock firmware after you’ve run this (Tools/Burn Bootloader) to get back to a functional Ringo phone.

To be clear, the integers are not printed on the Ringo screen (because you haven’t included the libraries to do that), but rather they are printed on the Serial terminal emulation that Arduino provides (the little Serial monitor icon in the upper right of the IDE window).

Like I said, you can’t write a very interesting program for the Ringo without including the whole library, and compiling that takes much more time. This was just mean to test how fast your computer is. Since mine took 30 seconds the first time and 15 seconds each subsequent time, let us know how fast yours compiles this so we can compare. This does not include the extra upload time.

Hey there,

The code editing is not available in the ‘Block’ editor, since the blocks can be translated to code, but not the other way around! ‘Block’ editor is made specifically to do block coding, and not the code one.

However, you can just copy the code, and create a new project with the ‘Code’ option, and there you’ll be able to write your code (just like in Arduino IDE). :slight_smile:

The ‘Block’ section is made more for beginners and for introducing Ringo library to everyone, since all of the main functions are already listed there.

Robert

Thanks guys! All help was much appreciated!

We are now trying to find document to understand the Mp-object and which properties and function can be accessed (I want to access today’s date). Also where we should start to add Swedish language support (encoding of character åäö) to the sms. It says we need C++, cant this be done in Arduino IDE anyway since the Arduino IDE is able to compile the code?

Hey there,

A couple of things. First, the document that contains all of the documentation isn’t out, and probably won’t be since we’ve changed a lot of firmware in the last few months and made it better for other products. So the best idea is to search the forum or our GitHub page for all the additional documentation about certain functions. Look at the game codes and other programs as well.

Swedish language support - can’t help you with that one, because encoding of the messages is not a straightforward task, but it should be possible with a little bit of research.

To edit the firmware, it’s best to follow one of these two tutorials - https://circuitmess.com/resources/guides/en/ringo-custom-firmware and Building and Flashing a Custom firmware.bin for Ringo/Makerphone.

It’s explained here how to set up and edit the firmware, upload it to the phone, and return it to the base firmware.

If you have any specific and additional questions, feel free to write here or open a new topic on the forum - I’m sure a lot of people will try to help you! :smiley:

Cheers,
Robert

Thank you. My kids just made their first app for Ringo, which we posted in the forum. Is there a specific repository to put apps and view other’s apps?

Is there a way to affect in which order the apps are shown in the menu? Our new app is at the very end of the menu (from the SD card) instead of at the top (where it should be!) :slight_smile:

Thank you for a great product!

1 Like

Hi!

Here is where you can find all of the apps for Ringo and MAKERbuino - https://circuitmess.com/resources/creations.

The apps are put up there by our team, so we’ll put the app up for you and give the proper credit! :smiley:

The apps are shown in the menu sorted by the date - you can see on your SD card when you plug it into your computer which folder is the oldest - that app will be on top!
When I say on top, I mean just below all the main apps, since the main apps don’t work in the same way as games and other SD card apps, so they’ll always be on top. If you wan’t to put your game just below them, just remove the folders with other apps/games from the SD card, and return them there. You can find a link with all the default apps here - https://github.com/CircuitMess/CircuitMess-Ringo-SD-package.

I hope this answers all of your questions! Thank you for being a big part of the community and for making the game. :smiley:

Cheers,
Robert