Merge pull request #968 from pimoroni/patch-remove-exceptions-patch

Move nano specs hack into our module cmake files.
pull/969/head
Philip Howard 2024-07-04 11:08:11 +01:00 zatwierdzone przez GitHub
commit 3fefcb8609
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
16 zmienionych plików z 47 dodań i 35 usunięć

Wyświetl plik

@ -95,12 +95,6 @@ jobs:
source $BUILD_TOOLS source $BUILD_TOOLS
micropython_build_mpy_cross 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" - name: "HACK: Pico SDK Patch"
shell: bash shell: bash
run: | run: |

Wyświetl plik

@ -45,12 +45,6 @@ function micropython_version {
echo "MICROPY_GIT_HASH=$MICROPYTHON_VERSION-$TAG_OR_SHA" >> $GITHUB_ENV 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 { function hack_patch_pico_sdk {
# pico-sdk-patch.sh will apply the patch if it exists # pico-sdk-patch.sh will apply the patch if it exists
cd micropython cd micropython

Wyświetl plik

@ -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 $<$<COMPILE_LANGUAGE:CXX>:
+ -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

Wyświetl plik

@ -39,3 +39,6 @@ include(modules_py/modules_py)
# C++ Magic Memory # C++ Magic Memory
include(cppmem/micropython) include(cppmem/micropython)
# Disable build-busting C++ exceptions
include(micropython-disable-exceptions)

Wyświetl plik

@ -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 $<$<COMPILE_LANGUAGE:CXX>:
-fno-exceptions
-fno-unwind-tables
-fno-rtti
-fno-use-cxa-atexit
>)
target_link_options(usermod INTERFACE -specs=nano.specs)

Wyświetl plik

@ -48,3 +48,6 @@ include(modules_py/modules_py)
# C++ Magic Memory # C++ Magic Memory
include(cppmem/micropython) include(cppmem/micropython)
# Disable build-busting C++ exceptions
include(micropython-disable-exceptions)

Wyświetl plik

@ -39,3 +39,6 @@ include(modules_py/modules_py)
# C++ Magic Memory # C++ Magic Memory
include(cppmem/micropython) include(cppmem/micropython)
# Disable build-busting C++ exceptions
include(micropython-disable-exceptions)

Wyświetl plik

@ -50,3 +50,6 @@ copy_module(inky_frame.py)
# C++ Magic Memory # C++ Magic Memory
include(cppmem/micropython) include(cppmem/micropython)
# Disable build-busting C++ exceptions
include(micropython-disable-exceptions)

Wyświetl plik

@ -12,3 +12,6 @@ include(pico_wireless/micropython)
# C++ Magic Memory # C++ Magic Memory
include(cppmem/micropython) include(cppmem/micropython)
# Disable build-busting C++ exceptions
include(micropython-disable-exceptions)

Wyświetl plik

@ -12,3 +12,6 @@ include(pico_wireless/micropython)
# C++ Magic Memory # C++ Magic Memory
include(cppmem/micropython) include(cppmem/micropython)
# Disable build-busting C++ exceptions
include(micropython-disable-exceptions)

Wyświetl plik

@ -14,3 +14,6 @@ enable_ulab()
# C++ Magic Memory # C++ Magic Memory
include(cppmem/micropython) include(cppmem/micropython)
# Disable build-busting C++ exceptions
include(micropython-disable-exceptions)

Wyświetl plik

@ -14,3 +14,6 @@ enable_ulab()
# C++ Magic Memory # C++ Magic Memory
include(cppmem/micropython) include(cppmem/micropython)
# Disable build-busting C++ exceptions
include(micropython-disable-exceptions)

Wyświetl plik

@ -11,3 +11,6 @@ include(micropython-common)
# C++ Magic Memory # C++ Magic Memory
include(cppmem/micropython) include(cppmem/micropython)
# Disable build-busting C++ exceptions
include(micropython-disable-exceptions)

Wyświetl plik

@ -39,3 +39,6 @@ include(modules_py/modules_py)
# C++ Magic Memory # C++ Magic Memory
include(cppmem/micropython) include(cppmem/micropython)
# Disable build-busting C++ exceptions
include(micropython-disable-exceptions)

Wyświetl plik

@ -11,3 +11,6 @@ include(micropython-common)
# C++ Magic Memory # C++ Magic Memory
include(cppmem/micropython) include(cppmem/micropython)
# Disable build-busting C++ exceptions
include(micropython-disable-exceptions)

Wyświetl plik

@ -45,3 +45,6 @@ include(modules_py/modules_py)
# C++ Magic Memory # C++ Magic Memory
include(cppmem/micropython) include(cppmem/micropython)
# Disable build-busting C++ exceptions
include(micropython-disable-exceptions)