diff --git a/components/esp32/clk.c b/components/esp32/clk.c index 54abc18b72..9e30121fc8 100644 --- a/components/esp32/clk.c +++ b/components/esp32/clk.c @@ -61,7 +61,9 @@ static void select_rtc_slow_clk(slow_clk_sel_t slow_clk); // g_ticks_us defined in ROMs for PRO and APP CPU extern uint32_t g_ticks_per_us_pro; +#ifndef CONFIG_FREERTOS_UNICORE extern uint32_t g_ticks_per_us_app; +#endif static const char* TAG = "clk"; @@ -155,7 +157,9 @@ void IRAM_ATTR ets_update_cpu_frequency(uint32_t ticks_per_us) { /* Update scale factors used by ets_delay_us */ g_ticks_per_us_pro = ticks_per_us; +#ifndef CONFIG_FREERTOS_UNICORE g_ticks_per_us_app = ticks_per_us; +#endif } static void select_rtc_slow_clk(slow_clk_sel_t slow_clk) diff --git a/components/esp32/cpu_start.c b/components/esp32/cpu_start.c index c4e3a32916..5a5dc7296c 100644 --- a/components/esp32/cpu_start.c +++ b/components/esp32/cpu_start.c @@ -361,7 +361,6 @@ void start_cpu0_default(void) #endif esp_cache_err_int_init(); esp_crosscore_int_init(); - esp_ipc_init(); #ifndef CONFIG_FREERTOS_UNICORE esp_dport_access_int_init(); #endif diff --git a/components/esp32/include/esp_ipc.h b/components/esp32/include/esp_ipc.h index b229cb3377..477b3d0af4 100644 --- a/components/esp32/include/esp_ipc.h +++ b/components/esp32/include/esp_ipc.h @@ -33,21 +33,6 @@ typedef void (*esp_ipc_func_t)(void* arg); * These APIs can only be used when FreeRTOS scheduler is running. */ - -/* - * Initialize inter-processor call module. This function is called automatically - * on CPU start and should not be called from the application. - * - * This function start two tasks, one on each CPU. These tasks are started - * with high priority. These tasks are normally inactive, waiting until one of - * the esp_ipc_call_* functions to be used. One of these tasks will be - * woken up to execute the callback provided to esp_ipc_call_nonblocking or - * esp_ipc_call_blocking. - */ -/** @cond */ -void esp_ipc_init(); -/** @endcond */ - /** * @brief Execute a function on the given CPU * diff --git a/components/esp32/ipc.c b/components/esp32/ipc.c index d10e8e819e..b54ae2846f 100644 --- a/components/esp32/ipc.c +++ b/components/esp32/ipc.c @@ -72,7 +72,19 @@ static void IRAM_ATTR ipc_task(void* arg) vTaskDelete(NULL); } -void esp_ipc_init() +/* + * Initialize inter-processor call module. This function is called automatically + * on CPU start and should not be called from the application. + * + * This function start two tasks, one on each CPU. These tasks are started + * with high priority. These tasks are normally inactive, waiting until one of + * the esp_ipc_call_* functions to be used. One of these tasks will be + * woken up to execute the callback provided to esp_ipc_call_nonblocking or + * esp_ipc_call_blocking. + */ +static void esp_ipc_init() __attribute__((constructor)); + +static void esp_ipc_init() { s_ipc_mutex = xSemaphoreCreateMutex(); s_ipc_ack = xSemaphoreCreateBinary(); diff --git a/components/soc/esp32/soc_memory_layout.c b/components/soc/esp32/soc_memory_layout.c index c6fa4635d2..de884cd45c 100644 --- a/components/soc/esp32/soc_memory_layout.c +++ b/components/soc/esp32/soc_memory_layout.c @@ -131,7 +131,9 @@ const size_t soc_memory_region_count = sizeof(soc_memory_regions)/sizeof(soc_mem These are removed from the soc_memory_regions array when heaps are created. */ SOC_RESERVE_MEMORY_REGION(0x40070000, 0x40078000, cpu0_cache); +#ifndef CONFIG_FREERTOS_UNICORE SOC_RESERVE_MEMORY_REGION(0x40078000, 0x40080000, cpu1_cache); +#endif /* Warning: The ROM stack is located in the 0x3ffe0000 area. We do not specifically disable that area here because after the scheduler has started, the ROM stack is not used anymore by anything. We handle it instead by not allowing @@ -150,7 +152,9 @@ SOC_RESERVE_MEMORY_REGION(0x40078000, 0x40080000, cpu1_cache); */ SOC_RESERVE_MEMORY_REGION(0x3ffe0000, 0x3ffe0440, rom_pro_data); //Reserve ROM PRO data region -SOC_RESERVE_MEMORY_REGION(0x3ffe4000, 0x3ffe4350, rom_app_data); //Reserve ROM APP data region +#ifndef CONFIG_FREERTOS_UNICORE +SOC_RESERVE_MEMORY_REGION(0x3ffe3f20, 0x3ffe4350, rom_app_data); //Reserve ROM APP data region +#endif SOC_RESERVE_MEMORY_REGION(0x3ffae000, 0x3ffae6e0, rom_data);