From 42c946a53a02fe40887010a0c00bbea9dd016357 Mon Sep 17 00:00:00 2001 From: David Chalco Date: Tue, 29 Sep 2020 17:24:54 -0700 Subject: [PATCH] re-introduce uxTopUsedPriority. Prevent removal by optimization --- tasks.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tasks.c b/tasks.c index 038a2b4cc..3e410ed6c 100644 --- a/tasks.c +++ b/tasks.c @@ -378,6 +378,7 @@ PRIVILEGED_DATA static volatile BaseType_t xNumOfOverflows = ( BaseType_t ) 0; 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. */ +const 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 @@ -2093,6 +2094,10 @@ void vTaskStartScheduler( void ) /* 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; } /*-----------------------------------------------------------*/