-
Notifications
You must be signed in to change notification settings - Fork 2k
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/nRF52xx: correctly set JLINK_DEVICE #20599
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.
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.
30cc117
to
3a76d18
Compare
3a76d18
to
6f0e81f
Compare
Thank you all for helping on this one. The fix is really elegant :) |
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.