Skip to content

Commit fa628e3

Browse files
committed
BL update sketch: add more info messages about MCUBoot + keys
1 parent 9ae4d85 commit fa628e3

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

libraries/STM32H747_System/examples/STM32H747_updateBootloader/STM32H747_updateBootloader.ino

+22-7
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,18 @@ void setup() {
7070

7171
#if defined(ARDUINO_PORTENTA_H7_M7)
7272
Serial.println("\nDo you want to update the default Arduino bootloader? Y/[n]");
73-
Serial.println("If No, MCUBoot bootloader will be updated.");
74-
if(waitResponse()) {
73+
Serial.println("If No, MCUboot bootloader will be updated.");
74+
if(!waitResponse()) {
75+
Serial.println("\nMCUboot has been selected. Do you want to proceed? Y/[n]");
76+
if (waitResponse()) {
77+
MCUboot = true;
78+
bootloader_ptr = &mcuboot_bin[0];
79+
bootloader_len = mcuboot_bin_len;
80+
} else {
81+
Serial.println("\nProceeding with the default Arduino bootloader...");
82+
}
83+
}
84+
if (!MCUboot) {
7585
bootloader_ptr = &bootloader_mbed_bin[0];
7686
bootloader_len = bootloader_mbed_bin_len;
7787
if (!video_available) {
@@ -83,9 +93,6 @@ void setup() {
8393
bootloader_len = bootloader_mbed_lite_bin_len;
8494
}
8595
}
86-
} else {
87-
bootloader_ptr = &mcuboot_bin[0];
88-
bootloader_len = mcuboot_bin_len;
8996
}
9097
#endif
9198

@@ -122,8 +129,16 @@ void setup() {
122129
if (writeLoader) {
123130
if(availableBootloaderIdentifier.equals("MCUboot Arduino")) {
124131
setupMCUBootOTAData();
132+
125133
Serial.println("\nThe bootloader comes with a set of default keys to evaluate signing and encryption process");
126-
Serial.println("Do you want to load default keys? Y/[n]");
134+
Serial.println("If you load the keys, you will need to upload the future sketches with Security Settings -> Signing + Encryption.");
135+
Serial.println("If you select Security Settings -> None, the sketches will not be executed.");
136+
Serial.println("Do you want to load the keys? Y/[n]");
137+
if (waitResponse()) {
138+
Serial.println("\nPlease notice that loading the keys will enable MCUboot Sketch swap. This will increase the sketch update time after the upload.");
139+
Serial.println("A violet LED will blink until the sketch is ready to run.");
140+
Serial.println("Do you want to proceed loading the default keys? Y/[n]");
141+
}
127142
writeKeys = waitResponse();
128143
}
129144
applyUpdate(BOOTLOADER_ADDR);
@@ -200,7 +215,7 @@ void setupMCUBootOTAData() {
200215

201216
int err = ota_data_fs.reformat(&ota_data);
202217
if (err) {
203-
Serial.println("Error creating MCUBoot files in OTA partition");
218+
Serial.println("Error creating MCUboot files in OTA partition");
204219
}
205220

206221
FILE* fp = fopen("/fs/scratch.bin", "wb");

0 commit comments

Comments
 (0)