From b30ff28034ff7cc0ba22c04206aef04a5923f327 Mon Sep 17 00:00:00 2001 From: Marius Vikhammer Date: Thu, 27 Jan 2022 20:18:39 +0800 Subject: [PATCH] freertos: always inline xPortSetInterruptMaskFromISR and vPortClearInterruptMaskFromISR These were called from IRAM context where the caller expect them to be inlined and accessible when cache is disabled. This was not the case when compiled with -O0. Closes https://github.com/espressif/esp-idf/issues/8301 --- components/freertos/port/xtensa/include/freertos/portmacro.h | 2 +- tools/unit-test-app/configs/no_optimization_c3 | 3 +++ tools/unit-test-app/configs/no_optimization_esp32 | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 tools/unit-test-app/configs/no_optimization_c3 create mode 100644 tools/unit-test-app/configs/no_optimization_esp32 diff --git a/components/freertos/port/xtensa/include/freertos/portmacro.h b/components/freertos/port/xtensa/include/freertos/portmacro.h index 222a5ae80106..19473a721e6a 100644 --- a/components/freertos/port/xtensa/include/freertos/portmacro.h +++ b/components/freertos/port/xtensa/include/freertos/portmacro.h @@ -105,7 +105,7 @@ typedef unsigned portBASE_TYPE UBaseType_t; // Cleaner solution allows nested interrupts disabling and restoring via local registers or stack. // They can be called from interrupts too. // WARNING: Only applies to current CPU. See notes above. -static inline unsigned portENTER_CRITICAL_NESTED(void) { +static inline unsigned __attribute__((always_inline)) portENTER_CRITICAL_NESTED(void) { unsigned state = XTOS_SET_INTLEVEL(XCHAL_EXCM_LEVEL); portbenchmarkINTERRUPT_DISABLE(); return state; diff --git a/tools/unit-test-app/configs/no_optimization_c3 b/tools/unit-test-app/configs/no_optimization_c3 new file mode 100644 index 000000000000..00719f871238 --- /dev/null +++ b/tools/unit-test-app/configs/no_optimization_c3 @@ -0,0 +1,3 @@ +CONFIG_IDF_TARGET="esp32c3" +TEST_COMPONENTS=esp_ipc spi_flash +CONFIG_COMPILER_OPTIMIZATION_NONE=y diff --git a/tools/unit-test-app/configs/no_optimization_esp32 b/tools/unit-test-app/configs/no_optimization_esp32 new file mode 100644 index 000000000000..64114b12156b --- /dev/null +++ b/tools/unit-test-app/configs/no_optimization_esp32 @@ -0,0 +1,3 @@ +CONFIG_IDF_TARGET="esp32" +TEST_COMPONENTS=esp_ipc spi_flash +CONFIG_COMPILER_OPTIMIZATION_NONE=y