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
openocd: Can't flash on various STM32 boards #50590
Comments
Guilty commit in openocd: zephyrproject-rtos/openocd@98d9f11 Reverting this commit fixes the issue. |
I can reproduce this on the |
Thanks, I've updated the list. |
Tried a couple boards, can reproduce on |
Thanks for the tests. |
I will look into reverting zephyrproject-rtos/openocd@98d9f11 in the upcoming Zephyr SDK 0.15.1, unless a proper fix comes before that. |
About the workaround: does it really work if you press reset for you? For me it only works by retrying. That is: plug - reset - wests flash <- does not work. |
Yes. If I hold down reset, run west flash, then release reset after openocd is running, it works. |
I confirm this works on |
Ok that works. But also re-running west flash a second time right? (may be worth noting it in the workarounds) |
You're right! And that might be the easiest one in most cases. Updating the description. |
The main problem is wrong OpenOCD configuration used in Zephyr. Why programming fails at the first try after power-up only? There is another serious problem in commands Zephyr sends to OpenOCD. |
Thanks @tom-van for these insights. We'll try to fix configurations accordingly. |
Here is the status on the tests/searches I've made so far.
First insights:
Drawback: |
Adding the following in the
That works, but I'm a bit reluctant to add this blindly on all STM32 based boards. |
Current status: Assuming openocd is correct and that the commit that reveals the issue should be kept, fixing the issue globally (fix flash and debug on all impacted boards) requires a fix (likely in
I'm not clear on how a clean solution should look like (could be in For now: @stephanosio Are you ok with this approach ? |
Sure, as long as the Zephyr-side configurations are going to be fixed. I will revert zephyrproject-rtos/openocd@98d9f11 in the Zephyr SDK 0.15.1-rc2 (I already tagged rc1 today). |
This reverts commit 98d9f11 because it causes flashing issues with some Zephyr targets (notably, STM32 family devices). The patch in itself does not seem to be doing anything wrong in particular; but, it uncovers various problems with the Zephyr-side OpenOCD configurations -- mainly, not resetting the target device on debugger connect, which may lead to connection failures because Zephyr puts the target CPU to sleep while idling and the CPU cannot respond to the debugger's request in this state. For more details, refer to the GitHub issue zephyrproject-rtos/zephyr#50590. Revert this commit once the Zephyr-side OpenOCD configurations are fixed. Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
Here is a test build with zephyrproject-rtos/openocd@98d9f11 reverted: @erwango can you confirm if this fixes the issue? |
@stephanosio I confirm this works on the boards mentioned earlier in this issues and some more. I also confirm no regression on the boards that were not hit by this bug (tested >10 boards from various STM32 series) With one exception: Note that this exception reinforce my belief in the fact that reverting the commit for DV3.2 is safer as the impacts of openocd changes are hard to know for sure. |
This reverts commit 98d9f11 because it causes flashing issues with some Zephyr targets (notably, STM32 family devices). The patch in itself does not seem to be doing anything wrong in particular; but, it uncovers various problems with the Zephyr-side OpenOCD configurations -- mainly, not resetting the target device on debugger connect, which may lead to connection failures because Zephyr puts the target CPU to sleep while idling and the CPU cannot respond to the debugger's request in this state. For more details, refer to the GitHub issue zephyrproject-rtos/zephyr#50590. Revert this commit once the Zephyr-side OpenOCD configurations are fixed. Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
With latest version of openocd delivered in Zephyr SDK 0.15.0, a new configuration is required to flash and debug this board: "reset_config connect_assert_srst" allows to flash the board The new "init" function allows to run debug. Fixes zephyrproject-rtos#50590 for this specific board Note that other boards might be also impacted by this new version of openocd but a revert of zephyrproject-rtos/openocd@98d9f11 allows to get back to the previous status. A new Zephyr SDK release (V0.15.1) will be available with a revert of this commit. Unfortunately this has no impact on nucleo_f103rb. Hence this change. Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
I learned from your conversation that you prefer to run OpenOCD without After the deep analyse of the way how debug is used in zephyr I proposed 4 new OpenOCD changes to harden the robustness of Although it's not necessary with new changes I also revived the request to revert the problematic commit - just to be safe from other regressions. Reverting it in your project makes good sense to me. I would appreciate if you test the new changes and give comments to the OpenOCD gerrit. Thanks |
@tom-van Thanks for your time on this issue
In general we're quite open to changes and personally I don't have strong preference, but there are 2 points going against this change today:
Sounds safe indeed.
Thanks for this feedback.
Will do for sure. |
With latest version of openocd delivered in Zephyr SDK 0.15.0, a new configuration is required to flash and debug this board: "reset_config connect_assert_srst" allows to flash the board The new "init" function allows to run debug. Fixes #50590 for this specific board Note that other boards might be also impacted by this new version of openocd but a revert of zephyrproject-rtos/openocd@98d9f11 allows to get back to the previous status. A new Zephyr SDK release (V0.15.1) will be available with a revert of this commit. Unfortunately this has no impact on nucleo_f103rb. Hence this change. Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
I'm reopening this issue, as we're not done with it. |
This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time. |
This should be now fixed with the latest SDK. |
This reverts commit 98d9f11 because it causes flashing issues with some Zephyr targets (notably, STM32 family devices). The patch in itself does not seem to be doing anything wrong in particular; but, it uncovers various problems with the Zephyr-side OpenOCD configurations -- mainly, not resetting the target device on debugger connect, which may lead to connection failures because Zephyr puts the target CPU to sleep while idling and the CPU cannot respond to the debugger's request in this state. For more details, refer to the GitHub issue zephyrproject-rtos/zephyr#50590. Revert this commit once the Zephyr-side OpenOCD configurations are fixed. Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
This reverts commit 98d9f11 because it causes flashing issues with some Zephyr targets (notably, STM32 family devices). The patch in itself does not seem to be doing anything wrong in particular; but, it uncovers various problems with the Zephyr-side OpenOCD configurations -- mainly, not resetting the target device on debugger connect, which may lead to connection failures because Zephyr puts the target CPU to sleep while idling and the CPU cannot respond to the debugger's request in this state. For more details, refer to the GitHub issue zephyrproject-rtos/zephyr#50590. Revert this commit once the Zephyr-side OpenOCD configurations are fixed. Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
Describe the bug
Since SDK0.15.0, a flashing issue using openocd appears in specific conditions on various STM32 boards.
Impacted boards identified so far (likely more to come):
Note: Potentially applies to non STM32 boards, due to the nature of the issue.
Issues could be seen when trying to flash just after the board is plugged-in.
Following flashing attempts work seamlessly (reason it was not seen on test bench)
Workarounds
Several workarounds are possible:
To Reproduce
Steps to reproduce the behavior:
Build and try to flash any of these boards using Zephyr SDK 0.15.0
Expected behavior
Flashing using openocd works seamlessly, every time.
Impact
Annoyance, widely spread. Could disturb new users.
Environment (please complete the following information):
Additional context
The text was updated successfully, but these errors were encountered: