|
36 | 36 | 11. Given corrupted active firmware, does not boot into firmware.
|
37 | 37 | 12. Given corrupted active firmware, valid firmware candidate of older version, always perform update.
|
38 | 38 |
|
39 |
| -### Overall size (< 32K) |
| 39 | +### Overall size |
40 | 40 |
|
41 | 41 | 13. Test that the compiled binary does not exeed 32K limit
|
42 | 42 |
|
|
71 | 71 |
|
72 | 72 | - SOTP
|
73 | 73 | - Insecure Example RoT
|
| 74 | + |
| 75 | +### Firmware Header Location options |
| 76 | + |
| 77 | +- Contiguous with active application region |
| 78 | +- In a separate erase sector |
| 79 | + |
| 80 | +### Design of Testing Infrastructure |
| 81 | + |
| 82 | +Write mbed-bootloader-cliapp which abstracts ARM_UC_PAAL layer into python API. Using [mbed-clitest](https://github.com/ARMmbed/mbed-clitest) we will have the following capability: |
| 83 | +- inject firmware candidate onto the device regardless of the storage type |
| 84 | +- Specify the slot, version, hash of each candidate |
| 85 | +- Pass any firmware blob from the host side |
| 86 | +- Get current active firmware version and hash |
| 87 | + |
| 88 | +In addition, the following custom functionality should also be implemented: |
| 89 | +- Reboot device |
| 90 | + |
| 91 | +The mbed-bootloader-cliapp should track the dependencies and build options in mbed-cloud-client as close as possible. |
| 92 | + |
| 93 | +This will cover the following testcases: |
| 94 | +- [Firmware update](#firmware-update) |
| 95 | +- [Rollback protection](#rollback-protection) |
| 96 | +- [Multiple candidates](#multiple-candidates) |
| 97 | +- [Integrity check of firmware candidates](#integrity-check-of-firmware-candidates) |
| 98 | +- [Integrity check of active firmware](#integrity-check-of-active-firmware) |
| 99 | +- [Successful update](#successful-update) |
| 100 | +- [Forward to Application](#forward-to-application) |
| 101 | + |
| 102 | +Component Diagram |
| 103 | +``` |
| 104 | + +------------------------+ |
| 105 | + | host side: clitest | |
| 106 | + +------------------------+ |
| 107 | + | serial link |
| 108 | ++----------+ +------------------------+ |
| 109 | +|bootloader| | mbed-bootloader-cliapp | |
| 110 | ++----------+ +------------------------+ |
| 111 | ++-------------------------------------+ |
| 112 | +|Update Client PAAL API | |
| 113 | ++-------------------------------------+ |
| 114 | ++-------------------------------------+ |
| 115 | +|Physical Storage | |
| 116 | ++-------------------------------------+ |
| 117 | +``` |
| 118 | + |
| 119 | +mbed-bootloader-cliapp Flow |
| 120 | + |
| 121 | +1. Build mbed-bootloader |
| 122 | +1. Build mbed-bootloader-cliapp with the same RoT and PAAL options |
| 123 | +1. Combine bootloader with mbed-bootloader-cliapp with approperate headers |
| 124 | +1. Run Clitest on host side, it will detect mbed-bootloader-cliapp booting up successfully |
| 125 | +1. Run python clittest test case which sets up a number of firmware candidates |
| 126 | +1. python test case calls reboot, bootloader performs update |
| 127 | +1. host side keeps monitoring the serial output to confirm the bootloader is behaving as expected |
| 128 | + |
| 129 | +For the following test cases, the flow need to be adapted: |
| 130 | +- [Rollback protection](#rollback-protection) |
| 131 | + - Inject firmware using a old time stamp in testapp |
| 132 | +- [Integrity check of firmware candidates](#integrity-check-of-firmware-candidates) |
| 133 | + - Inject firmware blob that is tampered and does not match with hash |
| 134 | +- [Integrity check of active firmware](#integrity-check-of-active-firmware) |
| 135 | + - Tamper with the combined binary before flashing to device |
| 136 | + |
| 137 | +[Power Cut](#power-cut) can continue to be performed using the current mbedgt infrastructure. |
| 138 | + |
| 139 | +[Overall size](#overall-size) Can be checked as a Jenkins step |
| 140 | + |
| 141 | +[Integrity check of active firmware](#integrity-check-of-active-firmware) Need to tamper with combined firmware using custom script before flashing to device. Need custom script to monitor serial output to determine the bootloader have done the right thing. Or instrument the bootloader source code with mbedgt and make sure the bootloader goes into the right state. |
| 142 | + |
| 143 | +Notes: |
| 144 | +- Bootloader binaries can be built as a first step in Jenkins for all possible configurations |
| 145 | +- Cli testapp can live in https://github.com/ARMmbed/mbed-bootloader-tests. Using the mbed-os TEST folder structure, multiple binaries can be built with one repo. Hence there should be at least the bootlaoder-cliapp and a dummy firmware candidate. The dummy firmware candidate may implement functions to get active hash. |
| 146 | +- Tests can be run in parallel on raas so as to not impact the testing time. |
0 commit comments