Hey all,
I'm having difficulty getting the OS aware plugin to work for me. I searched the forums before posting to see if there were any situations that were like mine, but did not see any that were identical.
I'm working on a Cortex-M0. I don't use an IDE -- I'm using JlinkGDBServer and gdb which connects to it (maybe this is my problem?). First I start gdbserver which looks fine to me so far:
Command line: -if JTAG -device Cortex-M0+ -speed 500 -rtos /Applications/SEGGER/JLink_V792d/GDBServer/RTOSPlugin_embOS.dylib
-----GDB Server start settings-----
GDBInit file:none
GDB Server Listening port: 2331
SWO raw output listening port: 2332
Terminal I/O port: 2333
Accept remote connection:yes
Generate logfile:off
Verify download: off
Init regs on start:off
Silent mode: off
Single run mode: off
Target connection timeout: 0 ms
------J-Link related settings------
J-Link Host interface: USB
J-Link script: none
J-Link settings file:none
------Target related settings------
Target device: Cortex-M0+
Target device parameters:none
Target interface:JTAG
Target interface speed:500kHz
Target endian: little
Connecting to J-Link...
J-Link is connected.
Firmware: J-Link V9 compiled May7 2021 16:26:12
Hardware: V9.30
S/N: 609301590
Feature(s): RDI, FlashBP, FlashDL, JFlash, GDB
Checking target voltage...
Target voltage: 1.80 V
Listening on TCP/IP port 2331
Connecting to target...
J-Link found 1 JTAG device, Total IRLen = 4
JTAG ID: 0x6BA00477 (Cortex-M0)
Halting core...
Connected to target
Waiting for GDB connection...
After I start gdb to connect to the server, gdbserver now logs this:
Connected to 127.0.0.1
GDB client (conn. 11) requested target.xml from GDB Server
Reading common registers: Read register 'r0' (4 bytes) from hardware: 0x66EFFFFF
Read register 'r1' (4 bytes) from hardware: 0x00000000
Read register 'r2' (4 bytes) from hardware: 0x90C40100
Read register 'r3' (4 bytes) from hardware: 0x00000000
Read register 'r4' (4 bytes) from hardware: 0x30CC0100
Read register 'r5' (4 bytes) from hardware: 0xCDCDCDCD
Read register 'r6' (4 bytes) from hardware: 0xCDCDCDCD
Read register 'r7' (4 bytes) from hardware: 0xCDCDCDCD
Read register 'r8' (4 bytes) from hardware: 0xCDCDCDCD
Read register 'r9' (4 bytes) from hardware: 0xCDCDCDCD
Read register 'r10' (4 bytes) from hardware: 0xCDCDCDCD
Read register 'r11' (4 bytes) from hardware: 0xCDCDCDCD
Read register 'r12' (4 bytes) from hardware: 0x18000000
Read register 'sp' (4 bytes) from hardware: 0x40630200
Read register 'lr' (4 bytes) from hardware: 0xF1840100
Read register 'pc' (4 bytes) from hardware: 0xC8710100
Read register 'xpsr' (4 bytes) from hardware: 0x00000061
Read 2 bytes @ address 0x00011C04 (Data = 0x4B02)
Read 4 bytes @ address 0x000171C8 (Data = 0x4B02B510)
Loading RTOS plugin: //Applications/SEGGER/JLink_V792d/GDBServer/RTOSPlugin_embOS.dylib...
RTOS plugin (API v1.0) loaded successfully
RTOS plugin: Loaded
Received symbol: OS_Global (0x0001C490)
Received symbol: OS_Switch (0x00011F82)
Received symbol: OS_Switch_End (0x00011F9A)
All mandatory symbols successfully loaded.
Downloading 4 bytes @ address 0x00569008
Reading common registers: Read register 'r0' (4 bytes) from hardware: 0x66EFFFFF
Read register 'r1' (4 bytes) from hardware: 0x00000000
Read register 'r2' (4 bytes) from hardware: 0x90C40100
Read register 'r3' (4 bytes) from hardware: 0x00000000
Read register 'r4' (4 bytes) from hardware: 0x30CC0100
Read register 'r5' (4 bytes) from hardware: 0xCDCDCDCD
Read register 'r6' (4 bytes) from hardware: 0xCDCDCDCD
Read register 'r7' (4 bytes) from hardware: 0xCDCDCDCD
Read register 'r8' (4 bytes) from hardware: 0xCDCDCDCD
Read register 'r9' (4 bytes) from hardware: 0xCDCDCDCD
Read register 'r10' (4 bytes) from hardware: 0xCDCDCDCD
Read register 'r11' (4 bytes) from hardware: 0xCDCDCDCD
Read register 'r12' (4 bytes) from hardware: 0x18000000
Read register 'sp' (4 bytes) from hardware: 0x40630200
Read register 'lr' (4 bytes) from hardware: 0xF1840100
Read register 'pc' (4 bytes) from hardware: 0xC8710100
Read register 'xpsr' (4 bytes) from hardware: 0x00000061
Read 4 bytes @ address 0x000171C8 (Data = 0x4B02B510)
This sounds great so far. It looks like the plugin loaded successfully. Now when I hit a breakpoint, things don't go as I had expected:
...Breakpoint reached @ address 0x00005598
ERROR: RTOS_UpdateThreads(): Failed to read task name. <------ERROR HERE
Reading common registers: Read register 'r0' (4 bytes) from hardware: 0x18F90100
Read register 'r1' (4 bytes) from hardware: 0xB413C3B2
Read register 'r2' (4 bytes) from hardware: 0x00000000
Read register 'r3' (4 bytes) from hardware: 0x5F040000
Read register 'r4' (4 bytes) from hardware: 0x88D70100
Read register 'r5' (4 bytes) from hardware: 0xFA04A51E
Read register 'r6' (4 bytes) from hardware: 0x34D80100
Read register 'r7' (4 bytes) from hardware: 0x18F90100
Read register 'r8' (4 bytes) from hardware: 0xCDCDCDCD
Read register 'r9' (4 bytes) from hardware: 0xCDCDCDCD
Read register 'r10' (4 bytes) from hardware: 0xCDCDCDCD
Read register 'r11' (4 bytes) from hardware: 0xCDCDCDCD
Read register 'r12' (4 bytes) from hardware: 0x05000000
Read register 'sp' (4 bytes) from hardware: 0xD8D60100
Read register 'lr' (4 bytes) from hardware: 0x65040000
Read register 'pc' (4 bytes) from hardware: 0x98550000
Read register 'xpsr' (4 bytes) from hardware: 0x00000061
Removing breakpoint @ address 0x00005598, Size = 2
Read 4 bytes @ address 0x00005598 (Data = 0xF7FB4628)
Reading 64 bytes @ address 0x0001D700
Read 4 bytes @ address 0x00000464 (Data = 0xB570BD80)
Read 4 bytes @ address 0x0001D6E8 (Data = 0x0001D788)
Read 4 bytes @ address 0x0001D6EC (Data = 0x0001D720)
I am able to see the call stack of the current thread when I type `backtrace`, but aside from that, I am unable to do much besides select various stack frames from the current stack and examine the values of things in scope. Commands like `info threads` do not work in gdb -- it simply shows the current thread and none of the others, however the gdbserver shows something interesting when I ask for a list of all threads:
Read 4 bytes @ address 0x00005598 (Data = 0xF7FB4628)
Read 4 bytes @ address 0x00000464 (Data = 0xB570BD80)
Read 4 bytes @ address 0x0001D6E8 (Data = 0x0001D788)
Read 4 bytes @ address 0x0001D6EC (Data = 0x0001D720)
Of the 4 addresses above, the first two are addresses of the most recent two functions called in the call stack. The second 2 address are memory addresses of data near the base of the current task (i.e. pCurrentTask within OS_Global). Can anyone please advise on if this is a plugin issue that I can troubleshoot? And if it's not, would someone with knowledge of embOS internals be willing to advise on which registers I can load in gdb to be able to switch to one of the other threads and examine their stack frames? I'd be happy with that too. I'll take whatever I can get. Please help!
Best,
Robert
I'm having difficulty getting the OS aware plugin to work for me. I searched the forums before posting to see if there were any situations that were like mine, but did not see any that were identical.
I'm working on a Cortex-M0. I don't use an IDE -- I'm using JlinkGDBServer and gdb which connects to it (maybe this is my problem?). First I start gdbserver which looks fine to me so far:
Command line: -if JTAG -device Cortex-M0+ -speed 500 -rtos /Applications/SEGGER/JLink_V792d/GDBServer/RTOSPlugin_embOS.dylib
-----GDB Server start settings-----
GDBInit file:none
GDB Server Listening port: 2331
SWO raw output listening port: 2332
Terminal I/O port: 2333
Accept remote connection:yes
Generate logfile:off
Verify download: off
Init regs on start:off
Silent mode: off
Single run mode: off
Target connection timeout: 0 ms
------J-Link related settings------
J-Link Host interface: USB
J-Link script: none
J-Link settings file:none
------Target related settings------
Target device: Cortex-M0+
Target device parameters:none
Target interface:JTAG
Target interface speed:500kHz
Target endian: little
Connecting to J-Link...
J-Link is connected.
Firmware: J-Link V9 compiled May7 2021 16:26:12
Hardware: V9.30
S/N: 609301590
Feature(s): RDI, FlashBP, FlashDL, JFlash, GDB
Checking target voltage...
Target voltage: 1.80 V
Listening on TCP/IP port 2331
Connecting to target...
J-Link found 1 JTAG device, Total IRLen = 4
JTAG ID: 0x6BA00477 (Cortex-M0)
Halting core...
Connected to target
Waiting for GDB connection...
After I start gdb to connect to the server, gdbserver now logs this:
Connected to 127.0.0.1
GDB client (conn. 11) requested target.xml from GDB Server
Reading common registers: Read register 'r0' (4 bytes) from hardware: 0x66EFFFFF
Read register 'r1' (4 bytes) from hardware: 0x00000000
Read register 'r2' (4 bytes) from hardware: 0x90C40100
Read register 'r3' (4 bytes) from hardware: 0x00000000
Read register 'r4' (4 bytes) from hardware: 0x30CC0100
Read register 'r5' (4 bytes) from hardware: 0xCDCDCDCD
Read register 'r6' (4 bytes) from hardware: 0xCDCDCDCD
Read register 'r7' (4 bytes) from hardware: 0xCDCDCDCD
Read register 'r8' (4 bytes) from hardware: 0xCDCDCDCD
Read register 'r9' (4 bytes) from hardware: 0xCDCDCDCD
Read register 'r10' (4 bytes) from hardware: 0xCDCDCDCD
Read register 'r11' (4 bytes) from hardware: 0xCDCDCDCD
Read register 'r12' (4 bytes) from hardware: 0x18000000
Read register 'sp' (4 bytes) from hardware: 0x40630200
Read register 'lr' (4 bytes) from hardware: 0xF1840100
Read register 'pc' (4 bytes) from hardware: 0xC8710100
Read register 'xpsr' (4 bytes) from hardware: 0x00000061
Read 2 bytes @ address 0x00011C04 (Data = 0x4B02)
Read 4 bytes @ address 0x000171C8 (Data = 0x4B02B510)
Loading RTOS plugin: //Applications/SEGGER/JLink_V792d/GDBServer/RTOSPlugin_embOS.dylib...
RTOS plugin (API v1.0) loaded successfully
RTOS plugin: Loaded
Received symbol: OS_Global (0x0001C490)
Received symbol: OS_Switch (0x00011F82)
Received symbol: OS_Switch_End (0x00011F9A)
All mandatory symbols successfully loaded.
Downloading 4 bytes @ address 0x00569008
Reading common registers: Read register 'r0' (4 bytes) from hardware: 0x66EFFFFF
Read register 'r1' (4 bytes) from hardware: 0x00000000
Read register 'r2' (4 bytes) from hardware: 0x90C40100
Read register 'r3' (4 bytes) from hardware: 0x00000000
Read register 'r4' (4 bytes) from hardware: 0x30CC0100
Read register 'r5' (4 bytes) from hardware: 0xCDCDCDCD
Read register 'r6' (4 bytes) from hardware: 0xCDCDCDCD
Read register 'r7' (4 bytes) from hardware: 0xCDCDCDCD
Read register 'r8' (4 bytes) from hardware: 0xCDCDCDCD
Read register 'r9' (4 bytes) from hardware: 0xCDCDCDCD
Read register 'r10' (4 bytes) from hardware: 0xCDCDCDCD
Read register 'r11' (4 bytes) from hardware: 0xCDCDCDCD
Read register 'r12' (4 bytes) from hardware: 0x18000000
Read register 'sp' (4 bytes) from hardware: 0x40630200
Read register 'lr' (4 bytes) from hardware: 0xF1840100
Read register 'pc' (4 bytes) from hardware: 0xC8710100
Read register 'xpsr' (4 bytes) from hardware: 0x00000061
Read 4 bytes @ address 0x000171C8 (Data = 0x4B02B510)
This sounds great so far. It looks like the plugin loaded successfully. Now when I hit a breakpoint, things don't go as I had expected:
...Breakpoint reached @ address 0x00005598
ERROR: RTOS_UpdateThreads(): Failed to read task name. <------ERROR HERE
Reading common registers: Read register 'r0' (4 bytes) from hardware: 0x18F90100
Read register 'r1' (4 bytes) from hardware: 0xB413C3B2
Read register 'r2' (4 bytes) from hardware: 0x00000000
Read register 'r3' (4 bytes) from hardware: 0x5F040000
Read register 'r4' (4 bytes) from hardware: 0x88D70100
Read register 'r5' (4 bytes) from hardware: 0xFA04A51E
Read register 'r6' (4 bytes) from hardware: 0x34D80100
Read register 'r7' (4 bytes) from hardware: 0x18F90100
Read register 'r8' (4 bytes) from hardware: 0xCDCDCDCD
Read register 'r9' (4 bytes) from hardware: 0xCDCDCDCD
Read register 'r10' (4 bytes) from hardware: 0xCDCDCDCD
Read register 'r11' (4 bytes) from hardware: 0xCDCDCDCD
Read register 'r12' (4 bytes) from hardware: 0x05000000
Read register 'sp' (4 bytes) from hardware: 0xD8D60100
Read register 'lr' (4 bytes) from hardware: 0x65040000
Read register 'pc' (4 bytes) from hardware: 0x98550000
Read register 'xpsr' (4 bytes) from hardware: 0x00000061
Removing breakpoint @ address 0x00005598, Size = 2
Read 4 bytes @ address 0x00005598 (Data = 0xF7FB4628)
Reading 64 bytes @ address 0x0001D700
Read 4 bytes @ address 0x00000464 (Data = 0xB570BD80)
Read 4 bytes @ address 0x0001D6E8 (Data = 0x0001D788)
Read 4 bytes @ address 0x0001D6EC (Data = 0x0001D720)
I am able to see the call stack of the current thread when I type `backtrace`, but aside from that, I am unable to do much besides select various stack frames from the current stack and examine the values of things in scope. Commands like `info threads` do not work in gdb -- it simply shows the current thread and none of the others, however the gdbserver shows something interesting when I ask for a list of all threads:
Read 4 bytes @ address 0x00005598 (Data = 0xF7FB4628)
Read 4 bytes @ address 0x00000464 (Data = 0xB570BD80)
Read 4 bytes @ address 0x0001D6E8 (Data = 0x0001D788)
Read 4 bytes @ address 0x0001D6EC (Data = 0x0001D720)
Of the 4 addresses above, the first two are addresses of the most recent two functions called in the call stack. The second 2 address are memory addresses of data near the base of the current task (i.e. pCurrentTask within OS_Global). Can anyone please advise on if this is a plugin issue that I can troubleshoot? And if it's not, would someone with knowledge of embOS internals be willing to advise on which registers I can load in gdb to be able to switch to one of the other threads and examine their stack frames? I'd be happy with that too. I'll take whatever I can get. Please help!
Best,
Robert
The post was edited 1 time, last by rhbogart ().