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
boards/nrf52: add openocd as programmer option #9407
Conversation
Thanks! Used this PR as reference for my SMT32F103 configuration with a J-Link. |
|
It is something I am interested in, merging a But I think this should come after the
Allow flashing a binary with openocd is one of the task of the OTA issue that I have in my backlog. I think it could then be done using a PREFLASH dependency. |
@PeterKietzmann, your error is weird: 'invalid subcommand "write_image erase /xyz/RIOT/examples/default/bin/nrf52840dk/default.elf 0"' |
14eb2d3
to
88b7c1f
Compare
@PeterKietzmann, with the latest version of this branch I have the following output on a 'fresh'
|
I might take a look soon. I believe we should make openocd the default flashing tool whenever possible. |
@PeterKietzmann, can you try to change |
@aabadie yes this works. I tend to say that the majority works on the release so we better not change this yet? |
I tend agree but I find this problem annoying. I hope openocd will release a new version soon. Another possibility is to use |
9f81489
to
2a153c8
Compare
@PeterKietzmann, there are differences between the nrf52.cfg config file in 0.10 and my recent master version. I added the missing commands. It still works on my setup. Can you try again with 0.10 ? |
|
I removed the problematic line, can you try again @PeterKietzmann ? |
|
||
$_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE -work-area-backup 0 | ||
|
||
flash bank $_CHIPNAME.flash nrf5 0x00000000 0 1 1 $_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.
Just "nrf5" without a number?
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.
Yes it's like this on my openocd version. Let's try with an explicit target name, I just pushed this change and it still works for me.
|
|
@PeterKietzmann, I removed the 2 problematic lines and tested locally with openocd 0.10 and openocd master. It works for both. Can you test again ? |
@aabadie sorry but now I get the initial error again :
|
Looks like the nrf52 flash driver was not in 0.10 release yet but it was added later. This may be the source of the problem. |
6003b9f
to
a7b0a4c
Compare
I changed this PR back to its original state and added a comment in the Makefile about the need of a dev version of openocd. |
Just retested this PR on nrf52dk, works like a charm with both JLink and OpenOCD (flash, debug, etc). I don't have Thingy52 and Ruuvitag for testing. |
A colleague of mine has a Thingy:52 at home. He will lend it me tomorrow for testing. |
@aabadie: I confirm that you addressed my remarks. So feel free to squash |
174b19f
to
31c7262
Compare
Done
Maybe you could also give a try to #10793 ? |
My colleague lost his Thingy:52. I hope that it will turn up soon. Sorry for the delay :-( |
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.
I found one wording issue in the documentation, so inline comments.
I'm extremely sorry. My colleague searched everywhere and the board just did not turn up. I think it is unlikely that if the OpenOCD config works for three of the nRF52 based boards that it will not work for the remaining two. Having also in mind that the jlink programmer remains the default option, merging this would not break any existing and working setup, even if there is an issue with the remaining two. From my point of view: @aabadie should address the minor wording issue in the comment (please squash directly) and this could be merged. @PeterKietzmann what do you think? |
@maribu, thanks for having a second look. I'm realizing that something went wrong with my last forced push. The common documentation addition went out with the related commits. It is highly possible that I messed up with the git history when working from my other computer... I'll rework again this PR. |
7fe80c3
to
7682946
Compare
OK, got my hand on an nrf52dk and it works there. So only the RuuviTag and the Thingy:52 are left untested. @haukepetersen: Could you test it for them? |
I have a ruuvitag I can test. |
The results with/without openocd as programmer:
|
Just did try to test this PR with the
|
One more finding: when using
|
@aabadie: I think the way to move this PR forward is to just test if the board in question is a RuuviTag or a Thingy:52 and then just fail. This way the openocd config can still be placed in a central place to avoid code duplication. As |
For the moment openocd doesn't work when softdevice blob module is loaded
Add common flashing notes + move the doc in a separate doc.txt file
7682946
to
a2cfa52
Compare
@maribu, ruuvitag and thingy52 cannot be used with openocd now. I also added a note to the common documentation about that. |
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.
I confirm that flashing the RuuviTag or the Thingy:52 is now prevented by the build system. So ACK. Lets wait for Murdock and then (hopefully) merge
Contribution description
This PR adds support for openocd as a programmer for nrf52 based board. These boards can be flashed using jlink adapter and openocd (>= 0.10.0) provides everything for this.
Unfortunately, it won't work if the application uses the softdevice blob because the build system doesn't provide a self contained binary in this case. Because of this limitation the jlink programmer is kept as the default one.
If an application requires softdevice and openocd is used then an error message is displayed. A better approach would be to merge the softdevice hex with the compiled binary before flashing it to the board. Maybe using the preflash target or by adding a new post-build target would make this possible ? Makefile experts' opinion is welcome.
Issues/PRs references
None
Testing
acd52832
(@PeterKietzmann)nrf52dk
(@maribu)nrf52480-dk
(@maribu)nrf52840-mdk
(@aabadie)ruuvitag
&thingy52
disabled, no testing requiredUpdate: Added testing state
Update: Added results for RuuviTag
Update: RuuviTag and Thingy:52, so no testing required