Skip to content

Most modules do not work on Cortex M0 / RP2040 - size limitation #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jonnor opened this issue Jul 7, 2024 · 3 comments
Closed

Most modules do not work on Cortex M0 / RP2040 - size limitation #14

jonnor opened this issue Jul 7, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@jonnor
Copy link
Contributor

jonnor commented Jul 7, 2024

RP2040 and other Cortex M0/M0+ devices (ARCH=armv6m) only support ARM Thumb (not Thumb 2) instruction set. As of MicroPython 1.23, the linker for .mpy files only supports jumps that are under 11 bits. This limits module sizes to around 2kB maximum.

Most of the emlearn-micropython modules are slightly larger than 2kB on armv6m. The module sizes are a bit larger than some other architectures, since this architecture does not have floating point hardware, and we need to include some soft-float support.

At the moment, this is blocking most practical uses on Cortex M0.

@jonnor jonnor added the bug Something isn't working label Jul 7, 2024
@jonnor
Copy link
Contributor Author

jonnor commented Jul 7, 2024

I tried implementing support for larger jumps in https://github.com/micropython/micropython/pull/12241/files
However the first iteration was not correct.

@jonnor
Copy link
Contributor Author

jonnor commented Sep 24, 2024

Has now been fixed upstream in micropython/micropython#15812 - scheduled for release with MicroPython 1.24

@jonnor
Copy link
Contributor Author

jonnor commented Sep 26, 2024

I have backported this fix to https://github.com/jonnor/micropython/tree/emlearn-micropython-v1.23-2 which is now used in master. I was able to run the xor_trees example (above 2kB) on an RP2040, so this appears to be fixed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant