boards/nRF52xx: correctly set JLINK_DEVICE#20599
Merged
maribu merged 1 commit intoRIOT-OS:masterfrom Apr 22, 2024
Merged
Conversation
mguetschow
reviewed
Apr 19, 2024
Contributor
mguetschow
left a comment
There was a problem hiding this comment.
Thanks a lot for spotting and fixing this!
I've tested it successfully with a nrf52840dk and had a look at the changeset, but haven't double-checked the list of nrf52-based boards with jlink debugger.
Therefore just a soft-ACK from my side.
benpicco
reviewed
Apr 19, 2024
30cc117 to
3a76d18
Compare
aabadie
reviewed
Apr 21, 2024
3a76d18 to
6f0e81f
Compare
benpicco
approved these changes
Apr 22, 2024
Contributor
Author
|
Thank you all for helping on this one. The fix is really elegant :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contribution description
Since a version update of JLinkExe about four years ago, it performs a check of the Flash memory range, which depends on the JLINK_DEVICE selected. Currently, the JLINK_DEVICE variable is set in the boards/common/nrf52/Makefile.include file, which sets it to "NRF52". This seems to default to the nRF52832 chip, which is incorrect for all boards not using this chip.
The issue is described in #14576 and it seems to trigger (mostly? only?) when flashing images that are close to the maximum flash size of the nRF52832 or when specifying explicit memory addresses. Therefore the bug has been mostly unnoticed in normal operation and is triggered when trying to flash a bootloader to the nRF52840 chip.
This PR removes the JLINK_DEVICE variable from the common Makefile.include, because the boards including this file have various Nordic nRF52 processors. The declaration of the JLINK_DEVICE variable is therefore moved to the various Makefile.include files of the relevant targets which actually use the JLink programmer (or do not have a built in programmer in which case RIOT assumes a JLink will be used).
Testing procedure
Run the following command with an arbitrary nRF52 development board connected and observe the console output:
You should be able to see the right processor being selected for the BOARD specified in the command. The relevant line is 'Device "NRF52832_XXAA" selected.'
You can skip the programming process when JLinkExe asks you to unsecure the device (we don't actually want to program incorrect code into the microcontroller 👀 )
Repeat for the following targets:
Issues/PRs references
This PR fixes #14576.