From 348825a43827773d3d9ee9e05cdf77bbb9bf1bf6 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Tue, 29 Aug 2017 08:25:41 +0800 Subject: [PATCH] freertos: make sure xPortGetCoreID is placed into IRAM In some cases, xPortGetCoreID was not inlined, and ended up in flash. Since this function is used in many situations when cache is disabled, that caused exceptions. Adding IRAM attribute to fix that. --- components/freertos/include/freertos/portable.h | 2 +- components/freertos/include/freertos/portmacro.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/components/freertos/include/freertos/portable.h b/components/freertos/include/freertos/portable.h index d62ce01b72..d6afa3074b 100644 --- a/components/freertos/include/freertos/portable.h +++ b/components/freertos/include/freertos/portable.h @@ -214,7 +214,7 @@ BaseType_t xPortInIsrContext(); #endif /* Multi-core: get current core ID */ -static inline uint32_t xPortGetCoreID() { +static inline uint32_t IRAM_ATTR xPortGetCoreID() { int id; asm volatile( "rsr.prid %0\n" diff --git a/components/freertos/include/freertos/portmacro.h b/components/freertos/include/freertos/portmacro.h index 00db60c913..e10c733d54 100644 --- a/components/freertos/include/freertos/portmacro.h +++ b/components/freertos/include/freertos/portmacro.h @@ -121,6 +121,7 @@ typedef unsigned portBASE_TYPE UBaseType_t; #include "portbenchmark.h" #include "sdkconfig.h" +#include "esp_attr.h" #define portFIRST_TASK_HOOK CONFIG_FREERTOS_BREAK_ON_SCHEDULER_START_JTAG