-
Notifications
You must be signed in to change notification settings - Fork 2.1k
boards/common: Make Adafruit nRF52 Bootloader shared #21281
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.
Thanks, nice idea!
I changed the Also it is possible to drop the SoftDevice if you can't stand the idea of having a piece of closed source software in your Flash :) Request for Comments: Should the board-dependant |
I think this is ready for testing and reviewing now :)
|
42143eb
to
452930d
Compare
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.
Also it is possible to drop the SoftDevice if you can't stand the idea of having a piece of closed source software in your Flash :)
Great, thanks for addressing this and making it configurable! I'm not fully decided on what the default should be though. Is it more friendly to leave the softdevice present and allow for the boards to be reused for other projects, or to not ship proprietary blobs (which are not used anyway though)? I guess both are fine with me.
Request for Comments: Should the board-dependant
Makefile.include
files still define the SoftDevice version, even if they use the standard?
If there is a standard as in something that is documented in the bootloader sources as such, I'd be fine to make it the default and not define it. If not, and if it rather depends on the board, I'd propose not having a default at all and erroring out if no SD version is defined by the board.
Technically, we aren't shipping the blob, we're just not touching it.
I thought about it yesterday on my way home and even though Adafruit does not specifically set the SoftDevice version, I think they are rather fixed for a certain board. It is unlikely that there will be an update for the |
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 for restructuring the documentation, reads good now!
afea23e
to
4e8df40
Compare
I took the liberty to squash everything together since the last review only addressed some details in the documentation. Other than that IMO this is ready to be merged :) |
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.
Successfully tested to work both with and without UF2_SOFTDEVICE=DROP
on all three supported boards. Thanks for doing this!
Oh, I actually just (by chance) found the following issue: When flashing a new application with the new default (expecting the SoftDevice) to a board that has previously been flashed with RIOT, it will seem to the user as if the flashing process failed as the old application is still present and started (instead of the SoftDevice). This is pretty bad user experience, I'd say. Not sure how to prevent this... Maybe checking I can also try to look into it one of these days if you don't want to invest more time here. |
We should try to improve the user experience for existing RIOT users first.
With that it's pretty easy to check if the This is a script that ChatGPT suggested, it obviously has to be adapted still but it's a starting point. #!/bin/bash
# Find device with UF2 bootloader
MOUNTPOINT=$(uf2conv.py --list | awk '{print $1}')
# Check if a device was found
if [ -z "$MOUNTPOINT" ]; then
echo "No UF2 device found!"
exit 1
fi
# Read file and check for "SoftDevice: not found"
if grep -q "SoftDevice: not found" "$MOUNTPOINT/INFO_UF2.txt"; then
echo "SoftDevice not found!"
exit 2
else
echo "SoftDevice detected!"
fi |
Sounds reasonable to me.
I'd probably try to call the script instead of python in I've been trying to get the re-installation of the Adafruit Bootloader somehow integrated into our build system as a pkg in |
Just for reference, here is the current WIP state: https://github.com/mguetschow/RIOT/tree/adafruit-bootloader-pkg |
For the time being, I just added an error message. Personally I'd prefer not to put the re-install of the Adafruit Bootloader into this PR as well, as it already has become quite extensive. In the fixups, you can find a possible solution that involes a bash script that checks the |
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 a nit, I really like this solution. Thanks!
Tested locally and confirmed to work, feel free to squash directly :)
@mguetschow Let me know when I should squash this. |
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.
Please squash :)
10fcbe9
to
ebcb656
Compare
Thank you for working with me on this rather extensive PR :) |
Contribution description
Currently the flash related Makefiles and the documentation about the flash process are in the documentation for the Feather nRF52840 and Feather nRF52840 Sense board.
With upcoming boards that utilize the same Adafruit nRF52840 Bootloader, like the Seeedstudio Xiao nRF52840 ( #20980 ) and Xiao nRF52840 Sense, it makes sense to put the makefiles and documentation into the
boards/common
folder.Furthermore I used the opportunity to move the
doc.txt
files to Markdown format.This can also be a good starting point to address #21205 and implement a flag to conditionally keep or discard SoftDevice.
Testing procedure
Make sure that the flashing of the
feather-nrf52840
andfeather-nrf52840-sense
still works as it should with your favorite application, for exampleBOARD=feather-nrf52840 make -C examples/basic/hello-world flash term
Alternatively if you don't have a feather at hand or don't want to harm any birds to obtain one, you can use an nRF52840dk and flash the Adafruit Bootloader. The board is called
pca10056
in the Adafruit Bootloader (https://github.com/adafruit/Adafruit_nRF52_Bootloader/). You can program the nRF52840DK as if it was a Feather or Feather Sense.It is important to check that the offset is correctly set in the
uf2conv
command (0x26000 for the nRF52840DK). You can also check if theUF2_SOFTDEV=DROP
option works to override the Soft Device (then the offset should be 0x1000).Also resetting to the Bootloader should still work when
make flash
bootloader
command in the shellThe first command is scrambled due to a known bug in
stdio_cdc_acm
.Check that the documentation looks good.
Issues/PRs references
Has influence on #20980.
Can be a starting point forCloses #21205.Applies the Markdown format to
doc.txt
as discussed in #21220.