refactor(pthread): decouple pthread_init from esp_system

This commit is contained in:
Marius Vikhammer 2024-02-05 17:38:53 +08:00
parent ae31dfe4b8
commit 2bb16ed45b
5 changed files with 9 additions and 10 deletions

View File

@ -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)

View File

@ -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)
{

View File

@ -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)

View File

@ -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) {

View File

@ -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
)