My Arduino Uno is running out of memory to support my script (yes, I've tried several ways of optimize it already: PROGMEM, EEPROM, no Strings, and so on), so I would like to upload my script to my Wiring S board.
However, instead of "porting" all libraries to Wiring, I would like to compile my script in Arduino IDE and upload it to my Wiring S. It used to be "easy" in Arduino v.1.0.x. because somwhere I got a Wiring folder (containing, among other things, a boards.txt file) and copied it to Arduino's hardware
folder getting the Wiring S board listed in Arduino IDE.
Since Arduino 1.5 the specification for adding other boards changed. I'd say it's more complex now. I simply cannot understand most of the new specification (yes, I'm new into electronics), so I haven't been able to add my Wiring S board.
Running my script in Arduino 1.0.x doesn't seem to be an option, since it throws lots of errors (although the script compiles in Arduino 1.6.2).
Do you have any experience adding other boards (like Wiring S) to Arduino IDE? Could you please give me some hint?
1 Answer 1
There are two things I do; I use the Serial.print(F("string/n")); which prints the data from flash rather then copying it to ram. Keep as many of your variables local as possible, that will save ram. This is done by defining then in the function, the added advantage nothing outside the function can change them.
Global and Static variables are the first things loaded into SRAM. They push the start of the heap upward toward the stack and they will occupy this space for all eternity.
Variables created in functions, are dynamically allocated objects and data. Unlike Global and Static variables, these variables can be de-allocated to free up space at function exit. But Every function call creates a stack frame that makes the stack grow toward the heap. This data is usable within the function, but the space is 100% reclaimed when the function exits!
-
Thanks for your answer, although I'm not really asking for hints on saving program space.Germán Carrillo– Germán Carrillo2016年01月25日 02:37:15 +00:00Commented Jan 25, 2016 at 2:37
avr
), and requires a platform.txt file with just a name and version (two lines). The boards.txt file has some variables with new names. You'll get some error messages in the IDE is something is incorrect.