diff --git a/.github/workflows/micropython.yml b/.github/workflows/micropython.yml index 8deac6b..06417d9 100644 --- a/.github/workflows/micropython.yml +++ b/.github/workflows/micropython.yml @@ -117,7 +117,7 @@ jobs: - uses: actions/checkout@v4 with: repository: gadgetoid/dir2uf2 - ref: v0.0.4 + ref: v0.0.5 path: dir2uf2 # HACK: Patch startup overclock into Pico SDK @@ -127,12 +127,11 @@ jobs: run: | git apply "${{env.FIRMWARE_DIR}}/startup_overclock.patch" - - name: "HACK: CMakeLists.txt Disable C++ Exceptions Patch" + - name: "HACK: MicroPython out of tree board pins.csv fix" shell: bash working-directory: micropython run: | git apply "${{env.FIRMWARE_DIR}}/932f76c6ba64c5a3e68de3324556d9979f09303b.patch" - git apply "${{env.FIRMWARE_DIR}}/micropython_nano_specs.patch" # Install apt packages - name: Install CCache & Compiler @@ -169,8 +168,8 @@ jobs: - name: Append Filesystem shell: bash run: | - python3 -m pip install littlefs-python==0.4.0 - ./dir2uf2/dir2uf2 --append-to micropython/ports/rp2/build/${{env.RELEASE_FILE}} --manifest ${{env.BOARD_DIR}}/uf2-manifest.txt --filename with-badger-os.uf2 ${{env.BADGER_OS_DIR}}/ + python3 -m pip install littlefs-python==0.12.0 + ./dir2uf2/dir2uf2 --fs-compact --append-to micropython/ports/rp2/build/${{env.RELEASE_FILE}} --manifest ${{env.BOARD_DIR}}/uf2-manifest.txt --filename with-badger-os.uf2 ${{env.BADGER_OS_DIR}}/ - name: Store .uf2 as artifact uses: actions/upload-artifact@v4 diff --git a/firmware/PIMORONI_BADGER2040/micropython.cmake b/firmware/PIMORONI_BADGER2040/micropython.cmake index 10c87da..3e48ec2 100644 --- a/firmware/PIMORONI_BADGER2040/micropython.cmake +++ b/firmware/PIMORONI_BADGER2040/micropython.cmake @@ -55,3 +55,14 @@ include(motor/micropython) # version.py and pimoroni.py include(modules_py/modules_py) + +# TODO: Use `include(micropython-disable-exceptions)` +# 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/firmware/PIMORONI_BADGER2040W/micropython.cmake b/firmware/PIMORONI_BADGER2040W/micropython.cmake index 54dc032..985c050 100644 --- a/firmware/PIMORONI_BADGER2040W/micropython.cmake +++ b/firmware/PIMORONI_BADGER2040W/micropython.cmake @@ -56,3 +56,14 @@ include(motor/micropython) # version.py, pimoroni.py and boot.py include(modules_py/modules_py) + +# TODO: Use `include(micropython-disable-exceptions)` +# 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/firmware/micropython_nano_specs.patch b/firmware/micropython_nano_specs.patch deleted file mode 100644 index fbfb947..0000000 --- a/firmware/micropython_nano_specs.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff --git a/ports/rp2/CMakeLists.txt b/ports/rp2/CMakeLists.txt -index e058c0a..fd97871 100644 ---- a/ports/rp2/CMakeLists.txt -+++ b/ports/rp2/CMakeLists.txt -@@ -455,6 +455,16 @@ target_link_options(${MICROPY_TARGET} PRIVATE - -Wl,--wrap=dcd_event_handler - ) - -+# 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) -+ - # Apply optimisations to performance-critical source code. - set_source_files_properties( - ${MICROPY_PY_DIR}/map.c