Browse Source

ports/rp2: Add nano.specs snippet for C++ modules.

Document how to reemove C++ stack unwinding and exception handling.

Set options as per https://github.com/raspberrypi/pico-sdk/blob/master/src/rp2_common/pico_cxx_options/CMakeLists.txt

Saves around 10,880 bytes of RAM in our batteries-included build.

Signed-off-by: Phil Howard <phil@gadgetoid.com>
pull/11143/head
Phil Howard 2 years ago
parent
commit
65913d8e66
  1. 11
      examples/usercmodule/cppexample/micropython.cmake

11
examples/usercmodule/cppexample/micropython.cmake

@ -14,3 +14,14 @@ target_include_directories(usermod_cppexample INTERFACE
# Link our INTERFACE library to the usermod target.
target_link_libraries(usermod INTERFACE usermod_cppexample)
# Do not include stack unwinding & exception handling for C++ user modules
# This can dramatically reduce build size on embedded ports like rp2
# 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)
Loading…
Cancel
Save