Skip to content

Commit 73d0b1f

Browse files
authored
Merge pull request #22 from arduino/app-json
Add dedicated mbed_app file for each board
2 parents a5fab93 + 397ff46 commit 73d0b1f

7 files changed

+546
-75
lines changed

generate_rel.sh

+20-15
Original file line numberDiff line numberDiff line change
@@ -2,63 +2,68 @@
22
rm -rf release
33
rm -rf BUILD
44

5-
if [[ $1 == "library" ]] || [[ $1 == "all" ]]; then
6-
mbed compile -c -m PORTENTA_H7_M7 -t GCC_ARM --app=mbed_app_bootutil.json -DBOOTUTIL_LIBARY_BUILD=1
5+
mbed compile -c -m PORTENTA_H7_M7 -t GCC_ARM --app=mbed_app_bootutil.json
6+
7+
set -e
8+
79
echo
810
echo Generating bootutil library
911
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
1012
echo -n "Library: "
1113
find ./ -name "libbootutil.a"
12-
fi
1314

1415
if [[ $1 == "portenta" ]] || [[ $1 == "all" ]]; then
1516
echo
1617
echo Generating binaries for PORTENTA H7
17-
mbed compile -c -m PORTENTA_H7_M7 -t GCC_ARM --profile=release --profile mbed-os/tools/profiles/extensions/lto.json -N mcuboot_portenta_h7
18+
mbed compile -c -m PORTENTA_H7_M7 -t GCC_ARM --app=mbed_app_portenta.json --profile=custom.json -N mcuboot_portenta_h7
1819
mkdir -p release/PORTENTA_H7
1920
cp ./libbootutil.a ./release/PORTENTA_H7
20-
cp ./BUILD/PORTENTA_H7_M7/GCC_ARM-RELEASE/mcuboot_portenta_h7.bin ./release/PORTENTA_H7/mcuboot_portenta_h7.bin
21-
cp ./BUILD/PORTENTA_H7_M7/GCC_ARM-RELEASE/mcuboot_portenta_h7_application.elf ./release/PORTENTA_H7/mcuboot_portenta_h7.elf
21+
cp ./BUILD/PORTENTA_H7_M7/GCC_ARM-CUSTOM/mcuboot_portenta_h7.bin ./release/PORTENTA_H7/mcuboot_portenta_h7.bin
22+
cp ./BUILD/PORTENTA_H7_M7/GCC_ARM-CUSTOM/mcuboot_portenta_h7_application.elf ./release/PORTENTA_H7/mcuboot_portenta_h7.elf
2223
xxd -i ./release/PORTENTA_H7/mcuboot_portenta_h7.bin > ./release/PORTENTA_H7/mcuboot_portenta_h7.h
2324
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
2425
sed -i "s/__release_PORTENTA_H7_mcuboot_portenta_h7_bin_len/mcuboot_portenta_h7_bin_len/" ./release/PORTENTA_H7/mcuboot_portenta_h7.h
26+
tar -czvf ./release/PORTENTA_H7.tar.gz -C ./release/ PORTENTA_H7
2527
fi
2628

2729
if [[ $1 == "lite" ]] || [[ $1 == "all" ]]; then
2830
echo
2931
echo Generating binaries for PORTENTA H7 Lite
30-
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
32+
mbed compile -c -m PORTENTA_H7_M7 -t GCC_ARM --app=mbed_app_portenta_lite.json --profile=custom.json -N mcuboot_portenta_h7_lite
3133
mkdir -p release/PORTENTA_H7_Lite
3234
cp ./libbootutil.a ./release/PORTENTA_H7_Lite
33-
cp ./BUILD/PORTENTA_H7_M7/GCC_ARM-RELEASE/mcuboot_portenta_h7_lite.bin ./release/PORTENTA_H7_Lite/mcuboot_portenta_h7_lite.bin
34-
cp ./BUILD/PORTENTA_H7_M7/GCC_ARM-RELEASE/mcuboot_portenta_h7_lite_application.elf ./release/PORTENTA_H7_Lite/mcuboot_portenta_h7_lite.elf
35+
cp ./BUILD/PORTENTA_H7_M7/GCC_ARM-CUSTOM/mcuboot_portenta_h7_lite.bin ./release/PORTENTA_H7_Lite/mcuboot_portenta_h7_lite.bin
36+
cp ./BUILD/PORTENTA_H7_M7/GCC_ARM-CUSTOM/mcuboot_portenta_h7_lite_application.elf ./release/PORTENTA_H7_Lite/mcuboot_portenta_h7_lite.elf
3537
xxd -i ./release/PORTENTA_H7_Lite/mcuboot_portenta_h7_lite.bin > ./release/PORTENTA_H7_Lite/mcuboot_portenta_h7_lite.h
3638
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
3739
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
40+
tar -czvf ./release/PORTENTA_H7_Lite.tar.gz -C ./release/ PORTENTA_H7_Lite
3841
fi
3942

