Carles Cufi | ecc34bb | 2018-01-22 18:02:46 +0100 | [diff] [blame] | 1 | # Building and using MCUboot with RIOT |
| 2 | |
| 3 | MCUboot began its life as the bootloader for Mynewt. It has since |
| 4 | acquired the ability to be used as a bootloader for RIOT as well. |
| 5 | Currently the support is limited to the nrf52dk platform. |
| 6 | |
| 7 | ## Building the bootloader itself |
| 8 | |
| 9 | In this first version, a prebuilt Mynewt binary is downloaded at |
| 10 | compile time. This binary was compiled to do an integrity check, but |
| 11 | not a signature check. In order to configure the bootloader for |
| 12 | signature check it is necessary to re-compile it either with Mynewt |
| 13 | or Zephyr, following the provided instructions. |
| 14 | |
| 15 | In the next version, it is planned to compile MCUboot using RIOT, |
| 16 | which should be able to boot any of the supported OS images. |
| 17 | |
Francesco Servidio | 5bc9832 | 2021-11-03 13:19:22 +0100 | [diff] [blame] | 18 | ## Building applications for the bootloader |
Carles Cufi | ecc34bb | 2018-01-22 18:02:46 +0100 | [diff] [blame] | 19 | |
| 20 | A compatible MCUboot image can be compiled by typing: `make mcuboot`. |
| 21 | |
| 22 | The only variable which needs to be set is `IMAGE_VERSION` loaded |
| 23 | with a valid formatted value. The format is `major.minor.patch+other` |
| 24 | (e.g. `export IMAGE_VERSION= 1.1.1+1`. This variable can be either |
| 25 | exported in the Makefile or manually, prior to the compilation process. |
| 26 | |
| 27 | The goal is to produce an ELF file which is linked to be flashed at a |
| 28 | `BOOTLOADER_OFFSET` offset rather than the beginning of ROM. MCUboot |
| 29 | also expects an image padded with some specific headers containing the |
| 30 | version information, and trailer type-length-value records (TLVs) with |
| 31 | hash and signing information. This is done through the imgtool.py |
| 32 | application, which is executed automatically by the RIOT build system. |
| 33 | |
| 34 | ### Signing the application |
| 35 | |
| 36 | The application will be automatically signed with the provided key. |
| 37 | If no key is provided, a new key will be automatically generated. The |
| 38 | default key type is RSA-2048. |
| 39 | |
| 40 | In order to use your provided key, you need to recompile the bootloader |
| 41 | using you public key, either in Zephyr or Mynewt by following the |
| 42 | provided procedure for the selected OS. |
| 43 | |
| 44 | ### Flashing the application |
| 45 | |
| 46 | The application can be flashed by typing: `make flash-mcuboot`. |
| 47 | This will flash both the bootloader and the application. |