|
|
|
|
@@ -81,7 +81,7 @@
|
|
|
|
|
uint64_t g_startup_time = 0;
|
|
|
|
|
|
|
|
|
|
// App entry point for core 0
|
|
|
|
|
extern void start_app(void);
|
|
|
|
|
extern void esp_startup_start_app(void);
|
|
|
|
|
|
|
|
|
|
// Entry point for core 0 from hardware init (port layer)
|
|
|
|
|
void start_cpu0(void) __attribute__((weak, alias("start_cpu0_default"))) __attribute__((noreturn));
|
|
|
|
|
@@ -91,7 +91,7 @@ void start_cpu0(void) __attribute__((weak, alias("start_cpu0_default"))) __attri
|
|
|
|
|
void start_cpu_other_cores(void) __attribute__((weak, alias("start_cpu_other_cores_default"))) __attribute__((noreturn));
|
|
|
|
|
|
|
|
|
|
// App entry point for core [1..X]
|
|
|
|
|
void start_app_other_cores(void) __attribute__((weak, alias("start_app_other_cores_default"))) __attribute__((noreturn));
|
|
|
|
|
void esp_startup_start_app_other_cores(void) __attribute__((weak, alias("esp_startup_start_app_other_cores_default"))) __attribute__((noreturn));
|
|
|
|
|
|
|
|
|
|
static volatile bool s_system_inited[SOC_CPU_CORES_NUM] = { false };
|
|
|
|
|
|
|
|
|
|
@@ -120,7 +120,7 @@ static IRAM_ATTR void _Unwind_SetNoFunctionContextInstall_Default(unsigned char
|
|
|
|
|
|
|
|
|
|
static const char* TAG = "cpu_start";
|
|
|
|
|
|
|
|
|
|
static void IRAM_ATTR do_global_ctors(void)
|
|
|
|
|
static void do_global_ctors(void)
|
|
|
|
|
{
|
|
|
|
|
extern void (*__init_array_start)(void);
|
|
|
|
|
extern void (*__init_array_end)(void);
|
|
|
|
|
@@ -140,7 +140,7 @@ static void IRAM_ATTR do_global_ctors(void)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void IRAM_ATTR do_system_init_fn(void)
|
|
|
|
|
static void do_system_init_fn(void)
|
|
|
|
|
{
|
|
|
|
|
extern esp_system_init_fn_t _esp_system_init_fn_array_start;
|
|
|
|
|
extern esp_system_init_fn_t _esp_system_init_fn_array_end;
|
|
|
|
|
@@ -159,14 +159,14 @@ static void IRAM_ATTR do_system_init_fn(void)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#if !CONFIG_ESP_SYSTEM_SINGLE_CORE_MODE
|
|
|
|
|
static void IRAM_ATTR start_app_other_cores_default(void)
|
|
|
|
|
static void esp_startup_start_app_other_cores_default(void)
|
|
|
|
|
{
|
|
|
|
|
while (1) {
|
|
|
|
|
esp_rom_delay_us(UINT32_MAX);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void IRAM_ATTR start_cpu_other_cores_default(void)
|
|
|
|
|
static void start_cpu_other_cores_default(void)
|
|
|
|
|
{
|
|
|
|
|
do_system_init_fn();
|
|
|
|
|
|
|
|
|
|
@@ -174,11 +174,11 @@ static void IRAM_ATTR start_cpu_other_cores_default(void)
|
|
|
|
|
esp_rom_delay_us(100);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
start_app_other_cores();
|
|
|
|
|
esp_startup_start_app_other_cores();
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
static void IRAM_ATTR do_core_init(void)
|
|
|
|
|
static void do_core_init(void)
|
|
|
|
|
{
|
|
|
|
|
/* Initialize heap allocator. WARNING: This *needs* to happen *after* the app cpu has booted.
|
|
|
|
|
If the heap allocator is initialized first, it will put free memory linked list items into
|
|
|
|
|
@@ -277,7 +277,7 @@ static void IRAM_ATTR do_core_init(void)
|
|
|
|
|
assert(flash_ret == ESP_OK);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void IRAM_ATTR do_secondary_init(void)
|
|
|
|
|
static void do_secondary_init(void)
|
|
|
|
|
{
|
|
|
|
|
#if !CONFIG_ESP_SYSTEM_SINGLE_CORE_MODE
|
|
|
|
|
// The port layer transferred control to this function with other cores 'paused',
|
|
|
|
|
@@ -304,7 +304,7 @@ static void IRAM_ATTR do_secondary_init(void)
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void IRAM_ATTR start_cpu0_default(void)
|
|
|
|
|
static void start_cpu0_default(void)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
ESP_EARLY_LOGI(TAG, "Pro cpu start user code");
|
|
|
|
|
@@ -353,7 +353,7 @@ void IRAM_ATTR start_cpu0_default(void)
|
|
|
|
|
s_system_full_inited = true;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
start_app();
|
|
|
|
|
esp_startup_start_app();
|
|
|
|
|
while (1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|