zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.52k stars 6.45k forks source link

nucleo-f756zg: rtos aware debugging not working #37175

Closed maksimdrachov closed 3 years ago

maksimdrachov commented 3 years ago

Describe the bug

In this video (50:30) it is shown how to debug a reel-board using gdb.

To Reproduce The following commands are issued:

cd zephyr/samples/philosophers
west build -b nucleo_f756zg
west build --target guiconfig (set OPENOCD support)
west debug
(gdb) c

Output looks fine output_normal

If I interrupt, it looks like this, seemingly no threads detected by gdb? my_threads_output

Expected behavior However I'm expecting something like this (as shown in the video) video_threads_output

I've checked my Konfig, but the problem remains. kernel_config_1

Impact I can't really start developing with Zephyr.

Environment (please complete the following information):

erwango commented 3 years ago

@maksimdrachov Thread awareness support was only merge relatively recently in openocd (http://openocd.zylin.com/#/c/4988/). Can you check you're using a version that embed this patch ?

maksimdrachov commented 3 years ago

Hmm you're right

Upgraded openocd to the latest commit: openocd-vers

I've removed the previous install to make sure there was no chance of the older version being used. Used the following commands:

brew uninstall openocd
brew install openocd --HEAD

Serial output seems to be working as expected: serial

However the same issue remains: gdb-info-threads

Any other suggestions? Should I take this to openocd? Are there any tools you could recommend that work with STM32 and Zephyr?

erwango commented 3 years ago

@maksimdrachov Ok, thanks for having had a try. I'll have a check on my side as well. As an alternative, you should be able to use pyocd. Also, you could use Segger, but please note that it currently dos not work for some targets, so I'd not advise it right now.

erwango commented 3 years ago

@maksimdrachov One additional piece of info: In the video you mention, pycocd is the debugger in use.

For openocd, one additional config can be required (to be added in /support/openocd.cfg)

# Enable Zephyr thread awareness.
$_TARGETNAME configure -rtos Zephyr

But I've not been able to test yet.

maksimdrachov commented 3 years ago

Ok, I'll try to test 👍

maksimdrachov commented 3 years ago

It works! Big thanks!

The proposed (working) solution can be seen in the screenshot below: solution

erwango commented 3 years ago

ok, great. We need need to set this by default. I'll raise an issue for that.

erwango commented 3 years ago

@maksimdrachov I'm closing current issue. Don't hesitate to reopen if required