Cross compiling native code
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Cross compiling native code
If I cross compile a module with code having the @micropython.native decorator I get an "invalid micropython decorator" message. I assume it's necessary to tell mpy-cross the target architecture (Arm Thumb) but it's not obvious how to do this.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: Cross compiling native code
I get the same error for thepythoncoder wrote:If I cross compile a module with code having the @micropython.native decorator I get an "invalid micropython decorator" message. I assume it's necessary to tell mpy-cross the target architecture (Arm Thumb) but it's not obvious how to do this.
@micropython.asm_thumb decorator. Could you tell me how to solve this?
Re: Cross compiling native code
Hi Peter, hi @rosenrot, I stumbled iver that a few times too, and for me the reason is clear. mpy-cross generates python bytecode, and .mpy files are expected to consist of bytecode, not machine code. the decorators for native code, viper, and assembly code cause machine code to be generated instead, which at the time of creation is stored to a well known place. To put that into an .mpy file, a relocatable format would be required, and the load must be able to handle it. Not that this is impossible, but it is not implemented yet and might not be worth the effort. Native, assembly, and viper code is typically used for small, time critical sections of code. So using frozen "bytecode" may not be an necessity. If it is about embedding the code in the firmware image - I wonder if frozen modules are still around. The should allow for native code, etc,
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact: