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

Not able to flash stm32h735g_disco - TARGET: stm32h7x.cpu0 - Not halted #50306

Closed
maxstreitberger opened this issue Sep 16, 2022 · 3 comments · Fixed by #50860
Closed

Not able to flash stm32h735g_disco - TARGET: stm32h7x.cpu0 - Not halted #50306

maxstreitberger opened this issue Sep 16, 2022 · 3 comments · Fixed by #50860
Assignees
Labels
bug The issue is a bug, or the PR is fixing a bug platform: STM32 ST Micro STM32 priority: low Low impact/importance bug

Comments

@maxstreitberger
Copy link

When using the new Zephyr-SDK-0.15.0, I cannot flash the stm32h735g_disco board.

If I build the zephyr/samples/hello_world project for the stm32h735g_disco and try to flash it, I receive this error:

-- west flash: rebuilding
ninja: no work to do.
-- west flash: using runner openocd
-- runners.openocd: Flashing file: /home/max/Desktop/zephyrproject/build/zephyr/zephyr.hex
Open On-Chip Debugger 0.11.0+dev-00724-g42b6471c1 (2022-08-17-18:23)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
none separate

Info : clock speed 1800 kHz
Info : STLINK V3J9M3 (API v3) VID:PID 0483:374E
Info : Target voltage: 3.300602
Error: BUG: can't assert SRST
Info : [stm32h7x.cpu0] Cortex-M7 r1p2 processor detected
Info : [stm32h7x.cpu0] target has 8 breakpoints, 4 watchpoints
Error: read_memory: read at 0x5c001004 with width=32 and count=1 failed
Error executing event examine-end on target stm32h7x.cpu0:
/home/max/zephyr-sdk-0.15.0/sysroots/x86_64-pokysdk-linux/usr/share/openocd/scripts/target/stm32h7x.cfg:236: Error: read_memory: failed to read memory
in procedure 'stm32h7x_dbgmcu_mmw' called at file "/home/max/zephyr-sdk-0.15.0/sysroots/x86_64-pokysdk-linux/usr/share/openocd/scripts/target/stm32h7x.cfg", line 169
in procedure 'stm32h7x_mmw' called at file "/home/max/zephyr-sdk-0.15.0/sysroots/x86_64-pokysdk-linux/usr/share/openocd/scripts/target/stm32h7x.cfg", line 259
in procedure 'stm32h7x_mrw' called at file "/home/max/zephyr-sdk-0.15.0/sysroots/x86_64-pokysdk-linux/usr/share/openocd/scripts/target/stm32h7x.cfg", line 241
at file "/home/max/zephyr-sdk-0.15.0/sysroots/x86_64-pokysdk-linux/usr/share/openocd/scripts/target/stm32h7x.cfg", line 236
Info : starting gdb server for stm32h7x.cpu0 on 3333
Info : Listening on port 3333 for gdb connections
    TargetName         Type       Endian TapName            State       
--  ------------------ ---------- ------ ------------------ ------------
 0* stm32h7x.cpu0      hla_target little stm32h7x.cpu       reset

Error: read_memory: read at 0x5c001004 with width=32 and count=1 failed
Error executing event examine-end on target stm32h7x.cpu0:
/home/max/zephyr-sdk-0.15.0/sysroots/x86_64-pokysdk-linux/usr/share/openocd/scripts/target/stm32h7x.cfg:236: Error: read_memory: failed to read memory
in procedure 'ocd_process_reset' 
in procedure 'ocd_process_reset_inner' called at file "embedded:startup.tcl", line 876
in procedure 'stm32h7x_dbgmcu_mmw' called at file "/home/max/zephyr-sdk-0.15.0/sysroots/x86_64-pokysdk-linux/usr/share/openocd/scripts/target/stm32h7x.cfg", line 169
in procedure 'stm32h7x_mmw' called at file "/home/max/zephyr-sdk-0.15.0/sysroots/x86_64-pokysdk-linux/usr/share/openocd/scripts/target/stm32h7x.cfg", line 259
in procedure 'stm32h7x_mrw' called at file "/home/max/zephyr-sdk-0.15.0/sysroots/x86_64-pokysdk-linux/usr/share/openocd/scripts/target/stm32h7x.cfg", line 241
at file "/home/max/zephyr-sdk-0.15.0/sysroots/x86_64-pokysdk-linux/usr/share/openocd/scripts/target/stm32h7x.cfg", line 236
Error: timed out while waiting for target halted
TARGET: stm32h7x.cpu0 - Not halted
FATAL ERROR: command exited with status 1: /home/max/zephyr-sdk-0.15.0/sysroots/x86_64-pokysdk-linux/usr/bin/openocd -s /home/max/Desktop/zephyrproject/zephyr/boards/arm/stm32h735g_disco/support -s /home/max/zephyr-sdk-0.15.0/sysroots/x86_64-pokysdk-linux/usr/share/openocd/scripts -f /home/max/Desktop/zephyrproject/zephyr/boards/arm/stm32h735g_disco/support/openocd.cfg '-c init' '-c targets' -c 'reset halt' -c 'flash write_image erase /home/max/Desktop/zephyrproject/build/zephyr/zephyr.hex' -c 'reset halt' -c 'verify_image /home/max/Desktop/zephyrproject/build/zephyr/zephyr.hex' -c 'reset run' -c shutdown