4043
if [[ $1 == "connected" ]] || [[ $1 == "all" ]]; then
4144
echo
4245
echo Generating binaries for PORTENTA H7 Lite Connected
43-
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
46+
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
4447
mkdir -p release/PORTENTA_H7_Lite_Connected
4548
cp ./libbootutil.a ./release/PORTENTA_H7_Lite_Connected
46-
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
47-
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
49+
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
50+
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
4851
xxd -i ./release/PORTENTA_H7_Lite_Connected/mcuboot_portenta_h7_lite_connected.bin > ./release/PORTENTA_H7_Lite_Connected/mcuboot_portenta_h7_lite_connected.h
4952
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
5053
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
54+
tar -czvf ./release/PORTENTA_H7_Lite_Connected.tar.gz -C ./release/ PORTENTA_H7_Lite_Connected
5155
fi
5256

5357
if [[ $1 == "nicla" ]] || [[ $1 == "all" ]]; then
5458
echo
5559
echo Generating binaries for NICLA VISION
56-
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
60+
mbed compile -c -m NICLA_VISION -t GCC_ARM --app=mbed_app_nicla_vision.json --profile=custom.json -N mcuboot_nicla_vision
5761
mkdir -p release/NICLA_VISION
5862
mv ./libbootutil.a ./release/NICLA_VISION
59-
cp ./BUILD/NICLA_VISION/GCC_ARM-RELEASE/mcuboot_nicla_vision.bin ./release/NICLA_VISION/mcuboot_nicla_vision.bin
60-
cp ./BUILD/NICLA_VISION/GCC_ARM-RELEASE/mcuboot_nicla_vision_application.elf ./release/NICLA_VISION/mcuboot_nicla_vision.elf
63+
cp ./BUILD/NICLA_VISION/GCC_ARM-CUSTOM/mcuboot_nicla_vision.bin ./release/NICLA_VISION/mcuboot_nicla_vision.bin
64+
cp ./BUILD/NICLA_VISION/GCC_ARM-CUSTOM/mcuboot_nicla_vision_application.elf ./release/NICLA_VISION/mcuboot_nicla_vision.elf
6165
xxd -i ./release/NICLA_VISION/mcuboot_nicla_vision.bin > ./release/NICLA_VISION/mcuboot_nicla_vision.h
6266
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
6367
sed -i "s/__release_NICLA_VISION_mcuboot_nicla_vision_bin_len/mcuboot_nicla_vision_bin_len/" ./release/NICLA_VISION/mcuboot_nicla_vision.h
68+
tar -czvf ./release/NICLA_VISION.tar.gz -C ./release/ NICLA_VISION
6469
fi

mbed_app.json

