diff --git a/components/esp_system/CMakeLists.txt b/components/esp_system/CMakeLists.txt index 0c8ab5d422..a3276ad2c2 100644 --- a/components/esp_system/CMakeLists.txt +++ b/components/esp_system/CMakeLists.txt @@ -69,7 +69,7 @@ else() # link-time registration is used. # [refactor-todo] esp_partition required for virtual efuse # init code. Move to esp_efuse component. - pthread bootloader_support efuse esp_partition esp_pm + bootloader_support efuse esp_partition esp_pm LDFRAGMENTS "linker.lf" "app.lf") add_subdirectory(port) diff --git a/components/esp_system/startup_funcs.c b/components/esp_system/startup_funcs.c index 56449d862f..85903559bd 100644 --- a/components/esp_system/startup_funcs.c +++ b/components/esp_system/startup_funcs.c @@ -46,7 +46,6 @@ #include "esp_private/pm_impl.h" #endif -#include "esp_pthread.h" #include "esp_private/esp_clk.h" #include "esp_private/spi_flash_os.h" #include "esp_private/brownout.h" @@ -157,11 +156,6 @@ ESP_SYSTEM_INIT_FN(init_newlib_time, CORE, BIT(0), 105) return ESP_OK; } -ESP_SYSTEM_INIT_FN(init_pthread, CORE, BIT(0), 120) -{ - return esp_pthread_init(); -} - #if !CONFIG_APP_BUILD_TYPE_PURE_RAM_APP ESP_SYSTEM_INIT_FN(init_flash, CORE, BIT(0), 130) { diff --git a/components/esp_system/system_init_fn.txt b/components/esp_system/system_init_fn.txt index e30cc23575..b7fd750ab3 100644 --- a/components/esp_system/system_init_fn.txt +++ b/components/esp_system/system_init_fn.txt @@ -50,7 +50,7 @@ CORE: 112: init_vfs_usj_sec in components/esp_driver_usb_serial_jtag/src/usb_ser CORE: 114: init_vfs_console in components/vfs/vfs_console.c on BIT(0) CORE: 115: init_newlib_stdio in components/newlib/newlib_init.c on BIT(0) -CORE: 120: init_pthread in components/esp_system/startup_funcs.c on BIT(0) +CORE: 120: init_pthread in components/pthread/pthread.c on BIT(0) CORE: 130: init_flash in components/esp_system/startup_funcs.c on BIT(0) CORE: 140: init_virtual_efuse in components/esp_system/startup_funcs.c on BIT(0) CORE: 150: init_secure in components/esp_system/startup_funcs.c on BIT(0) diff --git a/components/pthread/pthread.c b/components/pthread/pthread.c index d703b1a172..9543fb59c3 100644 --- a/components/pthread/pthread.c +++ b/components/pthread/pthread.c @@ -15,6 +15,7 @@ #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "freertos/semphr.h" +#include "esp_private/startup_internal.h" #if CONFIG_SPIRAM #include "esp_private/freertos_idf_additions_priv.h" #endif @@ -71,6 +72,11 @@ static void esp_pthread_cfg_key_destructor(void *value) free(value); } +ESP_SYSTEM_INIT_FN(init_pthread, CORE, BIT(0), 120) +{ + return esp_pthread_init(); +} + esp_err_t esp_pthread_init(void) { if (pthread_key_create(&s_pthread_cfg_key, esp_pthread_cfg_key_destructor) != 0) { diff --git a/tools/test_apps/system/g1_components/CMakeLists.txt b/tools/test_apps/system/g1_components/CMakeLists.txt index 09757deb18..eec4ebf160 100644 --- a/tools/test_apps/system/g1_components/CMakeLists.txt +++ b/tools/test_apps/system/g1_components/CMakeLists.txt @@ -62,8 +62,7 @@ set(extra_components_which_shouldnt_be_included # esp_partition is a new component for separated IDF partition APIs. Added due to its involvement in the spi_flash # code. To be possibly removed (?) esp_partition - # pthread is required by esp_system (for initialization only, can be made a weak dependency) - # and cxx. See also [refactor-todo] about cxx, can it work without pthread? + # pthread is required by cxx. See [refactor-todo] about cxx, can it work without pthread? pthread )