nielsreijers/NanoKong — Issue #19: Execute code from Flash instead of SRAM
Author: nielsreijers
Created: 2011-10-24 04:15:34+00:00
State: open

The Java byte code is stored in Flash, but when the VM starts it is copied into SRAM now, and executed from there. One of the reasons for this is that on the Atmega we can directly access SRAM, but we need to use special instructions to access the Flash memory, which takes more time. Of course the advantage of executing code from Flash is that we have a lot more of it. SRAM is a very limited resource.
We should have the option to choose between executing from SRAM or from Flash. Right now there seems to be an option to do this, but it doesn't work.
There is also an option to execute from EEPROM, but I don't think we will need this. This option can be removed, and the whole code should be refactored to be less confusing than it is now.

At the moment the source from which code is executed is decided at compile time using #define's. This is fine for now, but as a future optimization it would be nice to be able to do change this at run time, so we may use the faste SRAM option if we have enough space, or fall back to executing from Flash if we have insufficient SRAM.