diff --git a/.github/workflows/micropython.yml b/.github/workflows/micropython.yml index 027558d6..4e4ee5ad 100644 --- a/.github/workflows/micropython.yml +++ b/.github/workflows/micropython.yml @@ -95,12 +95,6 @@ jobs: source $BUILD_TOOLS micropython_build_mpy_cross - - name: "HACK: CMakeLists.txt Disable C++ Exceptions Patch" - shell: bash - run: | - source $BUILD_TOOLS - hack_patch_micropython_disable_exceptions - - name: "HACK: Pico SDK Patch" shell: bash run: | diff --git a/ci/micropython.sh b/ci/micropython.sh index c6887407..2f598c08 100644 --- a/ci/micropython.sh +++ b/ci/micropython.sh @@ -45,12 +45,6 @@ function micropython_version { echo "MICROPY_GIT_HASH=$MICROPYTHON_VERSION-$TAG_OR_SHA" >> $GITHUB_ENV } -function hack_patch_micropython_disable_exceptions { - cd micropython - git apply $PIMORONI_PICO_DIR/micropython/micropython_nano_specs.patch - cd ../ -} - function hack_patch_pico_sdk { # pico-sdk-patch.sh will apply the patch if it exists cd micropython diff --git a/micropython/micropython_nano_specs.patch b/micropython/micropython_nano_specs.patch deleted file mode 100644 index 5ae938b3..00000000 --- a/micropython/micropython_nano_specs.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff --git a/ports/rp2/CMakeLists.txt b/ports/rp2/CMakeLists.txt -index fcc435b7b..efabcb3a3 100644 ---- a/ports/rp2/CMakeLists.txt -+++ b/ports/rp2/CMakeLists.txt -@@ -464,6 +464,16 @@ set_source_files_properties( - COMPILE_OPTIONS "-O2" - ) - -+# Do not include stack unwinding & exception handling for C++ user modules -+target_compile_definitions(usermod INTERFACE PICO_CXX_ENABLE_EXCEPTIONS=0) -+target_compile_options(usermod INTERFACE $<$: -+ -fno-exceptions -+ -fno-unwind-tables -+ -fno-rtti -+ -fno-use-cxa-atexit -+>) -+target_link_options(usermod INTERFACE -specs=nano.specs) -+ - set_source_files_properties( - ${PICO_SDK_PATH}/src/rp2_common/pico_double/double_math.c - ${PICO_SDK_PATH}/src/rp2_common/pico_float/float_math.c diff --git a/micropython/modules/micropython-cosmic_unicorn.cmake b/micropython/modules/micropython-cosmic_unicorn.cmake index ec4d72ea..c14af9dd 100644 --- a/micropython/modules/micropython-cosmic_unicorn.cmake +++ b/micropython/modules/micropython-cosmic_unicorn.cmake @@ -39,3 +39,6 @@ include(modules_py/modules_py) # C++ Magic Memory include(cppmem/micropython) + +# Disable build-busting C++ exceptions +include(micropython-disable-exceptions) diff --git a/micropython/modules/micropython-disable-exceptions.cmake b/micropython/modules/micropython-disable-exceptions.cmake new file mode 100644 index 00000000..e8b1082c --- /dev/null +++ b/micropython/modules/micropython-disable-exceptions.cmake @@ -0,0 +1,9 @@ +# Do not include stack unwinding & exception handling for C++ user modules +target_compile_definitions(usermod INTERFACE PICO_CXX_ENABLE_EXCEPTIONS=0) +target_compile_options(usermod INTERFACE $<$: + -fno-exceptions + -fno-unwind-tables + -fno-rtti + -fno-use-cxa-atexit +>) +target_link_options(usermod INTERFACE -specs=nano.specs) diff --git a/micropython/modules/micropython-enviro.cmake b/micropython/modules/micropython-enviro.cmake index cd5f00c6..d305caf7 100644 --- a/micropython/modules/micropython-enviro.cmake +++ b/micropython/modules/micropython-enviro.cmake @@ -47,4 +47,7 @@ include(motor/micropython) include(modules_py/modules_py) # C++ Magic Memory -include(cppmem/micropython) \ No newline at end of file +include(cppmem/micropython) + +# Disable build-busting C++ exceptions +include(micropython-disable-exceptions) \ No newline at end of file diff --git a/micropython/modules/micropython-galactic_unicorn.cmake b/micropython/modules/micropython-galactic_unicorn.cmake index 6f0a8368..15bbfcfa 100644 --- a/micropython/modules/micropython-galactic_unicorn.cmake +++ b/micropython/modules/micropython-galactic_unicorn.cmake @@ -39,3 +39,6 @@ include(modules_py/modules_py) # C++ Magic Memory include(cppmem/micropython) + +# Disable build-busting C++ exceptions +include(micropython-disable-exceptions) diff --git a/micropython/modules/micropython-inky_frame.cmake b/micropython/modules/micropython-inky_frame.cmake index c78424a9..6cd21038 100644 --- a/micropython/modules/micropython-inky_frame.cmake +++ b/micropython/modules/micropython-inky_frame.cmake @@ -50,3 +50,6 @@ copy_module(inky_frame.py) # C++ Magic Memory include(cppmem/micropython) + +# Disable build-busting C++ exceptions +include(micropython-disable-exceptions) diff --git a/micropython/modules/micropython-pico.cmake b/micropython/modules/micropython-pico.cmake index 60fad7c8..bae9f9c5 100644 --- a/micropython/modules/micropython-pico.cmake +++ b/micropython/modules/micropython-pico.cmake @@ -12,3 +12,6 @@ include(pico_wireless/micropython) # C++ Magic Memory include(cppmem/micropython) + +# Disable build-busting C++ exceptions +include(micropython-disable-exceptions) \ No newline at end of file diff --git a/micropython/modules/micropython-pico_usb.cmake b/micropython/modules/micropython-pico_usb.cmake index 60fad7c8..011b5498 100644 --- a/micropython/modules/micropython-pico_usb.cmake +++ b/micropython/modules/micropython-pico_usb.cmake @@ -12,3 +12,6 @@ include(pico_wireless/micropython) # C++ Magic Memory include(cppmem/micropython) + +# Disable build-busting C++ exceptions +include(micropython-disable-exceptions) diff --git a/micropython/modules/micropython-picolipo_16mb.cmake b/micropython/modules/micropython-picolipo_16mb.cmake index 94ed6a2b..8b6acbf7 100644 --- a/micropython/modules/micropython-picolipo_16mb.cmake +++ b/micropython/modules/micropython-picolipo_16mb.cmake @@ -14,3 +14,6 @@ enable_ulab() # C++ Magic Memory include(cppmem/micropython) + +# Disable build-busting C++ exceptions +include(micropython-disable-exceptions) diff --git a/micropython/modules/micropython-picolipo_4mb.cmake b/micropython/modules/micropython-picolipo_4mb.cmake index 94ed6a2b..8b6acbf7 100644 --- a/micropython/modules/micropython-picolipo_4mb.cmake +++ b/micropython/modules/micropython-picolipo_4mb.cmake @@ -14,3 +14,6 @@ enable_ulab() # C++ Magic Memory include(cppmem/micropython) + +# Disable build-busting C++ exceptions +include(micropython-disable-exceptions) diff --git a/micropython/modules/micropython-picow.cmake b/micropython/modules/micropython-picow.cmake index bb5b677f..d4cb4fb9 100644 --- a/micropython/modules/micropython-picow.cmake +++ b/micropython/modules/micropython-picow.cmake @@ -11,3 +11,6 @@ include(micropython-common) # C++ Magic Memory include(cppmem/micropython) + +# Disable build-busting C++ exceptions +include(micropython-disable-exceptions) diff --git a/micropython/modules/micropython-stellar_unicorn.cmake b/micropython/modules/micropython-stellar_unicorn.cmake index 913063db..d44fb45d 100644 --- a/micropython/modules/micropython-stellar_unicorn.cmake +++ b/micropython/modules/micropython-stellar_unicorn.cmake @@ -39,3 +39,6 @@ include(modules_py/modules_py) # C++ Magic Memory include(cppmem/micropython) + +# Disable build-busting C++ exceptions +include(micropython-disable-exceptions) diff --git a/micropython/modules/micropython-tiny2040_8mb.cmake b/micropython/modules/micropython-tiny2040_8mb.cmake index bb5b677f..d4cb4fb9 100644 --- a/micropython/modules/micropython-tiny2040_8mb.cmake +++ b/micropython/modules/micropython-tiny2040_8mb.cmake @@ -11,3 +11,6 @@ include(micropython-common) # C++ Magic Memory include(cppmem/micropython) + +# Disable build-busting C++ exceptions +include(micropython-disable-exceptions) diff --git a/micropython/modules/micropython-tufty2040.cmake b/micropython/modules/micropython-tufty2040.cmake index 11f28bc0..50243796 100644 --- a/micropython/modules/micropython-tufty2040.cmake +++ b/micropython/modules/micropython-tufty2040.cmake @@ -44,4 +44,7 @@ enable_ulab() include(modules_py/modules_py) # C++ Magic Memory -include(cppmem/micropython) \ No newline at end of file +include(cppmem/micropython) + +# Disable build-busting C++ exceptions +include(micropython-disable-exceptions) \ No newline at end of file