1

I have an Arduino Uno. It doesn't have a lot of memory space, which is a bit of a nuisance. I was wondering: Is it possible to load a text file from an SD card and compile it on the Arduino into code that the Arduino can use. I don't really care if it is slow or uses 99% of the memory space just to load on the code. If it is possible would this work: use bootup code to load a piece of code to Arduino, dispose of bootup code so there is more code, do what ever that code does, dispose of that code, load new code.

  • 1
    Short answer is no - you cannot change the falsh memory like you propse, but you can optimise code etc.this has already been answered here: arduino.stackexchange.com/questions/221/… – Mikael Jan 12 '16 at 18:32
  • 1
    What kind of application are you looking at? You can free up the bootloader section by using an ISP programmer instead but my guess is that the extra program memory will not help much. Could you describe your actual goal instead of a sub-problem solution. – Mikael Patel Jan 12 '16 at 20:50
3

See topic #16812, “Load sketch code from SD Card”, in forum.arduino.cc, which explains how to replace the ordinary Arduino bootloader with one that can load programs from an SD card.

Also see Bootdrive loads Arduino sketches from SD card at dangerousprototypes.com, which gives different code to do the same thing. It also mentions BootDrive for Arduino from baldwisdom.com.

Note, the program code that these loaders install into flash is already compiled, as opposed to being original C source code. If you want to load source-level code into the Arduino, look for an interpreter / interpretive language to run on the Arduino.

0

The flash memory is only designed to be reloaded 10,000 times. While that might seem a lot, if you are planning a system where, every day you load some part of code into flash, and then some other part, etc. you will use up those 10,000 writes fairly quickly.

I don't really care if it is slow or uses 99% of the memory space just to load on the code.

Well, you will care because if 99% of the memory space is the loader, you will only have 1% for the code, which defeats the purpose.

It doesn't have a lot of memory space, which is a bit of a nuisance.

I suggest a larger processor such as the Atmega1284 (128k of flash), Atmega2560 (256k of flash) or the Atmega644P (64k of flash).

All but the Atmega2560 come in DIP versions of the chips, if that helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.