<blockquote>
<blockquote>
<p>And currently, tests/riotboot does not work:<br>
RIOT_CI_BUILD=1 BOARD=frdm-kw41z make -C tests/riotboot  flash test</p>
</blockquote>
<p>The command is <code>RIOT_CI_BUILD=1 BOARD=frdm-kw41z make -C tests/riotboot riotboot/flash test</code></p>
</blockquote>
<p>It is supposed to work with <code>flash test</code> as the makefile is setting <code>FLASHFILE</code>:<br>
Thats why <code>check-field</code> 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.</p>
<pre><code>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)
</code></pre>
<p>To make it work in the current version, I also needed to export <code>RIOTBOOT_HDR_LEN</code>. But as mentioned inline, I think we do not need to care if <code>fcfield</code> is as <code>0 + fcfieldstart</code>.</p>
<div class="highlight highlight-source-diff"><pre><span class="pl-c1">diff --git a/sys/riotboot/Makefile.include b/sys/riotboot/Makefile.include</span>
index 4e2d9b6c6..607a1fe1d 100644
<span class="pl-md">--- a/sys/riotboot/Makefile.include</span>
<span class="pl-mi1">+++ b/sys/riotboot/Makefile.include</span>
<span class="pl-mdr">@@ -1,7 +1,7 @@</span>
 # 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
<span class="pl-md"><span class="pl-md">-</span>RIOTBOOT_HDR_LEN ?= 0x100</span>
<span class="pl-mi1"><span class="pl-mi1">+</span>export RIOTBOOT_HDR_LEN ?= 0x100</span>

 # 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</pre></div>
<p>And then the test succeed !!!! <g-emoji class="g-emoji" alias="+1" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f44d.png">👍</g-emoji></p>
<pre><code>> 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
</code></pre>
<p>otherwise I got</p>
<pre><code>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
</code></pre>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/RIOT-OS/RIOT/pull/11562?email_source=notifications&email_token=ABE7WYDCFS2LRLAH4WWSBVDPWVRZTA5CNFSM4HORROP2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODV7OK5Q#issuecomment-494855542">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABE7WYFPKTJNJLGLVU2V3V3PWVRZTANCNFSM4HORROPQ">mute the thread</a>.<img src="https://github.com/notifications/beacon/ABE7WYHOPLF4ZKWF3TOYEHLPWVRZTA5CNFSM4HORROP2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODV7OK5Q.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/RIOT-OS/RIOT/pull/11562?email_source=notifications\u0026email_token=ABE7WYDCFS2LRLAH4WWSBVDPWVRZTA5CNFSM4HORROP2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODV7OK5Q#issuecomment-494855542",
"url": "https://github.com/RIOT-OS/RIOT/pull/11562?email_source=notifications\u0026email_token=ABE7WYDCFS2LRLAH4WWSBVDPWVRZTA5CNFSM4HORROP2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODV7OK5Q#issuecomment-494855542",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>