+74-46
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
11
{
2-
"requires": ["bare-metal", "mbedtls", "mcuboot", "flashiap-block-device", "spif-driver", "qspif", "mbed-trace", "filesystem", "fat_chan", "littlefs", "rtos", "cmsis-cmsis5-rtos2", "events"],
3-
"macros": ["MBED_FAULT_HANDLER_DISABLED", "USE_USB_HS", "LOWSPEED=1", "MBEDTLS_USER_CONFIG_FILE=\"mbedtls_config.h\""],
2+
"requires": [
3+
"bare-metal",
4+
"mbedtls",
5+
"mcuboot",
6+
"flashiap-block-device",
7+
"spif-driver",
8+
"qspif",
9+
"mbed-trace",
10+
"filesystem",
11+
"fat_chan",
12+
"littlefs",
13+
"rtos",
14+
"cmsis-cmsis5-rtos2",
15+
"events"
16+
],
17+
"macros": [
18+
"MBED_FAULT_HANDLER_DISABLED",
19+
"MBEDTLS_USER_CONFIG_FILE=\"mbedtls_config.h\""
20+
],
421
"config": {
522
"serial-bootloader-enable": {
623
"help": "Build bootloader with serial update support",
@@ -11,26 +28,40 @@
1128
"*": {
1229
"target.restrict_size": "0x20000",
1330
"target.c_lib": "small",
14-
"mcuboot.log-level": "MCUBOOT_LOG_LEVEL_INFO",
15-
"mbed-trace.enable": false,
16-
"mbed-trace.fea-ipv6": false
17-
},
18-
"PORTENTA_H7_M7": {
19-
"target.clock_source": "USE_PLL_HSE_EXTC",
20-
"target.use-mpu": false,
21-
"target.components_remove" : ["WHD", "4343W_FS", "CYW43XXX"],
22-
"target.extra_labels_remove" : ["CORDIO"],
23-
"target.features_remove" : ["BLE"],
24-
"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"],
2531
"target.printf_lib": "minimal-printf",
2632
"target.i2c_timing_value_algo": false,
33+
"target.extra_labels_remove" : ["CORDIO"],
34+
"target.features_remove" : ["BLE"],
35+
"target.device_has_remove": [
36+
"USBDEVICE",
37+
"EMAC",
38+
"CAN",
39+
"SPI_ASYNCH",
40+
"SPISLAVE",
41+
"SPI",
42+
"SERIAL_FC",
43+
"PWMOUT",
44+
"ANALOGIN",
45+
"ANALOGOUT",
46+
"I2CSLAVE",
47+
"I2C_ASYNC",
48+
"OSPI",
49+
"TRNG",
50+
"DAC",
51+
"CRC",
52+
"WATCHDOG",
53+
"RTC",
54+
"LPTICKER",
55+
"SLEEP"
56+
],
2757
"platform.minimal-printf-enable-floating-point": false,
2858
"platform.minimal-printf-enable-64-bit": false,
2959
"platform.stdio-flush-at-exit": false,
3060
"platform.stdio-baud-rate": 115200,
3161
"fat_chan.ff_use_mkfs": 0,
3262
"fat_chan.ff_use_lfn": 0,
3363
"fat_chan.ff_fs_rpath": 0,
64+
"mcuboot.log-level": "MCUBOOT_LOG_LEVEL_INFO",
3465
"mcuboot.primary-slot-address": "0x8020000",
3566
"mcuboot.slot-size": "0x1E0000",
3667
"mcuboot.scratch-address": "0x9000000",
@@ -40,49 +71,46 @@
4071
"mcuboot.bootstrap": true,
4172
"mcuboot.application-hooks": true,
4273
"mcuboot.application-littlefs": true,
43-
"mcuboot.application-sdcard": true,
4474
"mcuboot.application-dfu": true,
4575
"mcuboot.signature-algorithm": "SIGNATURE_TYPE_EC256",
4676
"mcuboot.encrypt-ec256": true,
4777
"mcuboot.include-keys": null,
4878
"mcuboot.bootloader-build": false,
4979
"mcuboot.encrypt-scratch": true,
50-
"mcuboot.swap-buf-size": 131072
80+
"mcuboot.swap-buf-size": 131072,
81+
"mbed-trace.enable": false,
82+
"mbed-trace.fea-ipv6": false
83+
},
84+
"PORTENTA_H7_M7": {
85+
"target.clock_source": "USE_PLL_HSE_EXTC",
86+
"target.use-mpu": false,
87+
"target.macros_add": [
88+
"USE_USB_HS",
89+
"LOWSPEED=1"
90+
],
91+
"target.components_remove" : [
92+
"WHD",
93+
"4343W_FS",
94+
"CYW43XXX"
95+
],
96+
"mcuboot.application-sdcard": true
5197
},
5298
"NICLA_VISION": {
5399
"target.clock_source": "USE_PLL_HSE_EXTC",
54100
"target.use-mpu": false,
55-
"target.components_remove" : ["WHD", "4343W_FS", "CYW43XXX", "SE050"],
56-
"target.extra_labels_remove" : ["CORDIO"],
57-
"target.features_remove" : ["BLE"],
58-
"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"],
59-
"target.printf_lib": "minimal-printf",
60-
"target.i2c_timing_value_algo": false,
61-
"target.macros_add":["BOARD_HAS_VIDEO=0", "BOARD_HAS_ETHERNET=0"],
62-
"platform.minimal-printf-enable-floating-point": false,
63-
"platform.minimal-printf-enable-64-bit": false,
64-
"platform.stdio-flush-at-exit": false,
65-
"platform.stdio-baud-rate": 115200,
66-
"fat_chan.ff_use_mkfs": 0,
67-
"fat_chan.ff_use_lfn": 0,
68-
"fat_chan.ff_fs_rpath": 0,
69-
"mcuboot.primary-slot-address": "0x8020000",
70-
"mcuboot.slot-size": "0x1E0000",
71-
"mcuboot.scratch-address": "0x9000000",
72-
"mcuboot.scratch-size": "0x20000",
73-
"mcuboot.max-img-sectors": "0x3C0",
74-
"mcuboot.max-align": 32,
75-
"mcuboot.bootstrap": true,
76-
"mcuboot.application-hooks": true,
77-
"mcuboot.application-littlefs": true,
78-
"mcuboot.application-sdcard": null,
79-
"mcuboot.application-dfu": true,
80-
"mcuboot.signature-algorithm": "SIGNATURE_TYPE_EC256",
81-
"mcuboot.encrypt-ec256": true,
82-
"mcuboot.include-keys": null,
83-
"mcuboot.bootloader-build": false,
84-
"mcuboot.encrypt-scratch": true,
85-
"mcuboot.swap-buf-size": 131072
101+
"target.macros_add": [
102+
"USE_USB_HS",
103+
"LOWSPEED=1",
104+
"BOARD_HAS_VIDEO=0",
105+
"BOARD_HAS_ETHERNET=0"
106+
],
107+
"target.components_remove" : [
108+
"WHD",
109+
"4343W_FS",
110+
"CYW43XXX",
111+
"SE050"
112+
],
113+
"mcuboot.application-sdcard": null
86114
}
87115
}
88116
}

