Open
Description
This is something I've come across a few times before and looking at #7649 got me thinking about it again.
A single mpy-cross
executable should be able to build .mpy
files that run on any MicroPython port, including customized ones. However, not all ports support all features.
Examples:
- On a port without floating point support, running a .mpy file with floating points can cause a crash due to invalid CPU instruction. This is particularly subtle with the
/
operator and integers. - There are some options, like
MICROPY_PY_BUILTINS_SET
that affect the compiler output but may be disabled in a port which will fail to process the bytecodes. - py: Implement partial PEP-498 (f-string) support (v3) #7649 is probably a little different in that the compiled .mpy would run fine since it basically transpiles the code to something else, but if the same .py source was copied to a device and tried to compile on a device without f-string support enabled, then compiling the same file would fail there.
So what I'm wondering is if it is reasonably possible to add more options to mpy-cross
like -mno-unicode
to basically make mpy-cross
give the exact same compiler output as any given MicroPython port? I.e. -mno-float
would cause mpy-cross
to give a compiler error if floats were used anywhere instead of successfully compiling the program.
Metadata
Metadata
Assignees
Labels
No labels