Hi to all,
Program codes must be placed in flash due to AVR architecture. I have a suggestion for using mmc/SDC/SDHC or other storages for storing codes much greater in size than microcontroller flash capacity. The key solution is ICALL instruction. Different codes can be written in flash with a RET instruction after every code.A high level software can translate the original assembly code to address of each code in flash and this address is unique for every different instruction. Main program reads these addresses from mmc and loads Z register and then ICALL(EICALL) instruction will jump to instruction location and then returns by RET.For example (mov r16,r17) is written only once in flash. But can be executed several times.
Although some instructions can not be treated by this method. But very long codes can be stored and executed.