mbed_app_bootutil.json

+57-14
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,26 @@
11
{
2-
"requires": ["bare-metal", "mbedtls", "mcuboot", "flashiap-block-device", "spif-driver", "qspif", "mbed-trace", "filesystem", "fat_chan", "littlefs", "rtos", "cmsis-cmsis5-rtos2", "events"],
3-
"macros": ["MBED_FAULT_HANDLER_DISABLED", "USE_USB_HS", "LOWSPEED=1", "MBEDTLS_USER_CONFIG_FILE=\"mbedtls_config.h\""],
2+
"requires": [
3+
"bare-metal",
4+
"mbedtls",
5+
"mcuboot",
6+
"flashiap-block-device",
7+
"spif-driver",
8+
"qspif",
9+
"mbed-trace",
10+
"filesystem",
11+
"fat_chan",
12+
"littlefs",
13+
"rtos",
14+
"cmsis-cmsis5-rtos2",
15+
"events"
16+
],
17+
"macros": [
18+
"MBED_FAULT_HANDLER_DISABLED",
19+
"USE_USB_HS",
20+
"LOWSPEED=1",
21+
"MBEDTLS_USER_CONFIG_FILE=\"mbedtls_config.h\"",
22+
"BOOTUTIL_LIBARY_BUILD=1"
23+
],
424
"config": {
525
"serial-bootloader-enable": {
626
"help": "Build bootloader with serial update support",
@@ -11,26 +31,47 @@
1131
"*": {
1232
"target.restrict_size": "0x40000",
1333
"target.c_lib": "small",
14-
"mcuboot.log-level": "MCUBOOT_LOG_LEVEL_OFF",
15-
"mbed-trace.enable": false,
16-
"mbed-trace.fea-ipv6": false
17-
},
18-
"PORTENTA_H7_M7": {
19-
"target.clock_source": "USE_PLL_HSE_EXTC",
20-
"target.use-mpu": false,
21-
"target.components_remove" : ["WHD", "4343W_FS", "CYW43XXX"],
22-
"target.extra_labels_remove" : ["CORDIO"],
23-
"target.features_remove" : ["BLE"],
24-
"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"],
2534
"target.printf_lib": "minimal-printf",
2635
"target.i2c_timing_value_algo": false,
36+
"target.extra_labels_remove" : ["CORDIO"],
37+
"target.features_remove" : ["BLE"],
38+
"target.device_has_remove": [
39+
"USBDEVICE",
40+
"EMAC",
41+
"CAN",
42+
"SPI_ASYNCH",
43+
"SPISLAVE",
44+
"SPI",
45+
"SERIAL_FC",
46+
"PWMOUT",
47+
"ANALOGIN",
48+
"ANALOGOUT",
49+
"I2CSLAVE",
50+
"I2C_ASYNC",
51+
"OSPI",
52+
"TRNG",
53+
"DAC",
54+
"CRC",
55+
"WATCHDOG",
56+
"RTC",
57+
"LPTICKER",
58+
"SLEEP"
59+
],
60+
"target.clock_source": "USE_PLL_HSE_EXTC",
61+
"target.use-mpu": false,
62+
"target.components_remove" : [
63+
"WHD",
64+
"4343W_FS",
65+
"CYW43XXX"
66+
],
2767
"platform.minimal-printf-enable-floating-point": false,
2868
"platform.minimal-printf-enable-64-bit": false,
2969
"platform.stdio-flush-at-exit": false,
3070
"platform.stdio-baud-rate": 115200,
3171
"fat_chan.ff_use_mkfs": 0,
3272
"fat_chan.ff_use_lfn": 0,
3373
"fat_chan.ff_fs_rpath": 0,
74+
"mcuboot.log-level": "MCUBOOT_LOG_LEVEL_OFF",
3475
"mcuboot.primary-slot-address": "0x8020000",
3576
"mcuboot.slot-size": "0x1E0000",
3677
"mcuboot.scratch-address": "0x9000000",
@@ -45,7 +86,9 @@
4586
"mcuboot.signature-algorithm": "SIGNATURE_TYPE_EC256",
4687
"mcuboot.encrypt-ec256": true,
4788
"mcuboot.include-keys": null,
48-
"mcuboot.bootloader-build": false
89+
"mcuboot.bootloader-build": false,
90+
"mbed-trace.enable": false,
91+
"mbed-trace.fea-ipv6": false
4992
}
5093
}
5194
}

0 commit comments

Comments
 (0)