diff --git a/ports/espressif/Makefile b/ports/espressif/Makefile index 96a71b177b4..55b578c004a 100644 --- a/ports/espressif/Makefile +++ b/ports/espressif/Makefile @@ -985,7 +985,43 @@ ifeq ($(IDF_TARGET),esp32) BINARY_BLOBS += esp-idf/components/esp_phy/lib/$(IDF_TARGET)/librtc.a endif -ESP_IDF_COMPONENTS_LINK = $(IDF_TARGET_ARCH) $(CHIP_COMPONENTS) app_update bootloader_support driver esp_driver_dma esp_driver_gpio esp_driver_gptimer esp_driver_i2c esp_driver_ledc esp_driver_spi esp_driver_uart efuse esp_adc esp_app_format esp_common esp_event esp_gdbstub esp_hal_ana_conv esp_hal_clock esp_hal_gpio esp_hal_gpspi esp_hal_i2c esp_hal_ledc esp_hal_mspi esp_hal_security esp_hal_timg esp_hal_uart esp_hal_wdt esp_hw_support esp_mm esp_partition esp_pm esp_ringbuf esp_rom esp_system esp_timer freertos hal heap log esp_libc nvs_flash nvs_sec_provider pthread soc spi_flash vfs esp_stdio +# CONFIG_COMPILER_CXX_EXCEPTIONS is off, so IDF's cxx component replaces these +# with stubs that abort, and C++ code such as nvs_flash does not link libgcc's +# unwinder. Same list as esp-idf/components/cxx/CMakeLists.txt. +CXX_EXCEPTION_WRAPS = \ + __register_frame_info_bases \ + __register_frame_info \ + __register_frame \ + __register_frame_info_table_bases \ + __register_frame_info_table \ + __register_frame_table \ + __deregister_frame_info_bases \ + __deregister_frame_info \ + _Unwind_Find_FDE \ + _Unwind_GetGR \ + _Unwind_GetCFA \ + _Unwind_GetIP \ + _Unwind_GetIPInfo \ + _Unwind_GetRegionStart \ + _Unwind_GetDataRelBase \ + _Unwind_GetTextRelBase \ + _Unwind_SetIP \ + _Unwind_SetGR \ + _Unwind_GetLanguageSpecificData \ + _Unwind_FindEnclosingFunction \ + _Unwind_Resume \ + _Unwind_RaiseException \ + _Unwind_DeleteException \ + _Unwind_ForcedUnwind \ + _Unwind_Resume_or_Rethrow \ + _Unwind_Backtrace \ + __cxa_call_unexpected \ + __gxx_personality_v0 \ + __cxa_throw \ + __cxa_allocate_exception +LDFLAGS += $(foreach f,$(CXX_EXCEPTION_WRAPS),-Wl,--wrap=$(f)) + +ESP_IDF_COMPONENTS_LINK = $(IDF_TARGET_ARCH) $(CHIP_COMPONENTS) app_update bootloader_support driver esp_driver_dma esp_driver_gpio esp_driver_gptimer esp_driver_i2c esp_driver_ledc esp_driver_spi esp_driver_uart efuse esp_adc esp_app_format esp_common esp_event esp_gdbstub esp_hal_ana_conv esp_hal_clock esp_hal_gpio esp_hal_gpspi esp_hal_i2c esp_hal_ledc esp_hal_mspi esp_hal_security esp_hal_timg esp_hal_uart esp_hal_wdt esp_hw_support esp_mm esp_partition esp_pm esp_ringbuf esp_rom esp_system esp_timer freertos hal heap log esp_libc nvs_flash nvs_sec_provider pthread soc spi_flash vfs esp_stdio cxx ifneq ($(IDF_TARGET),esp32) ESP_IDF_COMPONENTS_LINK += esp_hal_systimer endif