Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use thread aware debugging with STM32H743ZI #45778

Closed
bdesterBE opened this issue May 18, 2022 · 4 comments · Fixed by #45824
Closed

Unable to use thread aware debugging with STM32H743ZI #45778

bdesterBE opened this issue May 18, 2022 · 4 comments · Fixed by #45824
Assignees
Labels
area: West West utility bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug

Comments

@bdesterBE
Copy link

bdesterBE commented May 18, 2022

Describe the bug
When attempting to use the CONFIG_DEBUG_THREAD_INFO configuration option for thread aware debugging with the STM32H743ZI develpment board, after running west debug an output containing 'cant read "_TARGETNAME": no such variable', followed by "You can't do that when you target is `exec'" is received.

If the configuration option is not added to the project's prj.conf file, I am able to use west debug without issue.

I have attempted to add $_TARGETNAME configure -rtos Zephyr to zephyr/boards/arm/nucleo_h743zi/support/openocd.cfg per #37205, to no avail.

To Reproduce
The behavior can be seen on the blinky example.
Steps to reproduce the behavior:

  1. add CONFIG_DEBUG_THREAD_INFO to zephyr/samples/basic/blinky/prj.conf
  2. west build -p -b nucleo_h743zi zephyr/samples/basic/blinky
  3. west debug

Expected behavior
The ability to run openocd debugging with thread awareness using west debug on the STM32H743ZI development board.

Impact
Currently have no other way of debugging with thread awareness in our system, making it difficult to see which thread could be causing various issue including watchdog timer triggers.

Logs and console output
Screenshot from 2022-04-28 15-57-55

Environment (please complete the following information):

  • OS: Ubuntu 20.04
  • Zephyr SDK 13.
  • Commit SHA: 140837c
  • Latest version: v3.0.0-rc1

EDIT (@erwango):
Fixed the Kconfig option name

@bdesterBE bdesterBE added the bug The issue is a bug, or the PR is fixing a bug label May 18, 2022
@erwango erwango added the priority: low Low impact/importance bug label May 19, 2022
@erwango
Copy link
Member

erwango commented May 19, 2022

Correct flag name is CONFIG_DEBUG_THREAD_INFO

@erwango erwango self-assigned this May 19, 2022
@erwango erwango added the platform: STM32 ST Micro STM32 label May 19, 2022
@erwango
Copy link
Member

erwango commented May 19, 2022

Ok, here is the problem:

#37516 implemented integrated west runner support for openocd thread info configuration. For that it relied on the command $_TARGETNAME configure -rtos Zephyr which unfortunately is not generic enough to work with all openocd targets.
For instance, on stm32h743, it should use $_CHIPNAME.cpu0 configure -rtos Zephyr, which is getting the whole feature to work as expected.

We miss a way to overload this default generic command, either fully, either only overwriting the target handle (_TARGETNAME replaced by _CHIPNAME.cpu0). Note that this i required for all STM32H7 target, but likely other targets subject to multicore (for instance lpc4370 > $_CHIPNAME.m4 ).

@erwango erwango added area: West West utility and removed platform: STM32 ST Micro STM32 labels May 19, 2022
@erwango
Copy link
Member

erwango commented May 19, 2022

Proposal to fix this is to add an openocd runner arg which would overwrite the default openocd script target handle _TARGETNAME. For instance:
board_runner_args(openocd --target-script-handle "_CHIPNAME.cpu0")

@mbolivar-nordic Would it be fine with you ?

@mbolivar-nordic
Copy link
Contributor

@mbolivar-nordic Would it be fine with you ?

Yes

erwango added a commit to erwango/zephyr that referenced this issue May 20, 2022
Openocd scripts for STM32H7 SoCs use _CHIPNAME.cpu{0|1} as
target handle.
Specify this thanks to new openocd runner option '-target-handle'.

This is required to allow thread awareness debugging on these targets.

Fixes zephyrproject-rtos#45778

Signed-off-by: Erwan Gouriou <[email protected]>
mbolivar-nordic pushed a commit that referenced this issue May 24, 2022
Openocd scripts for STM32H7 SoCs use _CHIPNAME.cpu{0|1} as
target handle.
Specify this thanks to new openocd runner option '-target-handle'.

This is required to allow thread awareness debugging on these targets.

Fixes #45778

Signed-off-by: Erwan Gouriou <[email protected]>
laxiLang pushed a commit to laxiLang/zephyr that referenced this issue May 30, 2022
Openocd scripts for STM32H7 SoCs use _CHIPNAME.cpu{0|1} as
target handle.
Specify this thanks to new openocd runner option '-target-handle'.

This is required to allow thread awareness debugging on these targets.

Fixes zephyrproject-rtos#45778

Signed-off-by: Erwan Gouriou <[email protected]>
hakanjansson added a commit to hakanjansson/zephyr that referenced this issue Oct 29, 2024
Openocd target cyw20829 does not define _TARGETNAME which is used by
default by the openocd west runner when using CONFIG_DEBUG_THREAD_INFO.

This is similar to the issue previously addressed for STM32H7:

Link: zephyrproject-rtos#45778

Signed-off-by: Hakan Jansson <[email protected]>
nashif pushed a commit that referenced this issue Nov 16, 2024
Openocd target cyw20829 does not define _TARGETNAME which is used by
default by the openocd west runner when using CONFIG_DEBUG_THREAD_INFO.

This is similar to the issue previously addressed for STM32H7:

Link: #45778

Signed-off-by: Hakan Jansson <[email protected]>
coreboot-bot pushed a commit to coreboot/zephyr-cros that referenced this issue Nov 19, 2024
Openocd target cyw20829 does not define _TARGETNAME which is used by
default by the openocd west runner when using CONFIG_DEBUG_THREAD_INFO.

This is similar to the issue previously addressed for STM32H7:

(cherry picked from commit 8e4dc4e)

Original-Link: zephyrproject-rtos/zephyr#45778
Original-Signed-off-by: Hakan Jansson <[email protected]>
GitOrigin-RevId: 8e4dc4e
Cr-Build-Id: 8730937883239782945
Cr-Build-Url: https://cr-buildbucket.appspot.com/build/8730937883239782945
Copybot-Job-Name: zephyr-main-copybot-downstream
Change-Id: I6ac4c48d9ce139387e9b1039f59dbc3db4077f54
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/6028802
Tested-by: ChromeOS Prod (Robot) <[email protected]>
Commit-Queue: Tristan Honscheid <[email protected]>
Reviewed-by: Tristan Honscheid <[email protected]>
Tested-by: Tristan Honscheid <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: West West utility bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants