docs: exhaustive documentation of mpy file format? #11719
Replies: 3 comments 6 replies
-
hi @massimiliano-mantione No there isn't such documentation at the moment. There are two parts -- one is the structure of a .mpy file, the second is the actual bytecode. Both of these things are not fixed, they do occasionally change between micropython versions, so they're seen as somewhat of an implementation detail. The bytecode tends to get quite small changes, but e.g. the .mpy format had quite a major overhaul last year. Probably your best bet is to look at mpy-tool.py which is the most self contained tool that can work with both .mpy files and bytecode. It now includes a disassembler. It's also useful to turn on verbosity output on the unix port (via the |
Beta Was this translation helpful? Give feedback.
-
Probably easier to write something that compiles from not-python to python then use mpy-cross to get bytecodes. |
Beta Was this translation helpful? Give feedback.
-
BTW, related: I keep stumbling upon "viper" code next to "native" code. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I really looked for it, but I could not find it: is there a complete documentation of the mpy file format?
The idea is hinted at in the project docs, with something about the header and sections, but I did not find a complete specification of all possible sections, their format and, most importantly each and every bytecode operator.
I am toying with the idea of creating a separated compiler that generates mpy files but not starting from python, but without that kind of documentation I cannot even evaluate the general feasibility of the idea...
And I'd prefer not to reverse-engineer mpy-cross :-D
And sorry if the documentation is there but I did not find it!
Beta Was this translation helpful? Give feedback.
All reactions