Run a sketch from an SD memory card

It is necessary to make sure that the desired sketch (program) is loaded from the SD card in Arduino either by command or by condition. :grinning: :robot:

why? the bootloader is not designed to work that way at allโ€ฆ

You canโ€™t run a sketch from the SD card. What you can do is find a bootloader that allows you to load a hex file from a SD card.

No experience with it but a google for arduino bootloader sd card might be a start.

The Arduino microprocessor can only execute code from the program memory area, no where else, that is hardwired in by design. You need to get the code into program space before it can be run via bootloader, overlay manager etc. That code will have to remain resident.

It is very interesting to read a description for a process that does not exist!

Note that all the examples of loading code fron an SD card need the compiled code, not the sketch file, that would require a compiler.

The arduino is based on the Atmel processor which is built using a Harvard architecture. This is a hardware design, not software. The processor of the Arduino board uses the Harvard architecture where the program code and data are separate . It consists of two memories such as program memory and data memory. Since you cannot access program memory and data memory simultaneously, the Von Neumann architecture is susceptible to bottlenecks and system performance is affected. The Harvard architecture stores machine instructions and data in separate memory units that are connected by different busses. Check it out.

I think I recall this same topic coming up awhile ago. I think the answer was you COULD do it, but it would take 2 Arduinos. One to load the other.

-jim lee

It would be possible to hack the OTA (Over The Air) software to allow what is wanted but it would have to reprogram part of the Arduino flash for each segment or load things at know locations and pass control to that area. Years ago we use to call them overlays.