|
2 | 2 | wolfSSL Secure Bootloader |
3 | 3 |
|
4 | 4 | wolfBoot is a portable, OS-agnostic, secure bootloader solution for 32-bit microcontrollers, |
5 | | -relying on wolfCrypt for firmware authentication, and a modified version of |
6 | | -[mcuboot](https://www.mcuboot.com/)'s *bootutil* library to implement firmware upgrade mechanisms. |
| 5 | +relying on wolfCrypt for firmware authentication, providing firmware update mechanisms. |
7 | 6 |
|
8 | 7 | Due to the minimalist design of the bootloader and the tiny HAL API, wolfBoot is completely independent |
9 | 8 | from any OS or bare-metal application, and can be easily ported and integrated in existing embedded software |
10 | | -projects to provide a secure firmware upgrade mechanism. |
| 9 | +projects to provide a secure firmware update mechanism. |
11 | 10 |
|
12 | 11 |
|
13 | 12 | ## Features |
14 | 13 | - Multi-slot partitioning of the flash device |
15 | 14 | - Integrity verification of the firmware image(s) |
16 | 15 | - Authenticity verification of the firmware image(s) using wolfCrypt's Digital Signature Algorithms (DSA) |
17 | 16 | - Minimalist hardware abstraction layer (HAL) interface to facilitate portability across different vendors/MCUs |
| 17 | + - Copy/swap images from secondary slots into the primary slots to consent firmware update operations |
18 | 18 | - In-place chain-loading of the firmware image in the primary slot |
19 | | - - Copy/swap images from secondary slots into the primary slots to consent firmware upgrade operations |
20 | 19 |
|
21 | 20 | ## Components |
22 | 21 |
|
23 | 22 | This repository contains the following components: |
24 | | - - the bootloader |
| 23 | + - the wolfBoot bootloader |
25 | 24 | - Ed25519 key generator and image signing tools |
26 | 25 | - Baremetal test applications |
27 | 26 |
|
28 | | -### The bootloader |
| 27 | +### wolfBoot bootloader |
29 | 28 |
|
30 | | -The bootloader is a memory-safe standalone bare-metal application, designed to run on a generic 32bit MCU, |
31 | | -with no dynamic memory allocation mechanism or linkage to any standard C library. |
| 29 | +woldBoot is a memory-safe standalone bare-metal application, designed to run on a generic microcontroller, |
| 30 | +with no dynamic memory allocation mechanism or linkage to any standard C library. |
32 | 31 |
|
33 | | -The core application depends on the following libraries: |
| 32 | +The bootloader consists of the following components: |
34 | 33 | - wolfCrypt, which is used to verify the Ed25519 signature of the images |
35 | | - - A modified version of mcuboot's bootutil, to handle the firmware image slots and the upgrade state-machine |
36 | 34 | - A minimalist Hardware Abstraction Layer, with an implementation provided for the supported target, which is in charge for IAP flash access and clock setting on the specific MCU |
| 35 | + - The core bootloader |
| 36 | + - A small application library used by the application to interact with the bootloader [src/libwolfboot.c](src/libwolfboot.c) |
37 | 37 |
|
38 | | -The goal of this application is to perform image verification and/or requested firmware upgrade tasks |
39 | | -before chain-loading the actual firmware from a specific location in flash. |
40 | | - |
41 | | -Only ARM Cortex-M is supported at this stage. Support for more architectures and |
42 | | -microcontrollers will be added later. |
| 38 | +Only ARM Cortex-M boot mechanism is supported at this stage. Support for more architectures and |
| 39 | +microcontrollers will be added later. Relocating the interrupt vector can be disabled if needed. |
43 | 40 |
|
44 | 41 | ## Integrating wolfBoot in an existing project |
45 | 42 |
|
46 | | -Requirements: |
| 43 | +### Required steps |
47 | 44 |
|
48 | 45 | - Provide a HAL implementation for the target platform (see [Hardware Abstraction Layer](docs/HAL.md)) |
49 | 46 | - Decide a flash partition strategy and modify `include/target.h` accordingly (see [Flash partitions](docs/flash_partitions.md)) |
| 47 | + - Change the entry point of the firmware image to account for bootloader presence |
| 48 | + - Equip the application with the [wolfBoot library](docs/API.md) to interact with the bootloader |
| 49 | + |
| 50 | +### Examples provided |
50 | 51 |
|
51 | 52 | The following steps are automated in the default `Makefile` target, using the baremetal test |
52 | | -application as an example to create the factory image: |
| 53 | +application as an example to create the factory image. By running `make`, the build system will: |
53 | 54 |
|
54 | 55 | - Create a Ed25519 Key-pair using the `ed25519_keygen` tool |
55 | 56 | - Compile the bootloader. The public key generated in the step above is included in the build |
56 | | - - Compile the firmware image |
| 57 | + - Compile the firmware image from the test application in [test\_app](test-app/) |
57 | 58 | - Re-link the firmware to change the entry-point to the start address of the primary partition |
58 | 59 | - Sign the firmware image using the `ed25519_sign` tool |
59 | 60 | - Create a factory image by concatenating the bootloader and the firmware image |
60 | | - - Flash the factory image to the target |
| 61 | + |
| 62 | +The factory image can be flashed to the target device. It contains the bootloader and the signed initial |
| 63 | +firmware at the specified address on the flash. |
| 64 | + |
| 65 | +The `ed25519_sign` tool transforms a bootable firmware image to comply with the firmware image format required by the bootloader. |
61 | 66 |
|
62 | 67 | For more detailed information about the firmware image format, see [Firmware image](docs/firmware_image.md) |
63 | 68 |
|
64 | | -## Upgrading the firmware |
| 69 | +### Upgrading the firmware |
65 | 70 |
|
66 | 71 | - Compile the new firmware image, and link it so that its entry point is at the start address of the primary partition |
67 | 72 | - Sign the firmware using the `ed25519_sign` tool and the private key generated for the factory image |
68 | 73 | - Transfer the image using a secure connection, and store it to the secondary firmware slot |
69 | | - - Trigger the image swap using bootutil's `boot_set_pending()` function |
| 74 | + - Trigger the image swap using libwolfboot `wolfBoot_update()` function. See [wolfBoot library API](docs/API.md) for a description of the operation |
70 | 75 | - Reboot to let the bootloader begin the image swap |
| 76 | + - Confirm the success of the update using libwolfboot `wolfBoot_success()` function. See [wolfBoot library API](docs/API.md) for a description of the operation |
71 | 77 |
|
72 | | -For more detailed information about firmware upgrade procedures, see [Firmware Upgrade](docs/firmware_upgrade.md) |
| 78 | +For more detailed information about firmware update implementation, see [Firmware Update](docs/firmware_update.md) |
73 | 79 |
|
0 commit comments