mirror of
https://github.com/espressif/esp-idf.git
synced 2025-10-22 10:35:39 +00:00
[C++]: wrapper functions around unwind code
* Replaced all C++ exception related functions with wrappers if -fno-exception is used. This prevents linking of the corresponding code in libgcc. The code size will decrease by around 7-9 KB when building with -fno-exception. * added no except test app Closes https://github.com/espressif/esp-idf/pull/5380 Closes https://github.com/espressif/esp-idf/issues/5363 Closes https://github.com/espressif/esp-idf/issues/5224 Closes IDFGH-3153 Closes IDF-2577
This commit is contained in:
6
tools/test_apps/system/cxx_no_except/CMakeLists.txt
Normal file
6
tools/test_apps/system/cxx_no_except/CMakeLists.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
# The following lines of boilerplate have to be in your project's CMakeLists
|
||||
# in this exact order for cmake to work correctly
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||
project(cxx_no_except)
|
2
tools/test_apps/system/cxx_no_except/README.md
Normal file
2
tools/test_apps/system/cxx_no_except/README.md
Normal file
@@ -0,0 +1,2 @@
|
||||
| Supported Targets | ESP32 | ESP32-C3 |
|
||||
| ----------------- | ----- | -------- |
|
2
tools/test_apps/system/cxx_no_except/main/CMakeLists.txt
Normal file
2
tools/test_apps/system/cxx_no_except/main/CMakeLists.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
idf_component_register(SRCS "main.cpp"
|
||||
INCLUDE_DIRS ".")
|
27
tools/test_apps/system/cxx_no_except/main/main.cpp
Normal file
27
tools/test_apps/system/cxx_no_except/main/main.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
No except example.
|
||||
|
||||
This example code is in the Public Domain (or CC0 licensed, at your option.)
|
||||
|
||||
Unless required by applicable law or agreed to in writing, this
|
||||
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
||||
CONDITIONS OF ANY KIND, either express or implied.
|
||||
*/
|
||||
|
||||
#include "esp_system.h"
|
||||
#include <new>
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
|
||||
extern "C" void app_main()
|
||||
{
|
||||
char *char_array = new (std::nothrow) char [47];
|
||||
|
||||
for (int i = 10; i >= 0; i--) {
|
||||
char_array[i] = i;
|
||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||
}
|
||||
esp_restart();
|
||||
|
||||
delete [] char_array;
|
||||
}
|
2
tools/test_apps/system/cxx_no_except/sdkconfig.ci.riscv
Normal file
2
tools/test_apps/system/cxx_no_except/sdkconfig.ci.riscv
Normal file
@@ -0,0 +1,2 @@
|
||||
CONFIG_IDF_TARGET="esp32c3"
|
||||
CONFIG_COMPILER_CXX_EXCEPTIONS=n
|
2
tools/test_apps/system/cxx_no_except/sdkconfig.ci.xtensa
Normal file
2
tools/test_apps/system/cxx_no_except/sdkconfig.ci.xtensa
Normal file
@@ -0,0 +1,2 @@
|
||||
CONFIG_IDF_TARGET="esp32"
|
||||
CONFIG_COMPILER_CXX_EXCEPTIONS=n
|
Reference in New Issue
Block a user