-
Notifications
You must be signed in to change notification settings - Fork 2.1k
boards/nucleo-f767zi: add correct flash bank openocd config #13179
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some typos and questions.
I won't be able to test before next week.
boards/common/stm32/dist/stm32f7.cfg
Outdated
@@ -1,3 +1,6 @@ | |||
source [find target/stm32f7x.cfg] | |||
|
|||
flash bank $_FLASHNAME.noprobe stm32f2x 0x08000000 0 0 0 $_TARGETNAME |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why stm32f2x
? Shouldn't it be stm32f7x
instead ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be honest I just used the same config that was in the openocd file, but replacing the address. I'll take a close look at all the parameters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, had a look stm32f7
doesn't have a specific flash driver they use stm32f2x
, see files in https://github.com/ntfreak/openocd/tree/master/src/flash/nor and have a look at
You have acces to my CI machine, you can test there, the board is connected. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, well documented and works: I tested on nucleo-f767zi and nucleo-f746zg. On master, flashing tests/riotboot fails on nucleo-f767zi but it works with this PR. This PR has no negative impact on other F7 boards.
Unfortunately, I found some typos and some reworking to improve the inline comments. You can squash all changes.
Allow specifying index of `flash bank` to read configuration from in cases where the configuration provided in openocd is incorrect. This is the case for the majority of stm32 boards where it relies on `flash probe` to get the correct value.
openocd configuration file for `stm32f7` relies on probing to find out FLASH_ADDR. On nucleo-f767zi board probing (`flash probe 0`) fails when `srst` is asserted, but `srst` needs to be asserted to be able to flash the `BOARD` when sleeping or after a hardfault. To circumvent this in boards/common/stm32/dist/stm32f7.cfg we define a new flash bank with the appropriate fash start address and specify that this is the flash bank to be used as default configuration instead of the default by setting FLASH_BANK=4
aa86295
to
1dec5ba
Compare
@aabadie all green! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No more typo and was already tested with success.
ACK and go!
Backport provided in #13219 |
According to gdb this leads to: Overlapping regions in memory map, which results in it being ignored and me not being able to set breakpoints. gdb tells openocd to set soft break points, if it does not know about the memory map, which do not work (in flash regions?). older versions of openocd (current ubuntu) ignore if gdb tells them to set soft breakpoints and decide on their own depending o the address. |
please have a look at what this PR does
this all is done to somehow push an Address from the board information to openocd.sh. I think it would have been easier if you just provide the address in Makefile.import, and modified openocd.sh to use such a address if it exists (may also be possible that such a mechanism allready exists) see the attached tt-patch.txt btw the line:
tells openocd to use auto configuration for the flash http://www.openocd.org/doc/html/Flash-Commands.html#index-stm32f2x |
Contribution description
This pr fixes flashing bin files on
nucleo-f767zi
, this issue is not present on allnucleo-f7*
boards.Flashing bin files on
nucleo-f767zi
fails for two reasons:Playing around with
openocd.sh
I have found thatflash probe 0
fails on thisBOARD
whensrst
isasserted
, but ifsrst
isdeasserted
probing fails anyway if the device ishardfaulted
or insleep mode
.I couldn't find the reason why probing fails in this case, but to keep asserting
srst
I added the correctFLASH_ADDR
in ourstm32f7.cfg
file and addedFLASH_BANK
to allow specifying whichflash bank
to use as configuration input and not use the one intarget/stm32f7x.cfg
Testing procedure
make -C tests/riotboot/ BOARD=nucleo-f767zi flash