David Brown | d2fcc21 | 2017-09-11 14:47:48 -0600 | [diff] [blame] | 1 | # Zephyr Test Plan |
| 2 | |
| 3 | The following roughly describes how mcuboot is tested on Zephyr. The |
| 4 | testing is done with the code in `samples/zephyr`. These examples |
| 5 | were written using the FRDM-K64F, but other boards should be similar. |
| 6 | At this time, however, the partitions are hardcoded in the Makefile |
| 7 | targets to flash. |
| 8 | |
David Brown | 1d3f67d | 2017-09-14 15:10:24 -0600 | [diff] [blame] | 9 | ## Building and running. |
David Brown | d2fcc21 | 2017-09-11 14:47:48 -0600 | [diff] [blame] | 10 | |
David Brown | 1d3f67d | 2017-09-14 15:10:24 -0600 | [diff] [blame] | 11 | The tests are build using the various `test-*` targets in |
| 12 | `samples/zephyr/Makefile`. For each test, invoke `make` with that |
| 13 | target: |
David Brown | d2fcc21 | 2017-09-11 14:47:48 -0600 | [diff] [blame] | 14 | |
David Brown | 1d3f67d | 2017-09-14 15:10:24 -0600 | [diff] [blame] | 15 | $ make test-good-rsa |
David Brown | d2fcc21 | 2017-09-11 14:47:48 -0600 | [diff] [blame] | 16 | |
David Brown | 1d3f67d | 2017-09-14 15:10:24 -0600 | [diff] [blame] | 17 | Begin by doing a full erase, and programming the bootloader itself: |
David Brown | d2fcc21 | 2017-09-11 14:47:48 -0600 | [diff] [blame] | 18 | |
| 19 | $ pyocd-flashtool -ce |
| 20 | $ make flash_boot |
| 21 | |
| 22 | After it resets, look for "main: Starting bootloader", a few debug |
| 23 | messages, and lastly: "main: Unable to find bootable image". |
| 24 | |
| 25 | Then, load hello1: |
| 26 | |
| 27 | $ make flash_hello1 |
| 28 | |
| 29 | This should print "main: Jumping to the first image slot", and you |
David Brown | 1d3f67d | 2017-09-14 15:10:24 -0600 | [diff] [blame] | 30 | should get an image "hello1". |
David Brown | d2fcc21 | 2017-09-11 14:47:48 -0600 | [diff] [blame] | 31 | |
David Brown | 1d3f67d | 2017-09-14 15:10:24 -0600 | [diff] [blame] | 32 | Note that there are comments with each test target describing the |
| 33 | intended behavior for each of these steps. Sometimes an upgrade will |
| 34 | happen and sometimes it will not. |
David Brown | d2fcc21 | 2017-09-11 14:47:48 -0600 | [diff] [blame] | 35 | |
David Brown | d2fcc21 | 2017-09-11 14:47:48 -0600 | [diff] [blame] | 36 | $ make flash_hello2 |
| 37 | |
| 38 | This should print a message: `boot_swap_type: Swap type: test`, and |
David Brown | 1d3f67d | 2017-09-14 15:10:24 -0600 | [diff] [blame] | 39 | you should see "hello2". |
David Brown | d2fcc21 | 2017-09-11 14:47:48 -0600 | [diff] [blame] | 40 | |
| 41 | Now reset the target:: |
| 42 | |
| 43 | $ pyocd-tool reset |
| 44 | |
David Brown | 1d3f67d | 2017-09-14 15:10:24 -0600 | [diff] [blame] | 45 | And you should see a revert and "hello1" running. |
| 46 | |
| 47 | ## Testing that mark ok works |
David Brown | d2fcc21 | 2017-09-11 14:47:48 -0600 | [diff] [blame] | 48 | |
| 49 | Repeat this, to make sure we can mark the image as OK, and that a |
| 50 | revert doesn't happen: |
| 51 | |
| 52 | $ make flash_hello1 |
| 53 | $ make flash_hello2 |
| 54 | |
David Brown | 1d3f67d | 2017-09-14 15:10:24 -0600 | [diff] [blame] | 55 | We should have just booted the hello2. Mark this as OK: |
David Brown | d2fcc21 | 2017-09-11 14:47:48 -0600 | [diff] [blame] | 56 | |
| 57 | $ pyocd-flashtool -a 0x7ffe8 image_ok.bin |
| 58 | $ pyocd-tool reset |
| 59 | |
David Brown | 1d3f67d | 2017-09-14 15:10:24 -0600 | [diff] [blame] | 60 | And make sure this stays in the "hello2" image. |
David Brown | d2fcc21 | 2017-09-11 14:47:48 -0600 | [diff] [blame] | 61 | |
David Brown | 1d3f67d | 2017-09-14 15:10:24 -0600 | [diff] [blame] | 62 | This step doesn't make sense on the tests where the upgrade doesn't |
| 63 | happen. |
David Brown | d2fcc21 | 2017-09-11 14:47:48 -0600 | [diff] [blame] | 64 | |
David Brown | 1d3f67d | 2017-09-14 15:10:24 -0600 | [diff] [blame] | 65 | ## Testing all configurations |
David Brown | d2fcc21 | 2017-09-11 14:47:48 -0600 | [diff] [blame] | 66 | |
David Brown | 1d3f67d | 2017-09-14 15:10:24 -0600 | [diff] [blame] | 67 | Repeat these steps for each of the `test-*` targest in the Makefile. |