Replies: 6 comments 19 replies
-
See here https://pypi.org/project/mpy-cross/ This version of mpy-cross allows
|
Beta Was this translation helpful? Give feedback.
-
I am sorry to cause a confusion. I checked again and what I am using is this: https://pypi.org/project/mpy-cross-multi/ And the command is:
|
Beta Was this translation helpful? Give feedback.
-
@krismc, 1) you mentioned using two different tools :
|
Board | V1.23.0 | V1.24.1 | V1.25.0-preview-365 |
---|---|---|---|
ESP32 | ✅ | ✅ | ✅ |
ESP32 S3 | ✅ | ✅ | ✅ |
ESP32 C6 | ✅ | ✅ | ✅ |
ESP32 S2 | ... | ... | ... |
I have no ESP32-S2 so unable to test.
A few other things.
I noticed that you tend to compress the python code on a single line.
Cross compiling a well formatted source file, again produces the exact same micropython bytecode, not a single byte longer.
so there is no runtime size advantage , and the code is , IMO, a lot harder to read.
I actually think that there is a logic hidden in _getwlanscan
where two overlapping for
loops both use i
as iterator, that may be better to understand if that function is formatted.
With the default options , the .mpy file is actually a bit larger as it needs to store additional 'source lines' for an error's traceback to be able to refer to a line in your code. if you can do without , add -O3
to mpy-cross and you'll save those bytes , while keeping your core readable.
(P.S. Im not sure if or when these line number are ever loaded into RAM, or weather they remain in Flash / ROMFS )
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
The https://pypi.org/project/mpy-cross/ package can export older versions too, though that's handled by the "mostly transparent" wrapper script, not when executing the mpy-cross binary directly as in https://github.com/orgs/micropython/discussions/16477#discussioncomment-11665175 If you use a tool like uv to install it'll handle the path for you, so you can Behind the scenes that package bindles older mpy-cross binaries as well which are auto-selected by the wrapper script. On a related note though, 1.23 is still the same bytecode version as the current version (1.24) so you shouldn't need to use an older version mpy-cross at this point, the current version should still work fine. |
Beta Was this translation helpful? Give feedback.
-
Did the mpy-cross purge Jos ('where.exe mpy-cross' is such a great cmd for finding trouble lurking in the shadows) then tried mpy_cross-1.23.0.post2 and mpy_cross-1.24.0.post2 & verified the MPYs from both will run on a 1.23.0 esp32. Emboldened I then made & successfully ran a 1.17.0 mpy. So nice to finally stumble out of the minotaur's labyrinth into the sunshine, thanks for the hand holding. I'm gonna stick with the pip uninstall mpy-cross / pip install mpy_cross~=1.17.0 way of doing things. Those flavour-of-the-month multi wrappers that supposedly generate any version .mpy are OK in theory but I can't make 'em work in practice. The grief has left with me a new found interest in .MPYs. Can you suggest any simple tools for exploring .mpy structure & function? In particular it would be great to be able to compare 2 .MPYs. I'm wondering how you were able to determine they were binary identical? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
For the last few months I've been making .mpy files for v1.23 upython by typing
into the windows command prompt
It's been working OK till today
I tried
which produces a .mpy file that gives
when I try to run it in v1.23 upython on an esp32. Presumably because it's v1.24?
Anybody know a way to produce v1.23 compatible .mpy files from the windows command prompt?
Beta Was this translation helpful? Give feedback.
All reactions