-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
tools/mpy_ld.py: Support jumping more than 2k on armv6m architectures. #15812
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
tools/mpy_ld.py: Support jumping more than 2k on armv6m architectures. #15812
Conversation
This is an alternative to #12241 that uses less bytes (8) to encode the jump. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #15812 +/- ##
=======================================
Coverage 98.44% 98.44%
=======================================
Files 163 163
Lines 21296 21296
=======================================
Hits 20964 20964
Misses 332 332 ☔ View full report in Codecov by Sentry. |
Code size report:
|
This looks nice and simple. I will test it later. Probably the -2 adjustment of the offset is what I missed when I tried to implement this.
As it stands, the function does not obey this property - it's either 2 or 4 bytes. As you mentioned in the review of my code, this can cause issues because the length of instructions is used else where to compute the layout. Is the plan to skip the conditional and always do the long jump (once verified)? |
No, it always emits 8 bytes. See the |
I have run this change with wasm2mpy tests (with and without forcing long jumps) and noticed no regressions. |
You are right, of course. I do not know where my head was at. |
Tested with a module that exceeds the 2k limitation (before this commit, fails with |
Thanks @jonnor and @vshymanskyy for testing and review! |
Native .mpy files targetting armv6m (eg RP2040) cannot currently have more than about 2kiB of native code (between the start of the file and the init function). This commit fixes that by using bigger jumps to jump to the init function. Signed-off-by: Damien George <[email protected]>
16482fe
to
8b35f2c
Compare
Summary
Native .mpy files targetting armv6m (eg RP2040) cannot currently have more than about 2kiB of native code (between the start of the file and the init function).
This PR fixes that by using bigger jumps to jump to the init function.
Testing
Tested with
examples/natmod/features0/
by forcingmpy_ld.py
to always emit the long jump. It works.