From bb71e979f3a425f18b36334d794d47634ddd9f9a Mon Sep 17 00:00:00 2001 From: Kaspar Schleiser Date: Thu, 13 Jun 2019 12:14:59 +0200 Subject: [PATCH 1/4] riotboot: set FLASHFILE to RIOTBOOT_EXTENDED_BIN ... if the riotboot feature is used. Previously, even an application that had "FEATURES_REQUIRED += riotboot" set would still flash the non-riotboot binary on "make flash". This is usualy not what the user wants. This commit set's the FLASHFILE variable to the combined "riotboot bootloader + slot0 + empty slot1" binary. This has the effect that make all, flash and flash-only will compile and/or flash a working riotboot setup. tests/riotboot and tests/riotboot_flashwrite now default to flashing the riotboot-extended binary. tests/riotboot was previously configured to use the riotboot-combined binary. This has been changed in order to not behave differently than how usual riotboot applications do. --- makefiles/boot/riotboot.mk | 5 +++++ tests/riotboot/Makefile | 4 ---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/makefiles/boot/riotboot.mk b/makefiles/boot/riotboot.mk index d476cb7e33..6b43c064f9 100644 --- a/makefiles/boot/riotboot.mk +++ b/makefiles/boot/riotboot.mk @@ -126,6 +126,11 @@ riotboot/slot1: $(SLOT1_RIOT_BIN) # Default flashing rule for bootloader + slot 0 riotboot/flash: riotboot/flash-slot0 riotboot/flash-bootloader +# make applications that use the riotboot feature default to actually using it +# Target 'all' will generate the combined file directly. +# It also makes 'flash' and 'flash-only' work without specific command. +FLASHFILE = $(RIOTBOOT_EXTENDED_BIN) + else riotboot: $(Q)echo "error: riotboot feature not selected! (try FEATURES_REQUIRED += riotboot)" diff --git a/tests/riotboot/Makefile b/tests/riotboot/Makefile index 6f580a8dae..9ad94ca5b2 100644 --- a/tests/riotboot/Makefile +++ b/tests/riotboot/Makefile @@ -18,9 +18,5 @@ DEVELHELP ?= 1 # Change this to 0 show compiler invocation lines by default: QUIET ?= 1 -# Target 'all' will generate the combined file directly. -# It also makes 'flash' and 'flash-only' work without specific command. -FLASHFILE = $(RIOTBOOT_COMBINED_BIN) - include ../Makefile.tests_common include $(RIOTBASE)/Makefile.include From 8624d3dac4908427c2186c157c11df760b3a9469 Mon Sep 17 00:00:00 2001 From: Kaspar Schleiser Date: Thu, 13 Jun 2019 13:46:00 +0200 Subject: [PATCH 2/4] riotboot: update documentation to match automatic use FLASHFILE is now set to RIOTBOOT_EXTENDED_BIN, changing the meaning of make all`, `flash`, `flash-only`. This commits updates the documentation accordingly. --- bootloaders/riotboot/README.md | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/bootloaders/riotboot/README.md b/bootloaders/riotboot/README.md index 2342b219a2..7f4112516e 100644 --- a/bootloaders/riotboot/README.md +++ b/bootloaders/riotboot/README.md @@ -61,13 +61,18 @@ The above requirements are usually met if the board succeeds to execute the riotboot test in tests/. # Single Slot -Just compile your application using the target `riotboot`. The header -is generated automatically according to your `APP_VER`, which can be -optionally set (0 by default) in your makefile. +Just compile your application with `FEATURES_REQUIRED += riotboot`. The header +is generated automatically according to your `APP_VER`, which can be optionally +set (0 by default) in your makefile. ## Flashing example -The image can be flashed using `riotboot/flash` which also flashes +If your application is using the riotboot feature, the usual targets (`all`, +`flash`, `flash-only`) will automatically compile and/or flash both the +bootloader and slot0, while ensuring that slot 1 is invalidated so slot 0 will +be booted. + +The image can also be flashed using `riotboot/flash` which also flashes the bootloader. Below a concrete example: `BOARD=samr21-xpro FEATURES_REQUIRED+=riotboot APP_VER=$(date +%s) make -C examples/hello-world riotboot/flash-combined-slot0` @@ -94,7 +99,8 @@ Dedicated make targets are available to build and flash several slots: In particular, if one wants to be sure to boot a particular image, using the target `riotboot/flash-extended-slot0` is the way to go (resulting in only -slot 0 being valid, thus being booted). +slot 0 being valid, thus being booted). This is done automatically by `make +flash` if the `riotboot` feature is used. ## Flashing examples From b3cc3ab2eaefb17ed9f50bc142fc397566547b3d Mon Sep 17 00:00:00 2001 From: Kaspar Schleiser Date: Thu, 13 Jun 2019 13:48:04 +0200 Subject: [PATCH 3/4] riotboot: fix APP_VER default documentation --- bootloaders/riotboot/README.md | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/bootloaders/riotboot/README.md b/bootloaders/riotboot/README.md index 7f4112516e..7e3827b6a4 100644 --- a/bootloaders/riotboot/README.md +++ b/bootloaders/riotboot/README.md @@ -63,7 +63,8 @@ the riotboot test in tests/. # Single Slot Just compile your application with `FEATURES_REQUIRED += riotboot`. The header is generated automatically according to your `APP_VER`, which can be optionally -set (0 by default) in your makefile. +set (current system time in seconds since 1970 (epoch) by default) in your +makefile. ## Flashing example @@ -102,15 +103,6 @@ target `riotboot/flash-extended-slot0` is the way to go (resulting in only slot 0 being valid, thus being booted). This is done automatically by `make flash` if the `riotboot` feature is used. -## Flashing examples +## Testing riotboot -The following sequence of commands tests building, flashing and booting slot 0, -then slot 1. tests/riotboot prints out the current booted slot in the shell. - -To test building, flashing and booting the first slot: - -`BOARD=samr21-xpro APP_VER=$(date +%s) make -C tests/riotboot/ riotboot/flash-combined-slot0 test` - -For the second slot: - -`BOARD=samr21-xpro APP_VER=$(date +%s) make -C tests/riotboot/ riotboot/flash-slot1 test` +See [tests/riotboot/README.md](https://github.com/RIOT-OS/RIOT/blob/master/tests/riotboot/README.md). From 8370acb2ffe736c18f64c37ec2f27f01857b3d8c Mon Sep 17 00:00:00 2001 From: Kaspar Schleiser Date: Thu, 13 Jun 2019 14:58:29 +0200 Subject: [PATCH 4/4] tests/riotboot_flashwrite: blacklist some boards Adding saml1[01]-xpro, nucleo-f302r8|f334r8 to BOARDS_INSUFFICIENT_MEMORY. The riotboot build fails because it only offers half the flash size (per slot), compared to before where the default build would not use riotboot at all, thus have double the flash (but being useless). --- tests/riotboot_flashwrite/Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/riotboot_flashwrite/Makefile b/tests/riotboot_flashwrite/Makefile index 9fe4200fa0..21dce606af 100644 --- a/tests/riotboot_flashwrite/Makefile +++ b/tests/riotboot_flashwrite/Makefile @@ -7,8 +7,10 @@ BOARD_INSUFFICIENT_MEMORY := arduino-duemilanove arduino-leonardo \ chronos i-nucleo-lrwan1 \ msb-430 msb-430h nucleo-f031k6 \ nucleo-f042k6 nucleo-l031k6 nucleo-f030r8 \ - nucleo-f303k8 nucleo-l053r8 stm32f0discovery \ - telosb waspmote-pro wsn430-v1_3b wsn430-v1_4 z1 + nucleo-f302r8 nucleo-f303k8 nucleo-f334r8 \ + nucleo-l053r8 saml10-xpro saml11-xpro \ + stm32f0discovery telosb waspmote-pro \ + wsn430-v1_3b wsn430-v1_4 z1 # Include packages that pull up and auto-init the link layer. # NOTE: 6LoWPAN will be included if IEEE802.15.4 devices are present