jlink: handle flashing at IMAGE_OFFSET#11200
Conversation
|
I will do a proper test with #11126 However, as you mentioned in #11201 JLink requires the address to be given as hexadecimal values, but it was currently not the case with |
|
Indeed it will break the And the address is indeed 0x200000 RIOT/cpu/cc2538/ldscripts/cc2538nf53.ld Line 22 in 5488c5f |
|
So there is a need for a commit before this one to prepare the diff --git a/boards/openmote-cc2538/Makefile.include b/boards/openmote-cc2538/Makefile.include
index bb8b52bf3..401a8fda8 100644
--- a/boards/openmote-cc2538/Makefile.include
+++ b/boards/openmote-cc2538/Makefile.include
@@ -12,7 +12,7 @@ export PROGRAMMER ?= cc2538-bsl
ifeq ($(PROGRAMMER),jlink)
# setup JLink for flashing
export JLINK_DEVICE := cc2538sf53
- export FLASH_ADDR := 200000
+ export FLASH_ADDR := 0x200000
export JLINK_IF := JTAG
export TUI := 1
include $(RIOTMAKE)/tools/jlink.inc.mkand then I get the correct flashing address with this pull request Then after this one, there are different places where |
|
Pushed the change, thanks very much for the fix |
cladmi
left a comment
There was a problem hiding this comment.
Some minor changes inline to add a comment and refactor the commit message.
The commit for the openmote states JLink is the default programmer but it is not and it does not matter.
Explaining why we change to 0x200000 instead of keeping 200000 would be better.
"Jlink interprets the address as hex, so be consistent with the declaration to allow evaluating it with bash arithmetic later." or something.
The commit title should also be prefixed by what it changes so boards/openmote-cc2538 or openmote-cc2538.
Note, before merging, I also would like to invert the commits and have the openmote fix before the JLink modification.
I tested #11126 (comment) so it makes riotboot work with nrf52dk and JLink as stated. Great !
I tested that mcuboot still works with this pr
BOARD=nrf52dk make -C tests/mcuboot/ clean mcuboot-flash
I did not test the openmote-cc2538 for the moment.
| printf "${JLINK_PRE_FLASH}\n" >> ${BINDIR}/burn.seg | ||
| fi | ||
| echo "loadbin ${BINFILE} ${FLASH_ADDR}" >> ${BINDIR}/burn.seg | ||
| ADDR_TO_FLASH=$(printf "0x%08x\n" "$((${FLASH_ADDR} + ${IMAGE_OFFSET}))") |
There was a problem hiding this comment.
Please add a comment saying that it is formatted as hexadecimal as JLink interprets the address as hex.
9a2a813 to
cc2bfd0
Compare
|
I've changed the commit messages and switched the commits. I've added the comment change as a fixup for easier review. |
|
@haukepetersen do you know how to test the |
|
I tested on my machine and it worked for the We can note the address is correctly handled |
|
Please squash the fixup and add the "CI: ready for build" when done. |
Declaring the address in decimal format meant that it was being interpreted as a decimal rather than hex address by the tooling and the intermediate bash arithmetic. This fixes that bug.
- Handling of flashing address is now similar to that in openocd, except FLASH_ADDR is not automatically determined
cc2bfd0 to
80d4838
Compare
|
Thanks for posting the test results, nice. |
|
Travis is not reporting his result but succeeded: https://travis-ci.org/RIOT-OS/RIOT/builds/508982496 |
|
Thank you for handling this one. |
Contribution description
Currently, the IMAGE_OFFSET variable isn't handled in jlink.sh. riotboot.mk is currently the only place where this variable is exported. So, this is needed for riotboot to flash properly using jlink. It attempts to be a non-destructive change for everything else.
The contribution attempts to ensure that the flashing address handling in jlink.sh remains the same for all other modules - i.e., it doesn't break anything. Further PRs will clean up the wider handling of the FLASH_ADDR and IMAGE_OFFSET variables. Handling of flashing address is now similar to that in openocd, except FLASH_ADDR is not automatically determined. So, this PR goes in the direction of making the handling of these variables homogenous.
Testing procedure
Testing should cover all boards which use jlink and where riotboot is either currently supported or support is under development.
Needed for:
#11201
#11126