Skip to content

Commit

Permalink
examples/suit_update: add SUIT draft v4 example & test
Browse files Browse the repository at this point in the history
This commit adds an example application showcasing SUIT draft v4
firmware updates.

It includes a test script suitable for local or CI testing.

Co-authored-by: Alexandre Abadie <alexandre.abadie@inria.fr>
Co-authored-by: Koen Zandberg <koen@bergzand.net>
Co-authored-by: Francisco Molina <femolina@uc.cl>
  • Loading branch information
4 people committed Jul 8, 2019
1 parent 2d9dba9 commit 760f978
Show file tree
Hide file tree
Showing 5 changed files with 918 additions and 0 deletions.
117 changes: 117 additions & 0 deletions examples/suit_update/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
# name of your application
APPLICATION = suit_update

# If no BOARD is found in the environment, use this default:
BOARD ?= samr21-xpro

# This has to be the absolute path to the RIOT base directory:
RIOTBASE ?= $(CURDIR)/../..

BOARD_INSUFFICIENT_MEMORY := arduino-duemilanove arduino-mega2560 arduino-nano \
arduino-uno chronos 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

# lower pktbuf size a little
CFLAGS += -DGNRC_PKTBUF_SIZE=2000

#
# Networking
#
# Include packages that pull up and auto-init the link layer.
# NOTE: 6LoWPAN will be included if IEEE802.15.4 devices are present
USEMODULE += gnrc_netdev_default
USEMODULE += auto_init_gnrc_netif
# Specify the mandatory networking modules for IPv6 and UDP
USEMODULE += gnrc_ipv6_router_default
USEMODULE += gnrc_udp
USEMODULE += gnrc_sock_udp
# Additional networking modules that can be dropped if not needed
USEMODULE += gnrc_icmpv6_echo

# include this for printing IP addresses
USEMODULE += shell_commands

# Comment this out to enable code in RIOT that does safety checking
# which is not needed in a production environment but helps in the
# development process:
DEVELHELP = 1

# Change this to 0 show compiler invocation lines by default:
QUIET ?= 1

#
# SUIT update specific stuff
#

USEMODULE += nanocoap_sock sock_util
USEMODULE += suit suit_coap

# SUIT draft v4 support:
USEMODULE += suit_v4

# SUIT depends on riotboot support and some extra riotboot modules
FEATURES_REQUIRED += riotboot
USEMODULE += riotboot_slot riotboot_flashwrite riotboot_flashwrite_verify_sha256

# Change this to 0 to not use ethos
USE_ETHOS ?= 1

ifeq (1,$(USE_ETHOS))
GNRC_NETIF_NUMOF := 2
USEMODULE += stdio_ethos
USEMODULE += gnrc_uhcpc

# ethos baudrate can be configured from make command
ETHOS_BAUDRATE ?= 115200
CFLAGS += -DETHOS_BAUDRATE=$(ETHOS_BAUDRATE)

# make sure ethos and uhcpd are built
TERMDEPS += host-tools

# For local testing, run
#
# $ cd dist/tools/ethos; sudo ./setup_network.sh riot0 2001:db8::0/64
#
#... in another shell and keep it running.
export TAP ?= riot0
TERMPROG = $(RIOTTOOLS)/ethos/ethos
TERMFLAGS = $(TAP) $(PORT)
endif

# The test needs the linked slot binaries without header in order to be able to
# create final binaries with specific APP_VER values. The CI RasPi test workers
# don't compile themselves and re-create signed images, thus add the required
# files here so they will be submitted along with the test jobs.
TEST_EXTRA_FILES += $(SLOT_RIOT_ELFS) $(SUIT_SEC) $(SUIT_PUB)

# riotboot is currently incompatible with the NRF softdevice.
# That gets automatically selected on boards that support it, unless nrfmin is
# used.
# So use that here in order to prevent the softdevice from being used.
ifeq (nrf52dk,$(BOARD))
USEMODULE += nrfmin
endif

include $(RIOTBASE)/Makefile.include

.PHONY: host-tools

host-tools:
$(Q)env -u CC -u CFLAGS make -C $(RIOTTOOLS)

# Set a custom channel if needed
ifneq (,$(filter cc110x,$(USEMODULE))) # radio is cc110x sub-GHz
DEFAULT_CHANNEL ?= 0
CFLAGS += -DCC110X_DEFAULT_CHANNEL=$(DEFAULT_CHANNEL)
else
ifneq (,$(filter at86rf212b,$(USEMODULE))) # radio is IEEE 802.15.4 sub-GHz
DEFAULT_CHANNEL ?= 5
CFLAGS += -DIEEE802154_DEFAULT_SUBGHZ_CHANNEL=$(DEFAULT_CHANNEL)
else # radio is IEEE 802.15.4 2.4 GHz
DEFAULT_CHANNEL ?= 26
CFLAGS += -DIEEE802154_DEFAULT_CHANNEL=$(DEFAULT_CHANNEL)
endif
endif
Loading

0 comments on commit 760f978

Please sign in to comment.