Skip to content

zephyr: Thumb code pointers always need bit 0 set. - #19730

Open
ant9000 wants to merge 1 commit into
micropython:masterfrom
ant9000:pr/zephyr-emit-thumb-make-pointer-callable
Open

ant9000 wants to merge 1 commit into
micropython:masterfrom
ant9000:pr/zephyr-emit-thumb-make-pointer-callable

Conversation

@ant9000

@ant9000 ant9000 commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

To use use mpy files, I activated MICROPY_EMIT_THUMB on a Cortex M4F board that uses Zephyr port: the change seems to work, but every now and then I now receive bus faults, while ARM code worked flawlessly.

Definining MICROPY_MAKE_POINTER_CALLABLE, as is done on other ports with thumb code active, solves part of the errors, and enables me to successfully use an externally compiled mpy module containing native code.

I'll try to pinpoint the remaining faults that still appear when enabling some frozen modules.

Testing

I have only tested the code with one single custom board, with an Ambiq Apollo3 Blue MCU (a Cortex M4F, as stated above). While this works, it is likely still incomplete.

Generative AI

I have used DeepWiki to explore the underlying cause of the problem:

https://deepwiki.com/search/activating-micropyemitthumb-in_17c1d0f4-a308-473f-a003-1c6d7c39d02c?mode=fast

The actual code is written by me, based on what is done in other ports where thumb code is active.

Signed-off-by: Antonio Galea <antonio.galea@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant