feat(system_init): introduce pre-scheduler and pre-app main handler registrations

- Added macros for registering handlers to run before the scheduler and app main.
- Updated various components to utilize the new registration system for initialization.
- Refactored app startup logic to streamline initialization sequence.
This commit is contained in:
Konstantin Kondrashov
2026-09-02 16:58:44 +03:00
parent 40f25003b4
commit 754ac1dd45
21 changed files with 348 additions and 129 deletions
+13
View File
@@ -6,6 +6,7 @@
#include <stdint.h>
#include <string.h>
#include <assert.h>
#include "sdkconfig.h"
#include "esp_attr.h"
@@ -13,8 +14,10 @@
#include "esp_check.h"
#include "esp_system.h"
#include "esp_log.h"
#include "esp_chip_info.h"
#include "esp_xt_wdt.h"
#include "esp_cpu.h"
#include "esp_private/esp_sys_event_app_init.h"
#include "esp_private/startup_internal.h"
#include "freertos/FreeRTOS.h"
#include "soc/soc_caps.h"
@@ -50,6 +53,16 @@ void esp_system_include_startup_funcs(void)
// [refactor-todo] Most of these init functions should be moved to the respective components.
#if !CONFIG_ESP_INT_WDT && CONFIG_ESP32_ECO3_CACHE_LOCK_FIX
ESP_PRE_SCHEDULER_HANDLER_REGISTER(check_cache_lock_bug, 90)
{
(void)user_arg;
(void)ctx;
assert(!soc_has_cache_lock_bug() && "ESP32 Rev 3 + Dual Core + PSRAM requires INT WDT enabled in project config!");
return ESP_OK;
}
#endif
ESP_SYSTEM_INIT_FN(init_show_cpu_freq, CORE, BIT(0), 10)
{
ESP_EARLY_LOGI(TAG, "Pro cpu start user code");