From 38af9dffe1a31343853d17caeecb0f9a37a0264f Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Tue, 2 Mar 2021 15:59:44 +1100 Subject: [PATCH] esp_system: Mark the startup array as 'const' to save RAM --- components/esp_system/include/esp_private/startup_internal.h | 5 +++-- components/esp_system/startup.c | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/components/esp_system/include/esp_private/startup_internal.h b/components/esp_system/include/esp_private/startup_internal.h index 42b901cbf4..52ec6e09b3 100644 --- a/components/esp_system/include/esp_private/startup_internal.h +++ b/components/esp_system/include/esp_private/startup_internal.h @@ -31,10 +31,11 @@ extern bool g_spiram_ok; // [refactor-todo] better way to communicate this from // array, one per core. typedef void (*sys_startup_fn_t)(void); +/* This array of per-CPU system layer startup functions is initialized in the non-port part of esp_system */ #if !CONFIG_ESP_SYSTEM_SINGLE_CORE_MODE -extern sys_startup_fn_t g_startup_fn[SOC_CPU_CORES_NUM]; +extern sys_startup_fn_t const g_startup_fn[SOC_CPU_CORES_NUM]; #else -extern sys_startup_fn_t g_startup_fn[1]; +extern sys_startup_fn_t const g_startup_fn[1]; #endif // Utility to execute `sys_startup_fn_t` for the current core. diff --git a/components/esp_system/startup.c b/components/esp_system/startup.c index 4d398733dc..4acd8c34e6 100644 --- a/components/esp_system/startup.c +++ b/components/esp_system/startup.c @@ -113,7 +113,7 @@ void esp_startup_start_app_other_cores(void) __attribute__((weak, alias("esp_sta static volatile bool s_system_inited[SOC_CPU_CORES_NUM] = { false }; -sys_startup_fn_t g_startup_fn[SOC_CPU_CORES_NUM] = { [0] = start_cpu0, +const sys_startup_fn_t g_startup_fn[SOC_CPU_CORES_NUM] = { [0] = start_cpu0, #if SOC_CPU_CORES_NUM > 1 [1 ... SOC_CPU_CORES_NUM - 1] = start_cpu_other_cores #endif @@ -121,7 +121,7 @@ sys_startup_fn_t g_startup_fn[SOC_CPU_CORES_NUM] = { [0] = start_cpu0, static volatile bool s_system_full_inited = false; #else -sys_startup_fn_t g_startup_fn[1] = { start_cpu0 }; +const sys_startup_fn_t g_startup_fn[1] = { start_cpu0 }; #endif #ifdef CONFIG_COMPILER_CXX_EXCEPTIONS