Skip to content

Add dedicated mbed_app file for each board #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Nov 28, 2022
35 changes: 20 additions & 15 deletions generate_rel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,63 +2,68 @@
rm -rf release
rm -rf BUILD

if [[ $1 == "library" ]] || [[ $1 == "all" ]]; then
mbed compile -c -m PORTENTA_H7_M7 -t GCC_ARM --app=mbed_app_bootutil.json -DBOOTUTIL_LIBARY_BUILD=1
mbed compile -c -m PORTENTA_H7_M7 -t GCC_ARM --app=mbed_app_bootutil.json

set -e

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 "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"
fi

if [[ $1 == "portenta" ]] || [[ $1 == "all" ]]; then
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
mbed compile -c -m PORTENTA_H7_M7 -t GCC_ARM --app=mbed_app_portenta.json --profile=custom.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
cp ./BUILD/PORTENTA_H7_M7/GCC_ARM-CUSTOM/mcuboot_portenta_h7.bin ./release/PORTENTA_H7/mcuboot_portenta_h7.bin
cp ./BUILD/PORTENTA_H7_M7/GCC_ARM-CUSTOM/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
tar -czvf ./release/PORTENTA_H7.tar.gz -C ./release/ PORTENTA_H7
fi

if [[ $1 == "lite" ]] || [[ $1 == "all" ]]; then
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
mbed compile -c -m PORTENTA_H7_M7 -t GCC_ARM --app=mbed_app_portenta_lite.json --profile=custom.json -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
cp ./BUILD/PORTENTA_H7_M7/GCC_ARM-CUSTOM/mcuboot_portenta_h7_lite.bin ./release/PORTENTA_H7_Lite/mcuboot_portenta_h7_lite.bin
cp ./BUILD/PORTENTA_H7_M7/GCC_ARM-CUSTOM/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
tar -czvf ./release/PORTENTA_H7_Lite.tar.gz -C ./release/ PORTENTA_H7_Lite
fi

if [[ $1 == "connected" ]] || [[ $1 == "all" ]]; then
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
mbed compile -c -m PORTENTA_H7_M7 -t GCC_ARM --app=mbed_app_portenta_lite_connected.json --profile=custom.json -N mcuboot_portenta_h7_lite_connected
mkdir -p release/PORTENTA_H7_Lite_Connected
cp ./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
cp ./BUILD/PORTENTA_H7_M7/GCC_ARM-CUSTOM/mcuboot_portenta_h7_lite_connected.bin ./release/PORTENTA_H7_Lite_Connected/mcuboot_portenta_h7_lite_connected.bin
cp ./BUILD/PORTENTA_H7_M7/GCC_ARM-CUSTOM/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
tar -czvf ./release/PORTENTA_H7_Lite_Connected.tar.gz -C ./release/ PORTENTA_H7_Lite_Connected
fi

