From 04acc6459ed618a89b8344092705911e1834e609 Mon Sep 17 00:00:00 2001 From: pennam Date: Thu, 24 Mar 2022 18:12:41 +0100 Subject: [PATCH 1/3] Add script to generate release artifacts --- generate_rel.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 generate_rel.sh diff --git a/generate_rel.sh b/generate_rel.sh new file mode 100755 index 0000000..0fe9913 --- /dev/null +++ b/generate_rel.sh @@ -0,0 +1,42 @@ +#!/bin/bash +rm -rf release + +mbed compile -c -m PORTENTA_H7_M7 -t GCC_ARM --app=mbed_app_bootutil.json +echo +echo Generating bootutil library +find ./BUILD/PORTENTA_H7_M7/GCC_ARM/ \( -name "FileBlockDevice.o" -o -name "BSP.o" -o -name "SDMMCBlockDevice.o" -o -name "target.o" -o -name "rtc.o" -o -name "default_bd.o" -o -name "bootutil_extra.o" -o -name "flash_map_backend.o" -o -name "bootutil_public.o" \) | xargs arm-none-eabi-ar -csr libbootutil.a +echo -n "Library: " +find ./ -name "libbootutil.a" + +echo +echo Generating binaries for PORTENTA H7 +mbed compile -c -m PORTENTA_H7_M7 -t GCC_ARM --profile=release --profile mbed-os/tools/profiles/extensions/lto.json -N mcuboot_portenta_h7 +mkdir -p release/PORTENTA_H7 +cp ./libbootutil.a ./release/PORTENTA_H7 +cp ./BUILD/PORTENTA_H7_M7/GCC_ARM-RELEASE/mcuboot_portenta_h7.bin ./release/PORTENTA_H7/mcuboot_portenta_h7.bin +cp ./BUILD/PORTENTA_H7_M7/GCC_ARM-RELEASE/mcuboot_portenta_h7_application.elf ./release/PORTENTA_H7/mcuboot_portenta_h7.elf +xxd -i ./release/PORTENTA_H7/mcuboot_portenta_h7.bin > ./release/PORTENTA_H7/mcuboot_portenta_h7.h +sed -i "s/unsigned char __release_PORTENTA_H7_mcuboot_portenta_h7_bin/const unsigned char mcuboot_portenta_h7_bin/" ./release/PORTENTA_H7/mcuboot_portenta_h7.h +sed -i "s/__release_PORTENTA_H7_mcuboot_portenta_h7_bin_len/mcuboot_portenta_h7_bin_len/" ./release/PORTENTA_H7/mcuboot_portenta_h7.h + +echo +echo Generating binaries for PORTENTA H7 Lite +mbed compile -c -m PORTENTA_H7_M7 -t GCC_ARM --profile=release --profile mbed-os/tools/profiles/extensions/lto.json -DBOARD_HAS_VIDEO=0 -DBOARD_HAS_WIFI=0 -N mcuboot_portenta_h7_lite +mkdir -p release/PORTENTA_H7_Lite +cp ./libbootutil.a ./release/PORTENTA_H7_Lite +cp ./BUILD/PORTENTA_H7_M7/GCC_ARM-RELEASE/mcuboot_portenta_h7_lite.bin ./release/PORTENTA_H7_Lite/mcuboot_portenta_h7_lite.bin +cp ./BUILD/PORTENTA_H7_M7/GCC_ARM-RELEASE/mcuboot_portenta_h7_lite_application.elf ./release/PORTENTA_H7_Lite/mcuboot_portenta_h7_lite.elf +xxd -i ./release/PORTENTA_H7_Lite/mcuboot_portenta_h7_lite.bin > ./release/PORTENTA_H7_Lite/mcuboot_portenta_h7_lite.h +sed -i "s/unsigned char __release_PORTENTA_H7_mcuboot_portenta_h7_lite_bin/const unsigned char mcuboot_portenta_h7_lite_bin/" ./release/PORTENTA_H7_Lite/mcuboot_portenta_h7_lite.h +sed -i "s/__release_PORTENTA_H7_mcuboot_portenta_h7_lite_bin_len/mcuboot_portenta_h7_lite_bin_len/" ./release/PORTENTA_H7_Lite/mcuboot_portenta_h7_lite.h + +echo +echo Generating binaries for PORTENTA H7 Lite Connected +mbed compile -c -m PORTENTA_H7_M7 -t GCC_ARM --profile=release --profile mbed-os/tools/profiles/extensions/lto.json -DBOARD_HAS_VIDEO=0 -N mcuboot_portenta_h7_lite_connected +mkdir -p release/PORTENTA_H7_Lite_Connected +mv ./libbootutil.a ./release/PORTENTA_H7_Lite_Connected +cp ./BUILD/PORTENTA_H7_M7/GCC_ARM-RELEASE/mcuboot_portenta_h7_lite_connected.bin ./release/PORTENTA_H7_Lite_Connected/mcuboot_portenta_h7_lite_connected.bin +cp ./BUILD/PORTENTA_H7_M7/GCC_ARM-RELEASE/mcuboot_portenta_h7_lite_connected_application.elf ./release/PORTENTA_H7_Lite_Connected/mcuboot_portenta_h7_lite_connected.elf +xxd -i ./release/PORTENTA_H7_Lite_Connected/mcuboot_portenta_h7_lite_connected.bin > ./release/PORTENTA_H7_Lite_Connected/mcuboot_portenta_h7_lite_connected.h +sed -i "s/unsigned char __release_PORTENTA_H7_mcuboot_portenta_h7_lite_connected_bin/const unsigned char mcuboot_portenta_h7_lite_connected_bin/" ./release/PORTENTA_H7_Lite_Connected/mcuboot_portenta_h7_lite_connected.h +sed -i "s/__release_PORTENTA_H7_mcuboot_portenta_h7_lite_connected_bin_len/mcuboot_portenta_h7_lite_connected_bin_len/" ./release/PORTENTA_H7_Lite_Connected/mcuboot_portenta_h7_lite_connected.h \ No newline at end of file From 50bfd302a19322e4af1e49fa6022e1d567fbf4b8 Mon Sep 17 00:00:00 2001 From: pennam Date: Thu, 7 Apr 2022 12:05:04 +0200 Subject: [PATCH 2/3] Add Portenta Lite and Lite Connected in supported boards list --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 531da22..b4c72e1 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,9 @@ MCUboot bootloader porting for Arduino [Mbed OS](https://os.mbed.com/docs/mbed-os/latest/introduction/index.html) based boards. The following boards are supported: - * [PORTENTA_H7](https://store.arduino.cc/products/portenta-h7) + * [Portenta H7](https://store.arduino.cc/products/portenta-h7) + * [Portenta H7 Lite](https://store.arduino.cc/products/portenta-h7-lite) + * [Portenta H7 Lite Connected]((https://store.arduino.cc/products/portenta-h7-lite)) ## :grey_question: What MCUboot provides secure boot for 32-bit microcontrollers. For a detailed description on what MCUboot does and how it works please read the [official documentaion](https://docs.mcuboot.com/). From d59bc95a46076bae7ec530640a0bcf2e057f33ab Mon Sep 17 00:00:00 2001 From: pennam Date: Thu, 7 Apr 2022 12:18:02 +0200 Subject: [PATCH 3/3] Add details about mbed compile flags for Portenta Lite and Lite Connected --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index b4c72e1..fa3b054 100644 --- a/README.md +++ b/README.md @@ -106,10 +106,13 @@ Bootloader ``` ### Build MCUboot from source +The following command will setup the mbed environment and clone the needed repositories before compile for Portenta H7. + ``` mbed config root . && mbed deploy mbed compile -m PORTENTA_H7_M7 -t GCC_ARM --profile=release --profile mbed-os/tools/profiles/extensions/lto.json ``` +Additional flags are needed for [Lite](generate_rel.sh#L24) and [Lite Connected](generate_rel.sh#L35) boards. ### Debug