@@ -70,8 +70,18 @@ void setup() {
7070
7171#if defined(ARDUINO_PORTENTA_H7_M7)
7272 Serial.println (" \n Do 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 (" \n MCUboot 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 (" \n Proceeding 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 (" \n The 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 (" \n Please 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