Hacker News new | ask | show | jobs
by snops 980 days ago
You can "freeze" micropython modules and have them saved in flash with Micropython, where flash only stores the precompiled bytecode.

If your module contains stored data in the form of an immutable object, like a string or bytes(), it will be read straight out of flash without copying to RAM first.

This needs you to run some code on a desktop computer to perform the freezing though.

https://docs.micropython.org/en/latest/reference/constrained...

2 comments

Any serious build setup for an MCU firmware is going to have steps like this in, generating code and saving blobs of this and that.

Though I guess part of the pitch for micropython is being able to iterate without a flash step every time. Possibly addressed by having your dev boards fitted with a version of the MCU with enough RAM to run it all that way.

Just to be clear, not just data but bytecode will also be executed from flash too.