[riot-notifications] [RIOT-OS/RIOT] Pr stm32f4 riotboot (#11682)

Francisco notifications at github.com
Wed Jun 12 18:50:34 CEST 2019

The RIOT community cares a lot about code quality.
Therefore, before describing what your contribution is about, we would like
you to make sure that your modifications are compliant with the RIOT
coding conventions, see https://github.com/RIOT-OS/RIOT/wiki/Coding-conventions.

### Contribution description

Put here the description of your contribution:
- describe which part(s) of RIOT is (are) involved
- if it's a bug fix, describe the bug that it solves and how it is solved
- you can also give more information to reviewers about how to test your changes

This PR adds riotboot for stm32f4. Since F4 works with sectors for riotboot to work each slot must start at the beginning of a slot. For stm32f4 the smallest slot is of length 16kB, therefore that must be the length of the bootloader and the same amount must be taken from the second half of the flash to optimize flash usage.

This PR is part of 3, since just adding riotboot doesn't make much sense if it can't perform ota. Although it doesn't depend on them it is highly related to:

* Support flashpage: https://github.com/RIOT-OS/RIOT/pull/11681
* Don't erase fist page at un update finish: 

### Testing procedure

It has been tested on the supported boards: `nucleo-f446re` and `stm32f429i-disc1`. 

1.- Test riotboot:

`BOARD=nucleo-f446r FEATURES_REQUIRED+=riotboot make -C tests/xtimer_usleep riotboot/flash-extended-slot0 term`

`BOARD=nucleo-f446rFEATURES_REQUIRED+=riotboot make -C tests/xtimer_usleep riotboot/flash-slot1 term`

In both cases it should run without issues.

2.- Since the sector division is important when updating the slots by writing to flash directly it would be ideal to reba se on top off flashpage: https://github.com/RIOT-OS/RIOT/pull/11681 and ..

and run `tests/riotboot_flashwrite`

The following patch can be applied to the test Makefile

diff --git a/tests/riotboot_flashwrite/Makefile b/tests/riotboot_flashwrite/Makefile
index 32f127d70..d3c9f20b4 100644
--- a/tests/riotboot_flashwrite/Makefile
+++ b/tests/riotboot_flashwrite/Makefile
@@ -39,11 +39,17 @@ LOW_MEMORY_BOARDS := nucleo-f334r8
 # uncomment these to use ethos
-#USEMODULE += ethos gnrc_uhcpc
+USEMODULE += ethos gnrc_uhcpc  stdio_uart_rx
 ## ethos baudrate can be configured from make command
-#ETHOS_BAUDRATE ?= 115200
+TAP ?= tap0
+IPV6_PREFIX ?= 2001:db8::/64
+TERMPROG ?= sudo sh $(RIOTTOOLS)/ethos/start_network.sh
 ifneq (,$(filter $(BOARD),$(LOW_MEMORY_BOARDS)))
   $(info Using low-memory configuration for microcoap_server.)


Then to test:

- provided the node `make -C tests/riotboot_flashwrite/ BOARD=stm32f429i-disc1 riotboot/flash term`
- compile new firmware: `make -C tests/riotboot_flashwrite/ BOARD=stm32f429i-disc1 riotboot`
- launch an updated: `coap-client -m post coap://[fe80::2%tap0]/flashwrite -f tests/riotboot_flashwrite/bin/stm32f429i-disc1/tests_riotboot_flashwrite-slot1.riot.bin -b 64`

When the update finished reboot the node manually it should have started from a different slot.

Details steps to test your contribution:
- which test/example to compile for which board and is there a 'test' command
- how to know that it was not working/available in master
- the expected success test output

### Issues/PRs references

Examples: Fixes #1234. See also #5678. Depends on PR #9876.

Please use keywords (e.g., fixes, resolve) with the links to the issues you
resolved, this way they will be automatically closed when your pull request
is merged. See https://help.github.com/articles/closing-issues-using-keywords/.

Related to  https://github.com/RIOT-OS/RIOT/pull/11681
You can view, comment on, or merge this pull request online at:


-- Commit Summary --

  * stm32f4/Makefile.include: define SLOTx_OFFSET to sector start
  * boards/stm32f429i-disc1: add riotboot
  * stm32f4/Makefile.include: set RIOTBOOT_HDR_LEN to 0x200
  * boards/nucleo-f446re: add riotboot

-- File Changes --

    M boards/nucleo-f446re/Makefile.features (1)
    M boards/stm32f429i-disc1/Makefile.features (3)
    M cpu/stm32f4/Makefile.include (21)

-- Patch Links --


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190612/def65878/attachment.html>

More information about the notifications mailing list