[riot-notifications] [RIOT-OS/RIOT] boards/frdm-kw41z: add riotboot (#11562)

Gaƫtan Harter notifications at github.com
Wed May 22 17:34:49 CEST 2019


> > And currently, tests/riotboot does not work:
> > RIOT_CI_BUILD=1 BOARD=frdm-kw41z make -C tests/riotboot  flash test
> 
> The command is `RIOT_CI_BUILD=1 BOARD=frdm-kw41z make -C tests/riotboot riotboot/flash test`

It is supposed to work with `flash test` as the makefile is setting `FLASHFILE`:
Thats why `check-field` should know which one to call depending on the file format. I can help on this if you want to do it in make only. Doing it in the script could also work.

```
tests/riotboot/Makefile

...
# Target 'all' will generate the combined file directly.
# It also makes 'flash' and 'flash-only' work without specific command.
FLASHFILE = $(RIOTBOOT_COMBINED_BIN)
```

To make it work in the current version, I also needed to export `RIOTBOOT_HDR_LEN`. But as mentioned inline, I think we do not need to care if `fcfield` is as `0 + fcfieldstart`.

``` diff
diff --git a/sys/riotboot/Makefile.include b/sys/riotboot/Makefile.include
index 4e2d9b6c6..607a1fe1d 100644
--- a/sys/riotboot/Makefile.include
+++ b/sys/riotboot/Makefile.include
@@ -1,7 +1,7 @@
 # Indicate the reserved space for a header, 256B by default
 # Notice that it must be 256B aligned. This is restricted by
 # the Cortex-M0+/3/4/7 architecture
-RIOTBOOT_HDR_LEN ?= 0x100
+export RIOTBOOT_HDR_LEN ?= 0x100

 # By default, slot 0 is found just after RIOTBOOT_LEN. Slot 1 after
 # slot 0. The values might be overridden to add more or less offset
```

And then the test succeed !!!! :+1: 

```
> 2019-05-22 17:31:11,218 - INFO #  main(): This is RIOT! (Version: buildtest)
2019-05-22 17:31:11,227 - INFO # Hello riotboot!
2019-05-22 17:31:11,229 - INFO # You are running RIOT on a(n) frdm-kw41z board.
2019-05-22 17:31:11,230 - INFO # This board features a(n) kinetis MCU.
2019-05-22 17:31:11,232 - INFO # riotboot_test: running from slot 0
2019-05-22 17:31:11,233 - INFO # Image magic_number: 0x544f4952
2019-05-22 17:31:11,237 - INFO # Image Version: 0x5ce56b3a
2019-05-22 17:31:11,239 - INFO # Image start address: 0x00001100
2019-05-22 17:31:11,242 - INFO # Header chksum: 0x431476c1
2019-05-22 17:31:11,243 - INFO #
> 2019-05-22 17:31:11,282 - INFO #  curslotnr
2019-05-22 17:31:11,287 - INFO # Current slot=0
> curslothdr
2019-05-22 17:31:11,348 - INFO #  curslothdr
2019-05-22 17:31:11,350 - INFO # Image magic_number: 0x544f4952
2019-05-22 17:31:11,353 - INFO # Image Version: 0x5ce56b3a
2019-05-22 17:31:11,354 - INFO # Image start address: 0x00001100
2019-05-22 17:31:11,358 - INFO # Header chksum: 0x431476c1
2019-05-22 17:31:11,358 - INFO #
> getslotaddr 0
2019-05-22 17:31:11,418 - INFO #  getslotaddr 0
2019-05-22 17:31:11,419 - INFO # Slot 0 address=0x00001100
> dumpaddrs
2019-05-22 17:31:11,478 - INFO #  dumpaddrs
2019-05-22 17:31:11,483 - INFO # slot 0: metadata: 0x1000 image: 0x00001100
2019-05-22 17:31:11,489 - INFO # slot 1: metadata: 0x40800 image: 0x00000000
```

otherwise I got

```
RIOT_CI_BUILD=1 BOARD=frdm-kw41z make -C tests/riotboot riotboot/flash test
make: Entering directory '/home/harter/work/git/RIOT/tests/riotboot'
compiling /home/harter/work/git/RIOT/dist/tools/riotboot_gen_hdr/bin/genhdr...
make: Nothing to be done for 'all'.
creating /home/harter/work/git/RIOT/tests/riotboot/bin/frdm-kw41z/tests_riotboot-slot0.riot.bin...
/home/harter/work/git/RIOT/dist/tools/openocd/openocd.sh flash /home/harter/work/git/RIOT/tests/riotboot/bin/frdm-kw41z/tests_riotboot-slot0.riot.bin
### Flashing Target ###
/home/harter/work/git/RIOT/cpu/kinetis/dist/check-fcfield-bin.sh: 1: /home/harter/work/git/RIOT/cpu/kinetis/dist/check-fcfield-bin.sh: arithmetic expression: expecting primary: "0x400+"
Danger of bricking the device during flash!
Flash configuration field of /home/harter/work/git/RIOT/tests/riotboot/bin/frdm-kw41z/tests_riotboot-slot0.riot.bin:
arm-none-eabi-objdump: /home/harter/work/git/RIOT/tests/riotboot/bin/frdm-kw41z/tests_riotboot-slot0.riot.bin: File format not recognized
Abort flash procedure!
pre-flash checks failed, status=1
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/11562#issuecomment-494855542
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190522/a064b5d2/attachment.html>


More information about the notifications mailing list