What is SYS_STARTUP_FN() on the ESP32?
SYS_STARTUP_FN()
is being called at the end of call_start_cpu0()
during the app startup process (after the bootloader has already finished executing).
It essentially just calls the function pointer g_startup_fn
for the current core:
#define SYS_STARTUP_FN() ((*g_startup_fn[(cpu_hal_get_core_id())])())
g_startup_fn
, in turn, is defined to basically start_cpu0
and start_cpu1
in this rather convoluted but still conceptually easy code.