Hello,
I'm developing a RTOS plugin for gdb server. Our os is based on FreeRTOS.
I'm working with
SEGGER J-Link GDB Server V6.34c Command Line Version
JLinkARM.dll V6.34c (DLL compiled Aug 23 2018 10:59:29)
During a debugging I found strange things.
Loading RTOS plugin: /opt/SEGGER/JLink_V634c/GDBServer/RTOSPlugin_yOS_Debug.so...
RTOS_GetVersion
RTOS plugin (API v1.0) loaded successfully
RTOS_Init(0x0x64fb60, 0x0e0000ff)
RTOS plugin initialized successfully.
RTOS_GetSymbols
Received symbol: pxCurrentTCB (0x1FFF0548)
Received symbol: pxReadyTasksLists (0x1FFF054C)
Received symbol: xDelayedTaskList1 (0x1FFF0678)
Received symbol: xDelayedTaskList2 (0x1FFF068C)
Received symbol: pxDelayedTaskList (0x1FFF06DC)
Received symbol: pxOverflowDelayedTaskList (0x1FFF06E0)
Received symbol: xPendingReadyList (0x1FFF06A0)
Received symbol: xTasksWaitingTermination (0x1FFF06B4)
Received symbol: xSuspendedTaskList (0x1FFF06C8)
Received symbol: uxCurrentNumberOfTasks (0x1FFF0544)
Received symbol: uxTopUsedPriority (0x00000000)
Received symbol: uxTopReadyPriority (0x1FFF06EC)
Received symbol: vPortEnableVFP (0x000066C4)
Received symbol: FreeRTOSDebugConfig (0x00000000)
All mandatory symbols successfully loaded.
....
Downloading 8 bytes @ address 0x0001D580 - Verified OK
Downloading 1512 bytes @ address 0x0001D588 - Verified OK
RTOS_SetThreadReg(0x7f4712bf6e53, 15, 0x00000000)
Compare method "Programmed sectors, fastest method" is not supported for this device.
......
Starting target CPU...
...Breakpoint reached @ address 0x00000B0C
RTOS_UpdateThreads
ERROR: Could not read FreeRTOS thread count from target @ 0x1fff0544(err = 0x1fff0500).
RTOS_GetNumThreads() = 0
Reading all registers
Here is a list of questions:
1. Why does gdbserver call RTOS_SetThreadReg with threadID = 0 in the middle of flashing?
2. Why does gdbserver call RTOS_SetThreadReg before RTOS_ThreadUpdate call?
3. Why does gdbserver return a positive error code for the following call?
err = _pAPI->pfReadU32(addr, &thread_count);
if (err != 0) {
_pAPI->pfErrorOutf(
"Could not read FreeRTOS thread count from target @ 0x%08x"
"(err = 0x%08x).\n", addr, err);
return err;
}
According to the doc int TARGET_ReadU32(U32 Addr, U32* pData);
Return value
= 0 Reading memory Ok.
< 0 Reading memory failed.
here is a report from gdbserver
ERROR: Could not read FreeRTOS thread count from target @ 0x1fff0544(err = 0x1fff0500).
I'm developing a RTOS plugin for gdb server. Our os is based on FreeRTOS.
I'm working with
SEGGER J-Link GDB Server V6.34c Command Line Version
JLinkARM.dll V6.34c (DLL compiled Aug 23 2018 10:59:29)
During a debugging I found strange things.
Loading RTOS plugin: /opt/SEGGER/JLink_V634c/GDBServer/RTOSPlugin_yOS_Debug.so...
RTOS_GetVersion
RTOS plugin (API v1.0) loaded successfully
RTOS_Init(0x0x64fb60, 0x0e0000ff)
RTOS plugin initialized successfully.
RTOS_GetSymbols
Received symbol: pxCurrentTCB (0x1FFF0548)
Received symbol: pxReadyTasksLists (0x1FFF054C)
Received symbol: xDelayedTaskList1 (0x1FFF0678)
Received symbol: xDelayedTaskList2 (0x1FFF068C)
Received symbol: pxDelayedTaskList (0x1FFF06DC)
Received symbol: pxOverflowDelayedTaskList (0x1FFF06E0)
Received symbol: xPendingReadyList (0x1FFF06A0)
Received symbol: xTasksWaitingTermination (0x1FFF06B4)
Received symbol: xSuspendedTaskList (0x1FFF06C8)
Received symbol: uxCurrentNumberOfTasks (0x1FFF0544)
Received symbol: uxTopUsedPriority (0x00000000)
Received symbol: uxTopReadyPriority (0x1FFF06EC)
Received symbol: vPortEnableVFP (0x000066C4)
Received symbol: FreeRTOSDebugConfig (0x00000000)
All mandatory symbols successfully loaded.
....
Downloading 8 bytes @ address 0x0001D580 - Verified OK
Downloading 1512 bytes @ address 0x0001D588 - Verified OK
RTOS_SetThreadReg(0x7f4712bf6e53, 15, 0x00000000)
Compare method "Programmed sectors, fastest method" is not supported for this device.
......
Starting target CPU...
...Breakpoint reached @ address 0x00000B0C
RTOS_UpdateThreads
ERROR: Could not read FreeRTOS thread count from target @ 0x1fff0544(err = 0x1fff0500).
RTOS_GetNumThreads() = 0
Reading all registers
Here is a list of questions:
1. Why does gdbserver call RTOS_SetThreadReg with threadID = 0 in the middle of flashing?
2. Why does gdbserver call RTOS_SetThreadReg before RTOS_ThreadUpdate call?
3. Why does gdbserver return a positive error code for the following call?
err = _pAPI->pfReadU32(addr, &thread_count);
if (err != 0) {
_pAPI->pfErrorOutf(
"Could not read FreeRTOS thread count from target @ 0x%08x"
"(err = 0x%08x).\n", addr, err);
return err;
}
According to the doc int TARGET_ReadU32(U32 Addr, U32* pData);
Return value
= 0 Reading memory Ok.
< 0 Reading memory failed.
here is a report from gdbserver
ERROR: Could not read FreeRTOS thread count from target @ 0x1fff0544(err = 0x1fff0500).