Skip to content

Commit 202c595

Browse files
committed
cache: get cpu id from register
Make sure to use ESP32 low level CPU reading when cache is disabled. This fixes the scenario when Optimization is off. Signed-off-by: Sylvio Alves <[email protected]>
1 parent d64439e commit 202c595

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

zephyr/port/host_flash/cache_utils.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
#include "esp_rom_spiflash.h"
3838
#include "hal/cache_hal.h"
3939
#include "hal/cache_ll.h"
40+
#include "hal/cpu_ll.h"
4041
#include <soc/soc.h>
4142
#include "esp_log.h"
4243

@@ -79,7 +80,7 @@ void IRAM_ATTR spi_flash_disable_interrupts_caches_and_other_cpu(void)
7980

8081
#if !defined(CONFIG_SOC_SERIES_ESP32C2) && !defined(CONFIG_SOC_SERIES_ESP32C3) && \
8182
!defined(CONFIG_SOC_SERIES_ESP32C6)
82-
int cpu_id = arch_curr_cpu()->id;
83+
int cpu_id = esp_cpu_get_core_id();
8384
#else
8485
int cpu_id = PRO_CPU_NUM;
8586
#endif
@@ -95,7 +96,7 @@ void IRAM_ATTR spi_flash_enable_interrupts_caches_and_other_cpu(void)
9596
{
9697
#if !defined(CONFIG_SOC_SERIES_ESP32C2) && !defined(CONFIG_SOC_SERIES_ESP32C3) && \
9798
!defined(CONFIG_SOC_SERIES_ESP32C6)
98-
int cpu_id = arch_curr_cpu()->id;
99+
int cpu_id = esp_cpu_get_core_id();
99100
#else
100101
int cpu_id = PRO_CPU_NUM;
101102
#endif

0 commit comments

Comments
 (0)