Description
I'm unclear whether it is possible or not to support @micropython.native
(and native .mpy modules) on the RP2040. #2271 allowed boards to "enable the decorator by adding CIRCUITPY_ENABLE_MPY_NATIVE
to mkboardconfig.mk
."
For ports/raspberrypi/mkboardconfig.mk
, adding CIRCUITPY_ENABLE_MPY_NATIVE = 1
is not sufficient. There are a handful of build errors:
GEN build-raspberry_pi_pico/genhdr/qstrdefs.generated.h
../../py/compile.c: In function 'compile_built_in_decorator':
../../py/compile.c:839:24: error: 'MP_QSTR_native' undeclared (first use in this function); did you mean 'MP_QSTR_active'?
839 | } else if (attr == MP_QSTR_native) {
| ^~~~~~~~~~~~~~
| MP_QSTR_active
I found this is because MICROPY_PY_UCTYPES
is not enabled. Its definition in py/mpconfig.h
makes it dependent on MICROPY_CONFIG_ROM_LEVEL_AT_LEAST_EXTRA_FEATURES
but I guess this is not set for the Raspberry Pi port.
After forcing CircuitPython to build, the rp2040js emulator can run the firmware but crashes when you try to use @micropython.native
. Unsure if that's a limitation of the emulator or if it's just not possible to use native code on this chip.