lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Fabien wrote:
I was wondering: how hard it woud be to run Lua functions whose bytecode is stored in Flash (possibly in a preprocessed form)?
Bogdan, have you considered this?

Looking up bytecode from ROM should be no problem in theory, since bytecode is never written to during VM execution, but some modifications to Lua might be necessary.

For single-chip-solution Flash microcontrollers these days, often you can reprogram the program Flash on-the-fly, but programming is slow and it's by blocks. So you can interpret some Lua source and write the bytecode to ROM, but it's slow compared to using internal RAM and the program Flash is not designed for a huge number of writes. In theory, you can even do JIT on such microcontrollers too...

Primarily, the problem is that program Flash is not designed for a whole lot of writes. A typical Microchip PIC24 datasheet says Ep (cell endurance) is 100 minimum, 1000 typical, E/W (erase/write) cycles. This is okay for firmware updates, but not for daily use. EEPROMs would be better, but it would have to be connected as an external chip.

Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia