From faa219acdb1858f0150d312d6072b5deaaa40312 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Wed, 16 Oct 2019 14:23:05 +0200 Subject: [PATCH] freertos: fix defining uxTopUsedPriority for esp32s2beta --- components/esp32/Kconfig | 1 + components/esp32s2beta/Kconfig | 1 + components/freertos/CMakeLists.txt | 4 +++- components/freertos/FreeRTOS-openocd.c | 2 +- components/freertos/Kconfig | 5 +++++ components/freertos/component.mk | 5 ++++- 6 files changed, 15 insertions(+), 3 deletions(-) diff --git a/components/esp32/Kconfig b/components/esp32/Kconfig index 47975e197..e9b11c994 100644 --- a/components/esp32/Kconfig +++ b/components/esp32/Kconfig @@ -381,6 +381,7 @@ menu "ESP32-specific" config ESP32_DEBUG_OCDAWARE bool "Make exception and panic handlers JTAG/OCD aware" default y + select FREERTOS_DEBUG_OCDAWARE help The FreeRTOS panic and unhandled exception handers can detect a JTAG OCD debugger and instead of panicking, have the debugger stop on the offending instruction. diff --git a/components/esp32s2beta/Kconfig b/components/esp32s2beta/Kconfig index 351617840..089f3c54b 100644 --- a/components/esp32s2beta/Kconfig +++ b/components/esp32s2beta/Kconfig @@ -346,6 +346,7 @@ menu "ESP32S2-specific" config ESP32S2_DEBUG_OCDAWARE bool "Make exception and panic handlers JTAG/OCD aware" default y + select FREERTOS_DEBUG_OCDAWARE help The FreeRTOS panic and unhandled exception handers can detect a JTAG OCD debugger and instead of panicking, have the debugger stop on the offending instruction. diff --git a/components/freertos/CMakeLists.txt b/components/freertos/CMakeLists.txt index 9826fd8c9..185ee5a59 100644 --- a/components/freertos/CMakeLists.txt +++ b/components/freertos/CMakeLists.txt @@ -31,7 +31,9 @@ idf_component_register(SRCS "${srcs}" REQUIRES app_trace PRIV_REQUIRES soc) -target_link_libraries(${COMPONENT_LIB} INTERFACE "-Wl,--undefined=uxTopUsedPriority") +if(CONFIG_FREERTOS_DEBUG_OCDAWARE) + target_link_libraries(${COMPONENT_LIB} INTERFACE "-Wl,--undefined=uxTopUsedPriority") +endif() set_source_files_properties( tasks.c diff --git a/components/freertos/FreeRTOS-openocd.c b/components/freertos/FreeRTOS-openocd.c index 2367d8273..a769b60b2 100644 --- a/components/freertos/FreeRTOS-openocd.c +++ b/components/freertos/FreeRTOS-openocd.c @@ -19,6 +19,6 @@ #define USED #endif -#ifdef CONFIG_ESP32_DEBUG_OCDAWARE +#ifdef CONFIG_FREERTOS_DEBUG_OCDAWARE const int USED DRAM_ATTR uxTopUsedPriority = configMAX_PRIORITIES - 1; #endif diff --git a/components/freertos/Kconfig b/components/freertos/Kconfig index a6665118b..198722331 100644 --- a/components/freertos/Kconfig +++ b/components/freertos/Kconfig @@ -435,4 +435,9 @@ menu "FreeRTOS" would be checked to be in compliance with Vanilla FreeRTOS. e.g Calling port*_CRITICAL from ISR context would cause assert failure + config FREERTOS_DEBUG_OCDAWARE + bool + help + Hidden option, gets selected by CONFIG_ESPxx_DEBUG_OCDAWARE + endmenu diff --git a/components/freertos/component.mk b/components/freertos/component.mk index fb972fb38..7969cc6c6 100644 --- a/components/freertos/component.mk +++ b/components/freertos/component.mk @@ -2,7 +2,10 @@ # Component Makefile # -COMPONENT_ADD_LDFLAGS += -Wl,--undefined=uxTopUsedPriority +ifdef CONFIG_FREERTOS_DEBUG_OCDAWARE + COMPONENT_ADD_LDFLAGS += -Wl,--undefined=uxTopUsedPriority +endif + COMPONENT_ADD_INCLUDEDIRS := include COMPONENT_PRIV_INCLUDEDIRS := include/freertos .