From b7a897827ffa2752d9b80f15272318505465825d Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Tue, 28 Mar 2023 12:51:30 +0100 Subject: [PATCH] ports/rp2: Use nano.specs for C++ modules. Remove C++ stack unwinding and exception handling in all cases. Set options as per https://github.com/raspberrypi/pico-sdk/blob/master/src/rp2_common/pico_cxx_options/CMakeLists.txt Save around 10,880 bytes of RAM. Signed-off-by: Phil Howard --- ports/rp2/CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ports/rp2/CMakeLists.txt b/ports/rp2/CMakeLists.txt index 094031c685..5f268414c0 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 $<$: + -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