if [[ $1 == "nicla" ]] || [[ $1 == "all" ]]; then
echo
echo Generating binaries for NICLA VISION
mbed compile -c -m NICLA_VISION -t GCC_ARM --profile=release --profile mbed-os/tools/profiles/extensions/lto.json -DBOARD_RAM_SIZE=0 -N mcuboot_nicla_vision
mbed compile -c -m NICLA_VISION -t GCC_ARM --app=mbed_app_nicla_vision.json --profile=custom.json -N mcuboot_nicla_vision
mkdir -p release/NICLA_VISION
mv ./libbootutil.a ./release/NICLA_VISION
cp ./BUILD/NICLA_VISION/GCC_ARM-RELEASE/mcuboot_nicla_vision.bin ./release/NICLA_VISION/mcuboot_nicla_vision.bin
cp ./BUILD/NICLA_VISION/GCC_ARM-RELEASE/mcuboot_nicla_vision_application.elf ./release/NICLA_VISION/mcuboot_nicla_vision.elf
cp ./BUILD/NICLA_VISION/GCC_ARM-CUSTOM/mcuboot_nicla_vision.bin ./release/NICLA_VISION/mcuboot_nicla_vision.bin
cp ./BUILD/NICLA_VISION/GCC_ARM-CUSTOM/mcuboot_nicla_vision_application.elf ./release/NICLA_VISION/mcuboot_nicla_vision.elf
xxd -i ./release/NICLA_VISION/mcuboot_nicla_vision.bin > ./release/NICLA_VISION/mcuboot_nicla_vision.h
sed -i "s/unsigned char __release_NICLA_VISION_mcuboot_nicla_vision_bin/const unsigned char mcuboot_nicla_vision_bin/" ./release/NICLA_VISION/mcuboot_nicla_vision.h
sed -i "s/__release_NICLA_VISION_mcuboot_nicla_vision_bin_len/mcuboot_nicla_vision_bin_len/" ./release/NICLA_VISION/mcuboot_nicla_vision.h
tar -czvf ./release/NICLA_VISION.tar.gz -C ./release/ NICLA_VISION
fi
120 changes: 74 additions & 46 deletions mbed_app.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
{
"requires": ["bare-metal", "mbedtls", "mcuboot", "flashiap-block-device", "spif-driver", "qspif", "mbed-trace", "filesystem", "fat_chan", "littlefs", "rtos", "cmsis-cmsis5-rtos2", "events"],
"macros": ["MBED_FAULT_HANDLER_DISABLED", "USE_USB_HS", "LOWSPEED=1", "MBEDTLS_USER_CONFIG_FILE=\"mbedtls_config.h\""],
"requires": [
"bare-metal",
"mbedtls",
"mcuboot",
"flashiap-block-device",
"spif-driver",
"qspif",
"mbed-trace",
"filesystem",
"fat_chan",
"littlefs",
"rtos",
"cmsis-cmsis5-rtos2",
"events"
],
"macros": [
"MBED_FAULT_HANDLER_DISABLED",
"MBEDTLS_USER_CONFIG_FILE=\"mbedtls_config.h\""
],
"config": {
"serial-bootloader-enable": {
"help": "Build bootloader with serial update support",
Expand All @@ -11,26 +28,40 @@
"*": {
"target.restrict_size": "0x20000",
"target.c_lib": "small",
"mcuboot.log-level": "MCUBOOT_LOG_LEVEL_INFO",
"mbed-trace.enable": false,
"mbed-trace.fea-ipv6": false
},
"PORTENTA_H7_M7": {
"target.clock_source": "USE_PLL_HSE_EXTC",
"target.use-mpu": false,
"target.components_remove" : ["WHD", "4343W_FS", "CYW43XXX"],
"target.extra_labels_remove" : ["CORDIO"],
"target.features_remove" : ["BLE"],
"target.device_has_remove": ["USBDEVICE", "EMAC", "CAN", "SPI_ASYNCH", "SPISLAVE", "SPI","SERIAL_FC", "PWMOUT", "ANALOGIN", "ANALOGOUT", "I2CSLAVE", "I2C_ASYNC", "OSPI", "TRNG", "DAC", "CRC", "WATCHDOG", "RTC", "LPTICKER", "SLEEP"],
"target.printf_lib": "minimal-printf",
"target.i2c_timing_value_algo": false,
"target.extra_labels_remove" : ["CORDIO"],
"target.features_remove" : ["BLE"],
"target.device_has_remove": [
"USBDEVICE",
"EMAC",
"CAN",
"SPI_ASYNCH",
"SPISLAVE",
"SPI",
"SERIAL_FC",
"PWMOUT",
"ANALOGIN",
"ANALOGOUT",
"I2CSLAVE",
"I2C_ASYNC",
"OSPI",
"TRNG",
"DAC",
"CRC",
"WATCHDOG",
"RTC",
"LPTICKER",
"SLEEP"
],
"platform.minimal-printf-enable-floating-point": false,
"platform.minimal-printf-enable-64-bit": false,
"platform.stdio-flush-at-exit": false,
"platform.stdio-baud-rate": 115200,
"fat_chan.ff_use_mkfs": 0,
"fat_chan.ff_use_lfn": 0,
"fat_chan.ff_fs_rpath": 0,
"mcuboot.log-level": "MCUBOOT_LOG_LEVEL_INFO",
"mcuboot.primary-slot-address": "0x8020000",
"mcuboot.slot-size": "0x1E0000",
"mcuboot.scratch-address": "0x9000000",
Expand All @@ -40,49 +71,46 @@
"mcuboot.bootstrap": true,
"mcuboot.application-hooks": true,
"mcuboot.application-littlefs": true,
"mcuboot.application-sdcard": true,
"mcuboot.application-dfu": true,
"mcuboot.signature-algorithm": "SIGNATURE_TYPE_EC256",
"mcuboot.encrypt-ec256": true,
"mcuboot.include-keys": null,
"mcuboot.bootloader-build": false,
"mcuboot.encrypt-scratch": true,
"mcuboot.swap-buf-size": 131072
"mcuboot.swap-buf-size": 131072,
"mbed-trace.enable": false,
"mbed-trace.fea-ipv6": false
},
"PORTENTA_H7_M7": {
"target.clock_source": "USE_PLL_HSE_EXTC",
"target.use-mpu": false,
"target.macros_add": [
"USE_USB_HS",
"LOWSPEED=1"
],
"target.components_remove" : [
"WHD",
"4343W_FS",
"CYW43XXX"
],
"mcuboot.application-sdcard": true
},
"NICLA_VISION": {
"target.clock_source": "USE_PLL_HSE_EXTC",
"target.use-mpu": false,
"target.components_remove" : ["WHD", "4343W_FS", "CYW43XXX", "SE050"],
"target.extra_labels_remove" : ["CORDIO"],
"target.features_remove" : ["BLE"],
"target.device_has_remove": ["USBDEVICE", "EMAC", "CAN", "SPI_ASYNCH", "SPISLAVE", "SPI","SERIAL_FC", "PWMOUT", "ANALOGIN", "ANALOGOUT", "I2CSLAVE", "I2C_ASYNC", "OSPI", "TRNG", "DAC", "CRC", "WATCHDOG", "RTC", "LPTICKER", "SLEEP"],
"target.printf_lib": "minimal-printf",
"target.i2c_timing_value_algo": false,
"target.macros_add":["BOARD_HAS_VIDEO=0", "BOARD_HAS_ETHERNET=0"],
"platform.minimal-printf-enable-floating-point": false,
"platform.minimal-printf-enable-64-bit": false,
"platform.stdio-flush-at-exit": false,
"platform.stdio-baud-rate": 115200,
"fat_chan.ff_use_mkfs": 0,
"fat_chan.ff_use_lfn": 0,
"fat_chan.ff_fs_rpath": 0,
"mcuboot.primary-slot-address": "0x8020000",
"mcuboot.slot-size": "0x1E0000",
"mcuboot.scratch-address": "0x9000000",
"mcuboot.scratch-size": "0x20000",
"mcuboot.max-img-sectors": "0x3C0",
"mcuboot.max-align": 32,
"mcuboot.bootstrap": true,
"mcuboot.application-hooks": true,
"mcuboot.application-littlefs": true,
"mcuboot.application-sdcard": null,
"mcuboot.application-dfu": true,
"mcuboot.signature-algorithm": "SIGNATURE_TYPE_EC256",
"mcuboot.encrypt-ec256": true,
"mcuboot.include-keys": null,
"mcuboot.bootloader-build": false,
"mcuboot.encrypt-scratch": true,
"mcuboot.swap-buf-size": 131072
"target.macros_add": [
"USE_USB_HS",
"LOWSPEED=1",
"BOARD_HAS_VIDEO=0",
"BOARD_HAS_ETHERNET=0"
],
"target.components_remove" : [
"WHD",
"4343W_FS",
"CYW43XXX",
"SE050"
],
"mcuboot.application-sdcard": null
}
}
}
71 changes: 57 additions & 14 deletions mbed_app_bootutil.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
{
"requires": ["bare-metal", "mbedtls", "mcuboot", "flashiap-block-device", "spif-driver", "qspif", "mbed-trace", "filesystem", "fat_chan", "littlefs", "rtos", "cmsis-cmsis5-rtos2", "events"],
"macros": ["MBED_FAULT_HANDLER_DISABLED", "USE_USB_HS", "LOWSPEED=1", "MBEDTLS_USER_CONFIG_FILE=\"mbedtls_config.h\""],
"requires": [
"bare-metal",
"mbedtls",
"mcuboot",
"flashiap-block-device",
"spif-driver",
"qspif",
"mbed-trace",
"filesystem",
"fat_chan",
"littlefs",
"rtos",
"cmsis-cmsis5-rtos2",
"events"
],
"macros": [
"MBED_FAULT_HANDLER_DISABLED",
"USE_USB_HS",
"LOWSPEED=1",
"MBEDTLS_USER_CONFIG_FILE=\"mbedtls_config.h\"",
"BOOTUTIL_LIBARY_BUILD=1"
],
"config": {
"serial-bootloader-enable": {
"help": "Build bootloader with serial update support",
Expand All @@ -11,26 +31,47 @@
"*": {
"target.restrict_size": "0x40000",
"target.c_lib": "small",
"mcuboot.log-level": "MCUBOOT_LOG_LEVEL_OFF",
"mbed-trace.enable": false,
"mbed-trace.fea-ipv6": false
},
"PORTENTA_H7_M7": {
"target.clock_source": "USE_PLL_HSE_EXTC",
"target.use-mpu": false,
"target.components_remove" : ["WHD", "4343W_FS", "CYW43XXX"],
"target.extra_labels_remove" : ["CORDIO"],
"target.features_remove" : ["BLE"],
"target.device_has_remove": ["USBDEVICE", "EMAC", "CAN", "SPI_ASYNCH", "SPISLAVE", "SPI","SERIAL_FC", "PWMOUT", "ANALOGIN", "ANALOGOUT", "I2CSLAVE", "I2C_ASYNC", "OSPI", "TRNG", "DAC", "CRC", "WATCHDOG", "RTC", "LPTICKER", "SLEEP"],
"target.printf_lib": "minimal-printf",
"target.i2c_timing_value_algo": false,
"target.extra_labels_remove" : ["CORDIO"],
"target.features_remove" : ["BLE"],
"target.device_has_remove": [
"USBDEVICE",
"EMAC",
"CAN",
"SPI_ASYNCH",
"SPISLAVE",
"SPI",
"SERIAL_FC",
"PWMOUT",
"ANALOGIN",
"ANALOGOUT",
"I2CSLAVE",
"I2C_ASYNC",
"OSPI",
"TRNG",
"DAC",
"CRC",
"WATCHDOG",
"RTC",
"LPTICKER",
"SLEEP"
],
"target.clock_source": "USE_PLL_HSE_EXTC",
"target.use-mpu": false,
"target.components_remove" : [
"WHD",
"4343W_FS",
"CYW43XXX"
],
"platform.minimal-printf-enable-floating-point": false,
"platform.minimal-printf-enable-64-bit": false,
"platform.stdio-flush-at-exit": false,
"platform.stdio-baud-rate": 115200,
"fat_chan.ff_use_mkfs": 0,
"fat_chan.ff_use_lfn": 0,
"fat_chan.ff_fs_rpath": 0,
"mcuboot.log-level": "MCUBOOT_LOG_LEVEL_OFF",
"mcuboot.primary-slot-address": "0x8020000",
"mcuboot.slot-size": "0x1E0000",
"mcuboot.scratch-address": "0x9000000",
Expand All @@ -45,7 +86,9 @@
"mcuboot.signature-algorithm": "SIGNATURE_TYPE_EC256",
"mcuboot.encrypt-ec256": true,
"mcuboot.include-keys": null,
"mcuboot.bootloader-build": false
"mcuboot.bootloader-build": false,
"mbed-trace.enable": false,
"mbed-trace.fea-ipv6": false
}
}
}
Loading