2017-09-12 04:47:48 +08:00
|
|
|
# Zephyr Test Plan
|
2017-07-28 00:40:42 +08:00
|
|
|
|
|
|
|
The following roughly describes how mcuboot is tested on Zephyr. The
|
2017-09-12 04:47:48 +08:00
|
|
|
testing is done with the code in `samples/zephyr`. These examples
|
2017-07-28 00:40:42 +08:00
|
|
|
were written using the FRDM-K64F, but other boards should be similar.
|
|
|
|
At this time, however, the partitions are hardcoded in the Makefile
|
|
|
|
targets to flash.
|
|
|
|
|
2017-11-15 09:22:03 +08:00
|
|
|
Note that the script "run-tests.sh" in that directory is helpful for
|
|
|
|
automating the process, and provides simple "y or n" prompts for each
|
|
|
|
test case and expected result.
|
|
|
|
|
2017-09-15 05:10:24 +08:00
|
|
|
## Building and running.
|
2017-07-28 00:40:42 +08:00
|
|
|
|
2017-09-15 05:10:24 +08:00
|
|
|
The tests are build using the various `test-*` targets in
|
|
|
|
`samples/zephyr/Makefile`. For each test, invoke `make` with that
|
|
|
|
target:
|
2017-07-28 00:40:42 +08:00
|
|
|
|
2017-09-15 05:10:24 +08:00
|
|
|
$ make test-good-rsa
|
2017-07-28 00:40:42 +08:00
|
|
|
|
2017-09-15 05:10:24 +08:00
|
|
|
Begin by doing a full erase, and programming the bootloader itself:
|
2017-07-28 00:40:42 +08:00
|
|
|
|
2019-02-19 07:20:00 +08:00
|
|
|
$ pyocd erase --chip
|
2017-07-28 00:40:42 +08:00
|
|
|
$ make flash_boot
|
|
|
|
|
|
|
|
After it resets, look for "main: Starting bootloader", a few debug
|
|
|
|
messages, and lastly: "main: Unable to find bootable image".
|
|
|
|
|
2017-09-12 04:47:48 +08:00
|
|
|
Then, load hello1:
|
2017-07-28 00:40:42 +08:00
|
|
|
|
|
|
|
$ make flash_hello1
|
|
|
|
|
|
|
|
This should print "main: Jumping to the first image slot", and you
|
2017-09-15 05:10:24 +08:00
|
|
|
should get an image "hello1".
|
2017-07-28 00:40:42 +08:00
|
|
|
|
2017-09-15 05:10:24 +08:00
|
|
|
Note that there are comments with each test target describing the
|
|
|
|
intended behavior for each of these steps. Sometimes an upgrade will
|
|
|
|
happen and sometimes it will not.
|
2017-07-28 00:40:42 +08:00
|
|
|
|
|
|
|
$ make flash_hello2
|
|
|
|
|
2017-09-12 04:47:48 +08:00
|
|
|
This should print a message: `boot_swap_type: Swap type: test`, and
|
2017-09-15 05:10:24 +08:00
|
|
|
you should see "hello2".
|
2017-07-28 00:40:42 +08:00
|
|
|
|
|
|
|
Now reset the target::
|
|
|
|
|
2019-02-19 07:20:00 +08:00
|
|
|
$ pyocd commander -c reset
|
2017-07-28 00:40:42 +08:00
|
|
|
|
2017-09-15 05:10:24 +08:00
|
|
|
And you should see a revert and "hello1" running.
|
|
|
|
|
|
|
|
## Testing that mark ok works
|
2017-07-28 00:40:42 +08:00
|
|
|
|
|
|
|
Repeat this, to make sure we can mark the image as OK, and that a
|
2017-09-12 04:47:48 +08:00
|
|
|
revert doesn't happen:
|
2017-07-28 00:40:42 +08:00
|
|
|
|
|
|
|
$ make flash_hello1
|
|
|
|
$ make flash_hello2
|
|
|
|
|
2017-09-15 05:10:24 +08:00
|
|
|
We should have just booted the hello2. Mark this as OK:
|
2017-07-28 00:40:42 +08:00
|
|
|
|
2019-02-19 07:20:00 +08:00
|
|
|
$ pyocd flash -a 0x7ffe8 image_ok.bin
|
|
|
|
$ pyocd commander -c reset
|
2017-07-28 00:40:42 +08:00
|
|
|
|
2017-09-15 05:10:24 +08:00
|
|
|
And make sure this stays in the "hello2" image.
|
2017-07-28 00:40:42 +08:00
|
|
|
|
2017-09-15 05:10:24 +08:00
|
|
|
This step doesn't make sense on the tests where the upgrade doesn't
|
|
|
|
happen.
|
2017-09-12 04:47:48 +08:00
|
|
|
|
2017-09-15 05:10:24 +08:00
|
|
|
## Testing all configurations
|
2017-09-12 04:47:48 +08:00
|
|
|
|
2017-09-15 05:10:24 +08:00
|
|
|
Repeat these steps for each of the `test-*` targest in the Makefile.
|