Hi,
I have purchased a STM32WBA52CG nucelo board and noticed OpenOCD does not yet has support for these newer chips STM released in the last months (they released several new series).
I stumbled across a fork of OpenOCD created by STM: https://github.com/STMicroelectronics/OpenOCD
They have added support for the STM32WBA family to that fork's flash driver along with some other of the new chips (but unfortunately no target config file yet).
So I have two questions:
- What is the status of that fork? Was there any discussion between STM32 and the OpenOCD project in that regard? With OpenOCD being GPL-2 licenced I would assume it is no problem to just cherry picks the relevant commits from that fork back to main OpenOCD?
- I am struggling with creating a working target config file for the STM32WBA chip. The support was added to the STM32L4x flash driver (which already supports several STM32 families). Is it enough to copy the existing STM32l4x target config and updating the JTAG and SWD values with the correct ones from the STM32WBA reference manual?
Best regards
Jan Henke
You probably need to ask STM that question?
What's wrong with the target script that's in the mainline OpenOCD?
Last edit: Tommy Murphy 2023-05-31
The current script does not work, for starters the STM32WBA has different JTAG/SWD IDs. But also the chip architecture is different. STM32WBx is a dual core chip with one M4 and one M+, the new STM32WBA is a single core M33 chip. So there is definitely some difference that needs to be accounted for.
Have you tried adding the relevant STM32WBA ID(s) to the
stm32wbx.cfgscript?(I presume that the 'x' in the name is a placeholder so that script should - eventually, if not right now - also support STM32WBA?).
The
stm32wbx.cfgscript only defines a single Cortex-M target.Last edit: Tommy Murphy 2023-05-31
I will push a gerrit change in a few minutes with the needed cfg file
please test using this patch
https://review.openocd.org/c/openocd/+/7694
Thank you for your work, unfortunately it runs into an error:
Using this config file:
Changing the ap-num in the cfg file manually to 0 yields another error:
I see that you are using "interface/stlink.cfg"
we recommend using "interface/stlink-dap.cfg" to work with cortex-M33 on Access Port != 0
I did not know that, switching to dap interface got more output, but still an error:
Sorry my bad, I still had the cfg file edited, with ap_num 1 we get further, still not entirely happy:
To verbalize the last post: With the change I was able to flash my MCU, but I cannot attach a debugger. Can you look into why the debugging does not work?
You should post (attach) a verbose OpenOCD log for the failed attempt to debug to assist with investigation. Use
openocd -d3 ...to get the verbose log.Attached is the debug log. Thank you for looking into it.
Thanks - these seem to be the key errors in the verbose log file:
So it would make sense to drill into these in more detail first.
Last edit: Tommy Murphy 2023-06-08
Hi,
were you able to make some progress on this issue?
Best regards,
Jan Henke
Would it be possible to get the changes merged? Being able to upload is better then nothing, even if debugging is still broken.
OpenOCD is open-source so anybody is free to submit changes for consideration and inclusion. Including any changes in the STM fork - or any other fork. Of course, it would be nice if STM would do this themselves (and maybe they do from time to time?) but it's open to anybody else, in particular stakeholders in the STM mods, to do this unilaterally. Why not contact STM ask them if/when they might upstream the changes in their fork?
Edit: I just noticed this:
And I see that you did contact them here but got no response so far:
Last edit: Tommy Murphy 2023-07-23
I already did contact them (https://github.com/STMicroelectronics/OpenOCD/issues/20), but there is zero activity from STM to this issue.
I am also referring to an open change set here: https://review.openocd.org/c/openocd/+/7694
I tested it and it allows flashing the device. Attaching a debugger unfortunately does not work (see debug logs above). Therefore I was hoping the patch's original author could look into why debugging does not work. But alas since there is no activity at all, I would prefer to add at least the flashing ability.
Maybe if you post review feedback on that change set it might help?
As far as I can see nobody has reviewed it so that may be one reason why it's lying dormant.
I am simply not familiar enough with the codebase to give a meaningful review. So far I have been a user only.
Tarek wrote 2 moths ago:
But I see in all logs:
Open On-Chip Debugger 0.12.0
instead of
Open On-Chip Debugger 0.12.0+dev-00xxx-gd3949b4af339
Jan,
testing a patched config file with an unpatched release OpenOCD binary has no value for us
and the reported error likely originates here.
Please recompile OpenOCD from source
git fetch https://review.openocd.org/openocd refs/changes/94/7694/2 && git checkout FETCH_HEAD
and retry.
Hi,
I am using Gentoo, so everything is compiled from source. I have added the patch from https://review.openocd.org/c/openocd/+/7694 to my user patches and reemerged (recompiled) the package. So the changes are included, even if the version does not change it.
For the sake of the argument I recompiled from Git master + the patch from https://review.openocd.org/c/openocd/+/7694.
Attached you find the debug log with the same problem
There seems to be a mismatch in OTP bank address.
Could you try comment out OTP definition in tcl/target/stm32wbax.cfg
# flash bank $_CHIPNAME.otp stm32l4x 0x1fff7000 0 0 0 $_TARGETNAMEIt should allow gdb attach.
Thanks, that worked indeed. Is that line necessary for anything?
It would be great to get this patch into the next release, as it seems to be working with that line commented out.