pimoroni-pico/micropython/micropython_nano_specs.patch

21 lines
815 B
Diff
Raw Normal View History

diff --git a/ports/rp2/CMakeLists.txt b/ports/rp2/CMakeLists.txt
index 094031c6852a..5f268414c08f 100644
--- a/ports/rp2/CMakeLists.txt
+++ b/ports/rp2/CMakeLists.txt
@@ -374,6 +374,15 @@ target_compile_options(${MICROPY_TARGET} PRIVATE
target_link_options(${MICROPY_TARGET} PRIVATE
-Wl,--defsym=__micropy_c_heap_size__=${MICROPY_C_HEAP_SIZE}
)
+# 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