From 1078275aa15c01ba69d8c3a99b647fc348a3c87f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= Date: Sun, 28 Mar 2021 13:25:26 +0200 Subject: [PATCH 1/2] add symbols needed by OpenOCD this is a backport of https://github.com/FreeRTOS/FreeRTOS-Kernel/pull/188 which is part of FreeRTOS V10.4.2 --- .../Middlewares/Third_Party/FreeRTOS/Source/tasks.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/source/Middlewares/Third_Party/FreeRTOS/Source/tasks.c b/source/Middlewares/Third_Party/FreeRTOS/Source/tasks.c index f93fca03..6d2484b1 100644 --- a/source/Middlewares/Third_Party/FreeRTOS/Source/tasks.c +++ b/source/Middlewares/Third_Party/FreeRTOS/Source/tasks.c @@ -378,6 +378,13 @@ PRIVILEGED_DATA static UBaseType_t uxTaskNumber = ( UBaseType_t ) 0U; PRIVILEGED_DATA static volatile TickType_t xNextTaskUnblockTime = ( TickType_t ) 0U; /* Initialised to portMAX_DELAY before the scheduler starts. */ PRIVILEGED_DATA static TaskHandle_t xIdleTaskHandle = NULL; /*< Holds the handle of the idle task. The idle task is created automatically when the scheduler is started. */ +/* Improve support for OpenOCD. The kernel tracks Ready tasks via priority lists. + * For tracking the state of remote threads, OpenOCD uses uxTopUsedPriority + * to determine the number of priority lists to read back from the remote target. */ +const volatile UBaseType_t uxTopUsedPriority = configMAX_PRIORITIES - 1U; + + + /* Context switches are held pending while the scheduler is suspended. Also, interrupts must not manipulate the xStateListItem of a TCB, or any of the lists the xStateListItem can be referenced from, if the scheduler is suspended. @@ -2093,6 +2100,10 @@ BaseType_t xReturn; /* Prevent compiler warnings if INCLUDE_xTaskGetIdleTaskHandle is set to 0, meaning xIdleTaskHandle is not used anywhere else. */ ( void ) xIdleTaskHandle; + + /* OpenOCD makes use of uxTopUsedPriority for thread debugging. Prevent uxTopUsedPriority + * from getting optimized out as it is no longer used by the kernel. */ + ( void ) uxTopUsedPriority; } /*-----------------------------------------------------------*/ From 45d278050741db0201d6537ac04059981fc18bb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= Date: Sun, 28 Mar 2021 13:26:48 +0200 Subject: [PATCH 2/2] Always generate debug symbols The debug symbols are only part of the generated ELF files, they are stripped from the .bin and .hex files. So there should be no disadvantage of always generating it. Before: 52456 Pinecil_EN.bin 81700 Pinecil_EN.elf 140759 Pinecil_EN.elf.map 147554 Pinecil_EN.hex After: 52456 Pinecil_EN.bin 650556 Pinecil_EN.elf 191974 Pinecil_EN.elf.map 147554 Pinecil_EN.hex --- source/Makefile | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/source/Makefile b/source/Makefile index fa144361..f32adf35 100644 --- a/source/Makefile +++ b/source/Makefile @@ -132,12 +132,9 @@ OPTIM=-Os -flto -finline-small-functions -findirect-inlining -fdiagnostics-color # global defines --------------------------------------------------------------- GLOBAL_DEFINES += $(DEV_GLOBAL_DEFS) -D USE_RTOS_SYSTICK -D MODEL_$(model) -D VECT_TAB_OFFSET=$(bootldr_size)U -# Without debug code -DEBUG= +DEBUG=-g3 ifdef swd_enable GLOBAL_DEFINES += -DSWD_ENABLE - # Enable debug code generation - DEBUG=-g endif