Is it possible to have two different sections of frozen bytecode? #11647
-
Is it possible/feasible to have two different sections of flash containing frozen bytecode, but one is loaded at a later point (i.e. at some point after boot.py has been run)? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
@victorallume A mostly-accurate way to think of frozen bytecode is as a special filesystem containing .mpy files where the loader knows that certain data structures are (a) already laid out exactly as the runtime expects, and (b) directly memory mappable. Compare to loading a .mpy file from the filesystem, we need to do more translation of the data structures (because the .mpy format is generic whereas the in-memory structure the runtime expects depends on the architecture), although as of the v1.19 there is much less translation. But from the filesystem you cannot do memory mapping because the files are not necessarily contiguous. Anyway, the point is that none of this happens until you import a given module. So unless I've misunderstood the question, I don't think you need to worry about this? |
Beta Was this translation helpful? Give feedback.
@victorallume I think the thing you want is #8381 :D
(This feature is going to be a pretty big deal for many people I think, because it gives you almost all the benefits of frozen code but with all the advantages of not having to build and flash the firmware. It's also really great for development -- see #8426 (comment) -- because you can do a full deploy of your entire codebase much much faster than copying .py/.mpy files to the regular filesystem).
But in terms of what you can do now.... I think I understand your original question now. It's not so much that you want two different groups of frozen code to be loaded independently (they are anyway), rather that you plan to load them indepe…