This folder contains an example of MCUboot to be used on AppKits and DevKits containing Alif Ensemble E1-E7 along with example applications that can be loaded to demonstrate update functionality.
Example verification public key has been generated from the MCUboot default RSA2048 private key. NOTE! This key is NOT suitable for production as it's distributed publicly as example key for MCUboot!
This folder contains CMakeLists.txt for the project.
- Install and add to PATH:
- cmake 3.19 or above
- build tool (make/nmake)
- gcc-arm-none-eabi compiler (version 12.3 or above)
- Python 3
- Install the MCUboot imgtool requirements from libs/mcuboot/scripts/requirements.txt (
pip install -r libs/mcuboot/scripts/requirements.txt
) - Create build folder and enter it. (
mkdir build; cd build
) - Run cmake [path_to_this_folder]. (
cmake ..
) - Run compilation command (depends on the selected generator of cmake; by default make for Linux and nmake for Windows). (
make
) - The built elf-file, binary and map file will be generated in the bin directory under the build folder. Example applications are signed automatically.
Currently, this example supports only OVERWRITE and SWAP modes (see Bootloader design). Only supported storage is internal MRAM. Verification is supported with embedded key and enabled by default but encryption is not supported.
- Build the MCUboot application and example applications, see Building
- Write MCUboot application and the signed example application to internal MRAM using Alif Security Toolkit. See alif_mcuboot.json in this folder for reference.
With JLink debugger:
- Ensure JLink folder is in the path when running cmake.
- Run
make update
in the build directory. - Observe logs from UART2, the blinking led also changes to different color blink.
With other tools:
- Write [build_folder]/bin/alif-example-app-update_signed.bin into address 0x80020000 with any tool.
- Reboot the board/SoC.
- Observe logs from UART2, the blinking led also changes to different color blink.
- Use alif_mcuboot_with_update.json as Alif Security Toolkit atoc configuration file.
- Update is done automatically after Alif Security Toolkit completes writing the images and reboots the device.
INF: Image index: 0, Swap type: none << Internal MCUboot logging
Loading image, version 1.0.0 (build: 0) << Bootloader app prints, see bootloader_app/src/main.c
image size: 24736.
Example app running! << Example app print, see example_app/src/main.c
INF: Image index: 0, Swap type: perm << Internal MCUboot logging
INF: Image 0 upgrade secondary slot -> primary slot
INF: Erasing the primary slot
INF: Image 0 copying the secondary slot to the primary slot: 0xzx bytes
DBG: writing magic; fa_id=1 off=0xfff0 (0x8001fff0)
DBG: erasing secondary header
DBG: erasing secondary trailer
Loading image, version 2.0.0 (build: 0) << Bootloader app prints, see bootloader_app/src/main.c
image size: 24736.
Updated app running! << Example app print, see example_app/src/main.c
INF: Image index: 0, Swap type: none << Internal MCUboot logging
Loading image, version 2.0.0 (build: 0) << Bootloader app prints, see bootloader_app/src/main.c
image size: 24736.
Updated app running! << Example app print, see example_app/src/main.c