diff --git a/.gitlab/ci/build.yml b/.gitlab/ci/build.yml index f7ed2345dc..d426199070 100644 --- a/.gitlab/ci/build.yml +++ b/.gitlab/ci/build.yml @@ -56,7 +56,7 @@ variables: IDF_TOOLCHAIN: clang TEST_BUILD_OPTS_EXTRA: "" - TEST_DIR: tools/test_apps/system/cxx_pthread_bluetooth + TEST_DIR: tools/test_apps/system/clang_build_test script: # CI specific options start from "--parallel-count xxx". could ignore when running locally - run_cmd python tools/ci/ci_build_apps.py $TEST_DIR -v diff --git a/tools/test_apps/system/.build-test-rules.yml b/tools/test_apps/system/.build-test-rules.yml index 90468165c8..64f3807f11 100644 --- a/tools/test_apps/system/.build-test-rules.yml +++ b/tools/test_apps/system/.build-test-rules.yml @@ -11,18 +11,18 @@ tools/test_apps/system/build_test: - if: CONFIG_NAME == "usb_console_ets_printf" AND SOC_USB_OTG_SUPPORTED != 1 - if: CONFIG_NAME == "phy_multiple_init_data" AND IDF_TARGET == "esp32p4" # Update with caps here when IDF-7460 is resolved +tools/test_apps/system/clang_build_test: + enable: + - if: IDF_TARGET in ["esp32", "esp32s2", "esp32s3", "esp32c2", "esp32c3", "esp32c5", "esp32c6", "esp32h2", "esp32p4"] + temporary: true + reason: the other targets are not supported yet + tools/test_apps/system/cxx_no_except: enable: - if: IDF_TARGET == "esp32" or IDF_TARGET == "esp32c3" temporary: true reason: the other targets are not tested yet -tools/test_apps/system/cxx_pthread_bluetooth: - enable: - - if: IDF_TARGET in ["esp32", "esp32s2", "esp32s3", "esp32c2", "esp32c3", "esp32c5", "esp32c6", "esp32h2", "esp32p4"] - temporary: true - reason: the other targets are not supported yet - tools/test_apps/system/eh_frame: enable: - if: IDF_TARGET in ["esp32c2", "esp32c3"] diff --git a/tools/test_apps/system/cxx_pthread_bluetooth/CMakeLists.txt b/tools/test_apps/system/clang_build_test/CMakeLists.txt similarity index 100% rename from tools/test_apps/system/cxx_pthread_bluetooth/CMakeLists.txt rename to tools/test_apps/system/clang_build_test/CMakeLists.txt diff --git a/tools/test_apps/system/clang_build_test/README.md b/tools/test_apps/system/clang_build_test/README.md new file mode 100644 index 0000000000..c410436a3a --- /dev/null +++ b/tools/test_apps/system/clang_build_test/README.md @@ -0,0 +1,4 @@ +| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 | +| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | + +This project is for testing if the application can be built with Clang toolchain. diff --git a/tools/test_apps/system/cxx_pthread_bluetooth/main/CMakeLists.txt b/tools/test_apps/system/clang_build_test/main/CMakeLists.txt similarity index 64% rename from tools/test_apps/system/cxx_pthread_bluetooth/main/CMakeLists.txt rename to tools/test_apps/system/clang_build_test/main/CMakeLists.txt index a544dc4fed..7f0828d2a3 100644 --- a/tools/test_apps/system/cxx_pthread_bluetooth/main/CMakeLists.txt +++ b/tools/test_apps/system/clang_build_test/main/CMakeLists.txt @@ -1,3 +1,3 @@ -idf_component_register(SRCS "cpp_pthread.cpp" +idf_component_register(SRCS "test_main.cpp" INCLUDE_DIRS "." PRIV_REQUIRES pthread bt) diff --git a/tools/test_apps/system/cxx_pthread_bluetooth/main/cpp_pthread.cpp b/tools/test_apps/system/clang_build_test/main/test_main.cpp similarity index 97% rename from tools/test_apps/system/cxx_pthread_bluetooth/main/cpp_pthread.cpp rename to tools/test_apps/system/clang_build_test/main/test_main.cpp index 0015facbd7..5c4ee5d12e 100644 --- a/tools/test_apps/system/cxx_pthread_bluetooth/main/cpp_pthread.cpp +++ b/tools/test_apps/system/clang_build_test/main/test_main.cpp @@ -80,7 +80,7 @@ esp_pthread_cfg_t create_config(const char *name, int core_id, int stack, int pr extern "C" void app_main(void) { - // Create a thread using deafult values that can run on any core + // Create a thread using default values that can run on any core auto cfg = esp_pthread_get_default_config(); esp_pthread_set_cfg(&cfg); std::thread any_core(thread_func_any_core); diff --git a/tools/test_apps/system/cxx_pthread_bluetooth/sdkconfig.ci.clang_libclang_rt b/tools/test_apps/system/clang_build_test/sdkconfig.ci.clang_libclang_rt similarity index 100% rename from tools/test_apps/system/cxx_pthread_bluetooth/sdkconfig.ci.clang_libclang_rt rename to tools/test_apps/system/clang_build_test/sdkconfig.ci.clang_libclang_rt diff --git a/tools/test_apps/system/cxx_pthread_bluetooth/sdkconfig.ci.clang_libgcc b/tools/test_apps/system/clang_build_test/sdkconfig.ci.clang_libgcc similarity index 100% rename from tools/test_apps/system/cxx_pthread_bluetooth/sdkconfig.ci.clang_libgcc rename to tools/test_apps/system/clang_build_test/sdkconfig.ci.clang_libgcc diff --git a/tools/test_apps/system/cxx_pthread_bluetooth/sdkconfig.defaults b/tools/test_apps/system/clang_build_test/sdkconfig.defaults similarity index 100% rename from tools/test_apps/system/cxx_pthread_bluetooth/sdkconfig.defaults rename to tools/test_apps/system/clang_build_test/sdkconfig.defaults diff --git a/tools/test_apps/system/cxx_pthread_bluetooth/README.md b/tools/test_apps/system/cxx_pthread_bluetooth/README.md deleted file mode 100644 index 5620cb083f..0000000000 --- a/tools/test_apps/system/cxx_pthread_bluetooth/README.md +++ /dev/null @@ -1,51 +0,0 @@ -| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 | -| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | - -# C++ pthread Example - -(See the README.md file in the upper level 'examples' directory for more information about examples.) - -Support for the [C++ threads](http://www.cplusplus.com/reference/thread/thread/) in ESP-IDF is implemented on top of the [ESP-pthread](https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/system/esp_pthread.html#overview) component. Thus, C++ threads created using the standard thread class constructor will automatically inherit the current ESP-pthread configuration. This example demonstrates how to leverage the thread configuration functions provided by ESP-pthread (e.g., `esp_pthread_get_default_config()` and `esp_pthread_set_cfg()`) to modify the stack sizes, priorities, names, and core affinities of the C++ threads. - -**Note: Due to the use of the C++ threads, this example is written in C++ instead of C.** - -## How to use example - -### Hardware Required - -This example should be able to run on any commonly available ESP32 development board. - -### Configure the project - -``` -idf.py menuconfig -``` - -* The default ESP-pthread configuration may also be modified under `Component config > PThreads` - -### Build and Flash - -Build the project and flash it to the board, then run monitor tool to view serial output: - -``` -idf.py -p PORT flash monitor -``` - -(Replace PORT with the name of the serial port to use.) - -(To exit the serial monitor, type ``Ctrl-]``.) - -See the Getting Started Guide for full steps to configure and use ESP-IDF to build projects. - -## Example Output - -The following log output should appear when the example runs (note that the bootloader log has been omitted). - -``` -... -I (380) Thread 1: Core id: 0, prio: 5, minimum free stack: 2068 bytes. -I (0) pthread: This thread (with the default name) may run on any core.Core id: 1, prio: 5, minimum free stack: 2056 bytes. -I (390) Thread 1: This is the INHERITING thread with the same parameters as our parent, including name. Core id: 0, prio: 5, minimum free stack: 2092 bytes. -I (410) Thread 2: Core id: 1, prio: 5, minimum free stack: 2088 bytes. -I (410) main: core id: 0, prio: 1, minimum free stack: 2928 bytes. -```