boards/nRF52xx: correctly set JLINK_DEVICE #20599
Merged
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.