-
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
nrf52: Add riotboot support #11126
nrf52: Add riotboot support #11126
Conversation
#9095 would automate some of the testing. |
Nice one! However, it might be better to split b15625a in another PR, so we can show how easy is to add riotboot to a new board using the corexm.ld script 😄 |
Nice :) I think we could also go for I will check this. |
@kYc0o So 1 PR refactoring to the common |
Yep! Basically just the commit I pointed out in another PR. Thanks @bergzand ! |
If we handle |
It should also either add some information about the hack for flashing with Or if we can get this one in #11112 I can update |
I could use a bit more context here. Is this still in scope of this PR or is this a note for your follow up PR? |
Sorry, I meant that in the following files there are infos about the fact that currently doing Line 31 in 87d0757
RIOT/makefiles/boot/riotboot.mk Line 114 in 87d0757
And they do not mention A fix for this is to either update the mentions to also say "it is also a hack for jlink" or rush to have FLASHFILE used in Jlink. I can do the PR for this one and see. |
I created the |
The riotboot feature is not compatible with the nordic_softdevice_ble package at the moment
a937ca5
to
005710e
Compare
Rebased |
I will re-test this :) |
Thanks! |
JLink.sh only relies on For flashing with an offset, I am using I can put a hack to also take |
With this patch, jlink.sh correctly gets the address for the diff --git a/makefiles/boot/riotboot.mk b/makefiles/boot/riotboot.mk
index 0abe2c1d7..2f7c7e1fc 100644
--- a/makefiles/boot/riotboot.mk
+++ b/makefiles/boot/riotboot.mk
@@ -128,6 +128,7 @@ riotboot/flash-extended-slot0: $(RIOTBOOT_EXTENDED_BIN) $(FLASHDEPS)
# Flashing rule for slot 0
riotboot/flash-slot0: export IMAGE_OFFSET=$(SLOT0_OFFSET)
+riotboot/flash-slot0: export FLASH_ADDR:=$(shell echo $$(($${FLASH_ADDR:-0}+$(SLOT0_OFFSET))))
# Flashing rule for edbg to flash only slot 0
riotboot/flash-slot0: HEXFILE=$(SLOT0_RIOT_BIN)
# openocd
@@ -138,6 +139,7 @@ riotboot/flash-slot0: $(SLOT0_RIOT_BIN) $(FLASHDEPS)
# Flashing rule for slot 1
riotboot/flash-slot1: export IMAGE_OFFSET=$(SLOT1_OFFSET)
+riotboot/flash-slot1: export FLASH_ADDR:=$(shell echo $$(($${FLASH_ADDR:-0}+$(SLOT1_OFFSET))))
# Flashing rule for edbg to flash only slot 1
riotboot/flash-slot1: HEXFILE=$(SLOT1_RIOT_BIN)
# openocd The commands I ran:
|
When flashing I get this error:
But flash does not exit with an error. I already noticed this but should prepare a pull request for it: If I flash using PROGRAMMER=openocd it correctly updates the slots. |
Ah, that explains. I've only tested this with |
There were a couple of things going on here. #11200 implements handling of IMAGE_OFFSET in jlink. #11201 implements correct calculation (in hex) of the slot 1 image offset. They're somewhat interrelated but suggest merging #11200 first, and only testing slot 0. #11201 is needed for slot 1 to work correctly, so testing of slot 1 can be done there. |
The updated procedure from #11126 (comment) works when #11200 is applied alone. I will finish the review over there. |
I rebased on master now that #11200 is merged and ran the tests from #11126 (comment) which work with both |
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.
Reviewed and tested with the different riotboot/flash-
targets with both jlink
and openocd
.
You can merge when CI gives the greenlight.
Awesome, thanks for the effort you guys put into this @danpetry @cladmi! |
Np! Bluetooth OTA upgrade here we come :) |
Hey guys, does the cc2538dk have riotboot support. When i try to compile i receive this error, "/bin/sh: 1: Illegal number: 0xfffffffffffff800 |
Hi @brent7984 no the cc2538 is not supported yet by riotboot. |
Hi there, I am interested in a port, could you please point me towards what needs to be done for a port. I really want to attempt this.. |
@cladmi are you still able to flash the second slot with Jlink? I'm currently unable to do it (still able with openocd)
|
The command still works for me without error: (filesize 12560)
However it already happened to me that |
@cladmi do you have an
Flashing slot0 does succeed, but not flashing slot0-extended, so it doesn't seem to be a reset problem to me. |
Oh no I don't have that one. |
Contribution description
This PR attempts to add riotboot support to the nrf52 class mcu's. Unfortunately currently not compatible with the
nordic_softdevice_ble
package.Testing procedure
the default example (with and without bootloader) and the
tests/riotboot
test should both work with this PRIssues/PRs references
Depends on
riotboot.mk: get variable as hex rather than dec riotboot.mk: get variable as hex rather than dec #11201