Skip to content

Commit 414f614

Browse files
SebastianBoembolivar-nordic
authored andcommitted
[nrf fromlist] samples: Added a minimal MCUBoot integration test
From upstream zephyrproject-rtos#13672 Added a minimal integration test for MCUBoot. It has just enough coverage to catch build issues. Which is better than before (no coverage in the Zephyr CI). Signed-off-by: Sebastian Bøe <[email protected]> (cherry picked from commit 1937b41) (cherry picked from commit 026bd21) (cherry picked from commit 4b3a15b) Signed-off-by: Martí Bolívar <[email protected]>
1 parent 3e4318f commit 414f614

File tree

7 files changed

+76
-0
lines changed

7 files changed

+76
-0
lines changed

CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@
303303
/samples/drivers/CAN/ @alexanderwachter
304304
/samples/drivers/ht16k33/ @henrikbrixandersen
305305
/samples/gui/ @vanwinkeljan
306+
/samples/mcuboot/ @SebastianBoe
306307
/samples/net/ @jukkar @tbursztyka @pfalcon
307308
/samples/net/dns_resolve/ @jukkar @tbursztyka @pfalcon
308309
/samples/net/lwm2m_client/ @mike-scott

samples/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Samples and Demos
1616
bluetooth/bluetooth.rst
1717
sensor/*
1818
boards/*
19+
mcuboot/*
1920
mpu/*
2021
drivers/drivers.rst
2122
application_development/*

samples/mcuboot/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
cmake_minimum_required(VERSION 3.13.1)
2+
3+
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
4+
project(mcuboot)
5+
6+
target_sources(app PRIVATE src/main.c)

samples/mcuboot/README.rst

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
.. _mcuboot_sample:
2+
3+
MCUBoot Sample
4+
##############
5+
6+
Overview
7+
********
8+
A simple hello world sample that is booted by the bootloader
9+
MCUBoot. This sample can be used with any platform that supports
10+
MCUBoot.
11+
12+
Building and Running
13+
********************
14+
15+
This project outputs output from the bootloader and then 'Hello World'
16+
from the application. It can be built and executed on nRF52_pca10040
17+
as follows:
18+
19+
.. zephyr-app-commands::
20+
:zephyr-app: samples/mcuboot
21+
:host-os: unix
22+
:board: nrf52_pca10040
23+
:goals: run
24+
:compact:
25+
26+
Sample Output
27+
=============
28+
29+
.. code-block:: console
30+
31+
***** Booting Zephyr OS v1.14.0-rc1-447-gb30b83a6eb *****
32+
[00:00:00.004,638] <inf> mcuboot: Starting bootloader
33+
[00:00:00.011,505] <inf> mcuboot: Image 0: magic=unset, copy_done=0x3, image_ok=0x3
34+
[00:00:00.020,690] <inf> mcuboot: Scratch: magic=unset, copy_done=0xe0, image_ok=0x3
35+
[00:00:00.029,998] <inf> mcuboot: Boot source: slot 0
36+
[00:00:00.039,062] <inf> mcuboot: Swap type: none
37+
[00:00:00.132,904] <inf> mcuboot: Bootloader chainload address offset: 0xc000
38+
[00:00:00.141,479] <inf> mcuboot: Jumping to the first image slot
39+
***** Booting Zephyr OS v1.14.0-rc1-447-gb30b83a6eb *****
40+
Hello World! nrf52_pca10040

samples/mcuboot/prj.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CONFIG_BOOTLOADER_MCUBOOT=y

samples/mcuboot/sample.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
sample:
2+
name: mcuboot
3+
tests:
4+
boards.mcuboot:
5+
tags: mcuboot
6+
# All platforms supported by MCUBoot out-of-the-box are
7+
# supported. nRF52 is known to be supported.
8+
platform_whitelist: nrf52840_pca10056 nrf52_pca10040
9+
harness: console
10+
harness_config:
11+
type: one_line
12+
regex:
13+
- "Hello World! (.*)"

samples/mcuboot/src/main.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*
2+
* Copyright (c) 2012-2014 Wind River Systems, Inc.
3+
* Copyright (c) 2019 Nordic Semiconductor ASA
4+
*
5+
* SPDX-License-Identifier: Apache-2.0
6+
*/
7+
8+
#include <zephyr.h>
9+
#include <misc/printk.h>
10+
11+
void main(void)
12+
{
13+
printk("Hello World! %s\n", CONFIG_BOARD);
14+
}

0 commit comments

Comments
 (0)