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
+9
View File
@@ -34,3 +34,12 @@ if(CONFIG_ESP_SYSTEM_PANIC_GDBSTUB)
# Make sure the panic event registration in gdbstub.c is considered by the linker
target_link_libraries(${COMPONENT_LIB} INTERFACE "-u esp_gdbstub_panic_handler")
endif()
if(CONFIG_ESP_SYSTEM_GDBSTUB_RUNTIME)
# Pull in the PRE_SCHEDULER registration from gdbstub.c.
target_link_libraries(${COMPONENT_LIB} INTERFACE "-u esp_gdbstub_init")
if(CONFIG_IDF_TARGET_ARCH_XTENSA)
# Pull in the Xtensa debug exception handler from its separate object file.
target_link_libraries(${COMPONENT_LIB} INTERFACE "-u _xt_panic_gdbstub")
endif()
endif()
+9
View File
@@ -25,6 +25,7 @@
#endif
#include "esp_private/esp_sys_event_panic.h"
#include "esp_private/esp_sys_event_app_init.h"
#include "esp_private/panic_internal.h"
#include "esp_private/crosscore_int.h"
@@ -451,6 +452,14 @@ void esp_gdbstub_init(void)
esp_intr_alloc(ETS_UART0_INTR_SOURCE, 0, esp_gdbstub_int, NULL, NULL);
esp_gdbstub_init_dports();
}
ESP_PRE_SCHEDULER_HANDLER_REGISTER(init_gdbstub, 130)
{
(void)user_arg;
(void)ctx;
esp_gdbstub_init();
return ESP_OK;
}
#endif /* CONFIG_ESP_SYSTEM_GDBSTUB_RUNTIME */
#ifdef CONFIG_ESP_GDBSTUB_SUPPORT_TASKS