I compared the target file stm32h7x.cfg found in ~/zephyr-sdk/sysroots/x86_64-pokysdk-linux/usr/share/openocd/scripts/target/ from the Zephyr-SDK-0.14.2 with the file from the Zephyr-SDK-0.15.0 and saw some changes, which I then reverted one by one until I noticed that the change in line 145 broke the flashing process. After changing the line back to reset_config srst_only srst_nogate, I could flash the stm32h735g_disco board again.

I have also noticed that after applying the change to the stm32h7x.cfg file, I have to flash the nucleo_f429zi board twice before the flash command succeeds. Afterwards, I can flash it as usual until I flash the stm32h735g_disco again.

For clarification:

Flash order Success?
stm32h735g_disco ✔️
nucleo_f429zi
nucleo_f429zi ✔️
nucleo_f429zi ✔️
stm32h735g_disco ✔️
nucleo_f429zi
nucleo_f429zi ✔️

This problem only occurred after the switch to the new Zephyr-SDK version. In the previous 0.14.2 version, everything worked fine, and I can use the stm32h735g_disco without any issues on macOS, where I do not use the SDK.

To Reproduce
Steps to reproduce the behavior:

  1. west build -b stm32h735g_disco -s zephyr/samples/hello_world/ -p always
  2. west flash

Impact
annoyance

Environment (please complete the following information):

  • OS: Linux
  • main branch
  • Zephyr SDK 0.15.0
@maxstreitberger maxstreitberger added the bug The issue is a bug, or the PR is fixing a bug label Sep 16, 2022
@erwango erwango added the platform: STM32 ST Micro STM32 label Sep 19, 2022
@erwango erwango self-assigned this Sep 19, 2022
@erwango erwango added priority: medium Medium impact/importance bug priority: low Low impact/importance bug and removed priority: medium Medium impact/importance bug labels Sep 20, 2022
@erwango
Copy link
Member

erwango commented Sep 20, 2022

I've contacted STM32 openocd maintainer for this specific issue.

Meanwhile, if this is blocking, I suggest to use stm32cubeprogrammer runner. Reducing criticality to low since there is an alternate solution.

@erwango
Copy link
Member

erwango commented Sep 23, 2022

@maxstreitberger I suspect an openocd configuration issue.
Would you mind trying to replicate the configuration provided for nucleo_h743zi.

Regarding nuclo_f429zi, I'll open a dedicated ticket, as I've found the root cause, and I'm not sure it applies to H7

erwango added a commit to erwango/zephyr that referenced this issue Sep 30, 2022
Openocd configuration for this board was broken. Fix it.
Tested on both SDK 0.15.0 and SDK 0.15.1-RC1.
Debug is also functional

Fixes zephyrproject-rtos#50306

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
@erwango
Copy link
Member

erwango commented Sep 30, 2022

@maxstreitberger Can you try: #50860 ?

mmahadevan108 pushed a commit that referenced this issue Sep 30, 2022
Openocd configuration for this board was broken. Fix it.
Tested on both SDK 0.15.0 and SDK 0.15.1-RC1.
Debug is also functional

Fixes #50306

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug, or the PR is fixing a bug platform: STM32 ST Micro STM32 priority: low Low impact/importance bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants