Skip to content

Commit f257c14

Browse files
Add MCUboot support and configuration for application signing
1 parent 804381b commit f257c14

5 files changed

Lines changed: 43 additions & 1 deletion

File tree

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,26 @@ west build -b esp32s3_devkitc/esp32s3/procpu OpenAstroFocuser/app
108108
west flash
109109
```
110110

111+
#### MCUboot (sysbuild)
112+
113+
To build MCUboot alongside the app and produce a signed application image:
114+
115+
```shell
116+
west build -p -b esp32s3_devkitc/esp32s3/procpu OpenAstroFocuser/app --sysbuild
117+
```
118+
119+
Flash MCUboot first, then the application image:
120+
121+
```shell
122+
west flash -d build/mcuboot
123+
west flash -d build/app
124+
```
125+
126+
Notes:
127+
128+
- The signed application artifact is `build/app/zephyr/zephyr.signed.bin`.
129+
- This repo uses MCUboot's default test key for development; replace it for production.
130+
111131
Pass `-DEXTRA_CONF_FILE=debug.conf` for verbose logging or switch `-b` to any supported board/overlay.
112132

113133
### Run Moonlite Parser Tests

app/prj.conf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ CONFIG_STD_CPP20=y
77
CONFIG_GLIBCXX_LIBCPP=y
88
CONFIG_MOONLITE=y
99

10+
# Build as an MCUboot-chainloaded image and sign it.
11+
CONFIG_BOOTLOADER_MCUBOOT=y
12+
# ESP32 defaults to unsigned images when MCUboot is enabled; override so signing runs.
13+
CONFIG_MCUBOOT_GENERATE_UNSIGNED_IMAGE=n
14+
CONFIG_MCUBOOT_SIGNATURE_KEY_FILE="bootloader/mcuboot/root-rsa-2048.pem"
15+
1016
# Provide heap storage for std::string and other dynamic allocations.
1117
CONFIG_HEAP_MEM_POOL_SIZE=4096
1218

app/sysbuild.conf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Sysbuild configuration for OpenAstroFocuser
2+
#
3+
# Builds MCUboot alongside the application and signs the application image so
4+
# it can be chain-loaded by MCUboot.
5+
6+
SB_CONFIG_BOOTLOADER_MCUBOOT=y
7+
8+
# ESP32* MCUboot configs default to no signatures; override to RSA.
9+
SB_CONFIG_BOOT_SIGNATURE_TYPE_RSA=y
10+
11+
# By default, sysbuild will use the MCUboot test key shipped with the
12+
# MCUboot module when RSA is selected.
13+
# For production, set SB_CONFIG_BOOT_SIGNATURE_KEY_FILE to an absolute path
14+
# to your own PEM key.

lib/moonlite/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
config MOONLITE
44
bool "Moonlite serial protocol helpers"
5-
default y
5+
default n
66
help
77
Enable the Moonlite focuser serial protocol helper library, which
88
provides the command parser, command enumeration, and handler interface

west.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,5 @@ manifest:
2424
- cmsis_6 # required by the ARM port for Cortex-M
2525
- hal_nordic # required by the custom_plank board (Nordic based)
2626
- hal_espressif # required by the esp32_devkitc_procpu board (Espressif based)
27+
- mbedtls # required for MCUboot RSA signature verification
28+
- mcuboot # MCUboot bootloader module

0 commit comments

Comments
 (0)