Difference in mpy output on target versus host

C programming, build, interpreter/VM.
Target audience: MicroPython Developers.
User avatar
Posts: 1204
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia

Re: Difference in mpy output on target versus host

Post by jimmo » Wed Jan 08, 2020 1:52 am

BramPeeters wrote:
Tue Jan 07, 2020 3:10 pm
Eg in the first bytes there are already differences (I have added image with birds eye view of differences)
mpy-cross: 4D 03 02 1F AF 16 28 02 00 00 00 00 83 65 34 00
on target : 4D 03 02 1F AE 3D 28 02 00 00 00 00 83 62 23 00
So the first diff AF 16 vs AE 3D is the length of the bytecode. 6038 bytes vs 5949 bytes.

I'm sure it's possible to figure this out, but TBH doing the compilation on the host PC via mpy-cross is the supported way to do it (and by disabling the save code functionality you can save yourself a bit of ROM on the device too). Off the top of my head I can imagine some ways in which doing this on-device is actually likely to cause issues (e.g. not including the right QSTR data).

Do you plan to upgrade to 1.12? There have been improvements to the .mpy format and bytecode in general which might make it worth your while.

Post Reply