From d5085010c87a4f5223af0904a90bc2714a5a13d5 Mon Sep 17 00:00:00 2001 From: Renz Bagaporo Date: Tue, 24 Mar 2020 22:47:34 +0800 Subject: [PATCH] soc: put hal function to get core id in IRAM --- components/soc/src/esp32/include/hal/cpu_ll.h | 4 +++- components/soc/src/esp32s2/include/hal/cpu_ll.h | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/components/soc/src/esp32/include/hal/cpu_ll.h b/components/soc/src/esp32/include/hal/cpu_ll.h index 180b615c71..f063576fb0 100644 --- a/components/soc/src/esp32/include/hal/cpu_ll.h +++ b/components/soc/src/esp32/include/hal/cpu_ll.h @@ -15,6 +15,8 @@ #include +#include "esp_attr.h" + #include "soc/cpu_caps.h" #include "xt_instr_macros.h" @@ -27,7 +29,7 @@ extern "C" { #endif -static inline int cpu_ll_get_core_id(void) +static inline int IRAM_ATTR cpu_ll_get_core_id(void) { uint32_t id; asm volatile ( diff --git a/components/soc/src/esp32s2/include/hal/cpu_ll.h b/components/soc/src/esp32s2/include/hal/cpu_ll.h index a0a002a3fb..cfcefc3dea 100644 --- a/components/soc/src/esp32s2/include/hal/cpu_ll.h +++ b/components/soc/src/esp32s2/include/hal/cpu_ll.h @@ -12,9 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. #pragma once - #include +#include "esp_attr.h" + #include "soc/cpu_caps.h" #include "xt_instr_macros.h" @@ -27,7 +28,7 @@ extern "C" { #endif -static inline int cpu_ll_get_core_id(void) +static inline int IRAM_ATTR cpu_ll_get_core_id(void) { return 0; }