Skip to content

Commit

Permalink
rtos/FreeRTOS: fix unknown symbol read errors on amazon smp version
Browse files Browse the repository at this point in the history
  • Loading branch information
erhankur committed Jul 9, 2024
1 parent d29d0d7 commit 35ddcf9
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/rtos/FreeRTOS.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ enum freertos_symbol_values {
FREERTOS_VAL_UX_TASK_NUMBER = 13,
FREERTOS_VAL_ESP_OPENOCD_PARAMS = 14,
FREERTOS_VAL_PX_CURRENT_TCBs = 15,
FREERTOS_VAL_PORT_X_SCHEDULER_RUNNING = 16,
};

struct symbols {
Expand All @@ -325,11 +326,12 @@ static const struct symbols freertos_symbol_list[] = {
{ "xSuspendedTaskList", true }, /* Only if INCLUDE_vTaskSuspend */
{ "uxCurrentNumberOfTasks", false },
{ "uxTopUsedPriority", true }, /* Unavailable since v7.5.3 */
{ "xSchedulerRunning", false },
{ "xSchedulerRunning", true },
{ "port_interruptNesting", true },
{ "uxTaskNumber", false },
{ "FreeRTOS_openocd_params", true }, /* Only if ESP_PLATFORM defined */
{ "pxCurrentTCBs", true }, /* Available since ESP-IDF v5.0 */
{ "port_xSchedulerRunning", true },
{ NULL, false }
};

Expand Down Expand Up @@ -1040,16 +1042,18 @@ static int freertos_update_threads(struct rtos *rtos)

/* read scheduler running */
uint32_t scheduler_running;
retval = target_read_u32(rtos->target,
rtos->symbols[FREERTOS_VAL_X_SCHEDULER_RUNNING].address,
&scheduler_running);
symbol_address_t scheduler_running_sym_address = rtos->symbols[FREERTOS_VAL_X_SCHEDULER_RUNNING].address;
if (!scheduler_running_sym_address)
scheduler_running_sym_address = rtos->symbols[FREERTOS_VAL_PORT_X_SCHEDULER_RUNNING].address;

retval = target_read_u32(rtos->target, scheduler_running_sym_address, &scheduler_running);
if (retval != ERROR_OK) {
LOG_ERROR("Error reading FreeRTOS scheduler state");
LOG_TARGET_ERROR(target, "Error reading FreeRTOS scheduler state");
return retval;
}
LOG_DEBUG("FreeRTOS: Read xSchedulerRunning at 0x%" PRIx64 ", value 0x%" PRIx32,
rtos->symbols[FREERTOS_VAL_X_SCHEDULER_RUNNING].address,
scheduler_running);
LOG_TARGET_DEBUG(target, "FreeRTOS: Read xSchedulerRunning at 0x%" PRIx64 ", value 0x%" PRIx32,
scheduler_running_sym_address,
scheduler_running);

if ((thread_list_size == 0) || (rtos->current_thread == 0) || !scheduler_running) {
/* Either : No RTOS threads - there is always at least the current execution though
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CONFIG_FREERTOS_SMP=y
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CONFIG_FREERTOS_SMP=y
CONFIG_FREERTOS_UNICORE=y
17 changes: 17 additions & 0 deletions testing/esp/test_threads.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,20 @@ class DebuggerThreadsTestsSingle(DebuggerGenericTestAppTestsSingle, DebuggerThre
"""
# no special tests for single core mode yet
pass

@idf_ver_min('5.3')
@skip_for_chip(['esp342p4'])
class DebuggerThreadsTestsAmazonFreeRTOSDual(DebuggerGenericTestAppTestsDual, DebuggerThreadsTestsImpl):

def __init__(self, methodName='runTest'):
super(DebuggerGenericTestAppTestsDual, self).__init__(methodName)
self.test_app_cfg.bin_dir = os.path.join('output', 'default_amazon_freertos')
self.test_app_cfg.build_dir = os.path.join('builds', 'default_amazon_freertos')

@idf_ver_min('5.3')
class DebuggerThreadsTestsAmazonFreeRTOSSingle(DebuggerGenericTestAppTestsSingle, DebuggerThreadsTestsImpl):

def __init__(self, methodName='runTest'):
super(DebuggerGenericTestAppTestsSingle, self).__init__(methodName)
self.test_app_cfg.bin_dir = os.path.join('output', 'single_amazon_freertos')
self.test_app_cfg.build_dir = os.path.join('builds', 'single_amazon_freertos')

0 comments on commit 35ddcf9

Please sign in to comment.