From 2ff280d57fc018dad67420fd27509f28e8416739 Mon Sep 17 00:00:00 2001 From: kYc0o Date: Tue, 13 Jun 2017 17:35:23 +0200 Subject: [PATCH] tests: add mcuboot test application --- tests/mcuboot/Makefile | 14 ++++++++++++++ tests/mcuboot/README.md | 20 ++++++++++++++++++++ tests/mcuboot/main.c | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 67 insertions(+) create mode 100644 tests/mcuboot/Makefile create mode 100644 tests/mcuboot/README.md create mode 100644 tests/mcuboot/main.c diff --git a/tests/mcuboot/Makefile b/tests/mcuboot/Makefile new file mode 100644 index 0000000000..129aedf153 --- /dev/null +++ b/tests/mcuboot/Makefile @@ -0,0 +1,14 @@ +APPLICATION = hello_mcuboot + +BOARD ?= nrf52dk + +include ../Makefile.tests_common + +BOARD_WHITELIST := nrf52dk + +export IMAGE_VERSION = 1.1.1+1 + +# this test is supposed to always build the mcuboot image +all: mcuboot + +include $(RIOTBASE)/Makefile.include diff --git a/tests/mcuboot/README.md b/tests/mcuboot/README.md new file mode 100644 index 0000000000..f973ee751d --- /dev/null +++ b/tests/mcuboot/README.md @@ -0,0 +1,20 @@ +# MCUBoot test application +This test is intended to compile a hello-world program taking into account +the existence of the MCUBoot bootloader at the first 32K in the ROM. + +For this first support, a pre-compiled mynewt MCUBoot binary is downloaded at +compile time. + +The goal is to produce an ELF file which is linked to be flashed at a +`BOOTLOADER_OFFSET` offset rather than the beginning of ROM. MCUBoot also +expects an image padded with some specific headers containing the version +information, and TLVs with hash and signing information. This is done through +the imgtool.py application, which is executed automatically by the build +system. + +This test can be called using `make mcuboot` to produce such ELF file, +which can also be flashed using `make flash-mcuboot`.This command also flashes +the pre-compiled bootloader. + +It's also possible to build and flash MCUBoot by following the instructions on +the MCUBoot repository either using mynewt or zephyr operating systems. diff --git a/tests/mcuboot/main.c b/tests/mcuboot/main.c new file mode 100644 index 0000000000..1a392a5776 --- /dev/null +++ b/tests/mcuboot/main.c @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2017 Inria + * + * This file is subject to the terms and conditions of the GNU Lesser + * General Public License v2.1. See the file LICENSE in the top level + * directory for more details. + */ + +/** + * @ingroup tests + * @{ + * + * @file + * @brief MCUBoot compile test application + * + * @author Francisco Acosta + * + * @} + */ + +#include +#include "cpu.h" + +int main(void) +{ + puts("Hello MCUBoot!"); + + printf("You are running RIOT on a(n) %s board.\n", RIOT_BOARD); + printf("This board features a(n) %s MCU.\n", RIOT_MCU); + printf("The startup address is: %p\n", (void*)SCB->VTOR); + + return 0; +}