Program Feasibility - Boot from SD card

Hi!
I am doing a project which uses an OS to boot various programs. This is all nice and good, except for the fact that I am quickly running out of memory to store the individual programs!

I was wondering if it would be possible to:

  • Read a .hex/.bin (precompiled arduino binary) from SD to RAM
  • Run the program from RAM
  • Read a different program from the SD, keeping some variables in scope (such as an LCD object and the SD object)
  • Etc.

I know this is, in part, possible, because the Arduino bootloader is capable of reading programs from RAM natively and dynamically, but the part I'm really so so on is keeping certain variables in-scope.

Thanks for any insight!

No. AVRs cannot execute code from RAM.

Regards,
Ray L.

Fuzzyzilla:
Hi!
I am doing a project which uses an OS to boot various programs. This is all nice and good, except for the fact that I am quickly running out of memory to store the individual programs!

I was wondering if it would be possible to:

  • Read a .hex/.bin (precompiled arduino binary) from SD to RAM
  • Run the program from RAM
  • Read a different program from the SD, keeping some variables in scope (such as an LCD object and the SD object)
  • Etc.

I know this is, in part, possible, because the Arduino bootloader is capable of reading programs from RAM natively and dynamically, but the part I'm really so so on is keeping certain variables in-scope.

Thanks for any insight!

Yo, you could use multiple Arduinos for parallel processing multiple smaller programs instead of having one big program uploaded to a single Arduino. Or you could use a RPi3.

Yes you can run from RAM!
It's actually built into the IDE:

__attribute__ ((long_call, section (".ramfunc")))

Will force the function to be stored in RAM.
Source

Fuzzyzilla:
Yes you can run from RAM!
It's actually built into the IDE:

__attribute__ ((long_call, section (".ramfunc")))

Will force the function to be stored in RAM.
Source

No, no, no.

The source linked was for an Arduino Due, which is based off an ARM chip, while most Arduinos are based off of AVR chips.

I don't know too much about AVRs vs ARMs, but I think AVRs can't execute programs from RAM, but ARMs can.

Hmm :confused:
That's unfortunate. So, this isn't possible?

Fuzzyzilla:
Hmm :confused:
That's unfortunate. So, this isn't possible?

I doubt it, but please look at my first post again anyway.

Fuzzyzilla:
Yes you can run from RAM!
It's actually built into the IDE:

__attribute__ ((long_call, section (".ramfunc")))

Will force the function to be stored in RAM.
Source

That is only for the Due, and if he had a Due, he would NOT be running out of memory.... AVRs CANNOT run code from RAM.

Regards,
Ray L.

@Power_Broker This project is meant to fit in a small footprint, so parallel processing is pretty much out the window :confused:
Thanks for the suggestions, I'm not sure how I'll overcome this challenge! :slight_smile: