Skip to content

Commit 3fefcb8

Browse files
authored
Merge pull request #968 from pimoroni/patch-remove-exceptions-patch
Move nano specs hack into our module cmake files.
2 parents a8cc54e + e0d9510 commit 3fefcb8

16 files changed

+47
-35
lines changed

.github/workflows/micropython.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,6 @@ jobs:
9595
source $BUILD_TOOLS
9696
micropython_build_mpy_cross
9797
98-
- name: "HACK: CMakeLists.txt Disable C++ Exceptions Patch"
99-
shell: bash
100-
run: |
101-
source $BUILD_TOOLS
102-
hack_patch_micropython_disable_exceptions
103-
10498
- name: "HACK: Pico SDK Patch"
10599
shell: bash
106100
run: |

ci/micropython.sh

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,6 @@ function micropython_version {
4545
echo "MICROPY_GIT_HASH=$MICROPYTHON_VERSION-$TAG_OR_SHA" >> $GITHUB_ENV
4646
}
4747

48-
function hack_patch_micropython_disable_exceptions {
49-
cd micropython
50-
git apply $PIMORONI_PICO_DIR/micropython/micropython_nano_specs.patch
51-
cd ../
52-
}
53-
5448
function hack_patch_pico_sdk {
5549
# pico-sdk-patch.sh will apply the patch if it exists
5650
cd micropython

micropython/micropython_nano_specs.patch

Lines changed: 0 additions & 21 deletions
This file was deleted.

micropython/modules/micropython-cosmic_unicorn.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,6 @@ include(modules_py/modules_py)
3939

4040
# C++ Magic Memory
4141
include(cppmem/micropython)
42+
43+
# Disable build-busting C++ exceptions
44+
include(micropython-disable-exceptions)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Do not include stack unwinding & exception handling for C++ user modules
2+
target_compile_definitions(usermod INTERFACE PICO_CXX_ENABLE_EXCEPTIONS=0)
3+
target_compile_options(usermod INTERFACE $<$<COMPILE_LANGUAGE:CXX>:
4+
-fno-exceptions
5+
-fno-unwind-tables
6+
-fno-rtti
7+
-fno-use-cxa-atexit
8+
>)
9+
target_link_options(usermod INTERFACE -specs=nano.specs)

micropython/modules/micropython-enviro.cmake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,7 @@ include(motor/micropython)
4747
include(modules_py/modules_py)
4848

4949
# C++ Magic Memory
50-
include(cppmem/micropython)
50+
include(cppmem/micropython)
51+
52+
# Disable build-busting C++ exceptions
53+
include(micropython-disable-exceptions)

micropython/modules/micropython-galactic_unicorn.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,6 @@ include(modules_py/modules_py)
3939

4040
# C++ Magic Memory
4141
include(cppmem/micropython)
42+
43+
# Disable build-busting C++ exceptions
44+
include(micropython-disable-exceptions)

micropython/modules/micropython-inky_frame.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,6 @@ copy_module(inky_frame.py)
5050

5151
# C++ Magic Memory
5252
include(cppmem/micropython)
53+
54+
# Disable build-busting C++ exceptions
55+
include(micropython-disable-exceptions)

micropython/modules/micropython-pico.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,6 @@ include(pico_wireless/micropython)
1212

1313
# C++ Magic Memory
1414
include(cppmem/micropython)
15+
16+
# Disable build-busting C++ exceptions
17+
include(micropython-disable-exceptions)

micropython/modules/micropython-pico_usb.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,6 @@ include(pico_wireless/micropython)
1212

1313
# C++ Magic Memory
1414
include(cppmem/micropython)
15+
16+
# Disable build-busting C++ exceptions
17+
include(micropython-disable-exceptions)

0 commit comments

Comments
 (0)