blob: 58e9458f1b2b5b6d97c154d328f7611de3aa5eca [file] [log] [blame] [view]
David Brownd2fcc212017-09-11 14:47:48 -06001# Zephyr Test Plan
2
3The following roughly describes how mcuboot is tested on Zephyr. The
4testing is done with the code in `samples/zephyr`. These examples
5were written using the FRDM-K64F, but other boards should be similar.
6At this time, however, the partitions are hardcoded in the Makefile
7targets to flash.
8
David Brown1d3f67d2017-09-14 15:10:24 -06009## Building and running.
David Brownd2fcc212017-09-11 14:47:48 -060010
David Brown1d3f67d2017-09-14 15:10:24 -060011The tests are build using the various `test-*` targets in
12`samples/zephyr/Makefile`. For each test, invoke `make` with that
13target:
David Brownd2fcc212017-09-11 14:47:48 -060014
David Brown1d3f67d2017-09-14 15:10:24 -060015 $ make test-good-rsa
David Brownd2fcc212017-09-11 14:47:48 -060016
David Brown1d3f67d2017-09-14 15:10:24 -060017Begin by doing a full erase, and programming the bootloader itself:
David Brownd2fcc212017-09-11 14:47:48 -060018
19 $ pyocd-flashtool -ce
20 $ make flash_boot
21
22After it resets, look for "main: Starting bootloader", a few debug
23messages, and lastly: "main: Unable to find bootable image".
24
25Then, load hello1:
26
27 $ make flash_hello1
28
29This should print "main: Jumping to the first image slot", and you
David Brown1d3f67d2017-09-14 15:10:24 -060030should get an image "hello1".
David Brownd2fcc212017-09-11 14:47:48 -060031
David Brown1d3f67d2017-09-14 15:10:24 -060032Note that there are comments with each test target describing the
33intended behavior for each of these steps. Sometimes an upgrade will
34happen and sometimes it will not.
David Brownd2fcc212017-09-11 14:47:48 -060035
David Brownd2fcc212017-09-11 14:47:48 -060036 $ make flash_hello2
37
38This should print a message: `boot_swap_type: Swap type: test`, and
David Brown1d3f67d2017-09-14 15:10:24 -060039you should see "hello2".
David Brownd2fcc212017-09-11 14:47:48 -060040
41Now reset the target::
42
43 $ pyocd-tool reset
44
David Brown1d3f67d2017-09-14 15:10:24 -060045And you should see a revert and "hello1" running.
46
47## Testing that mark ok works
David Brownd2fcc212017-09-11 14:47:48 -060048
49Repeat this, to make sure we can mark the image as OK, and that a
50revert doesn't happen:
51
52 $ make flash_hello1
53 $ make flash_hello2
54
David Brown1d3f67d2017-09-14 15:10:24 -060055We should have just booted the hello2. Mark this as OK:
David Brownd2fcc212017-09-11 14:47:48 -060056
57 $ pyocd-flashtool -a 0x7ffe8 image_ok.bin
58 $ pyocd-tool reset
59
David Brown1d3f67d2017-09-14 15:10:24 -060060And make sure this stays in the "hello2" image.
David Brownd2fcc212017-09-11 14:47:48 -060061
David Brown1d3f67d2017-09-14 15:10:24 -060062This step doesn't make sense on the tests where the upgrade doesn't
63happen.
David Brownd2fcc212017-09-11 14:47:48 -060064
David Brown1d3f67d2017-09-14 15:10:24 -060065## Testing all configurations
David Brownd2fcc212017-09-11 14:47:48 -060066
David Brown1d3f67d2017-09-14 15:10:24 -060067Repeat these steps for each of the `test-*` targest in the Makefile.