8000 Do not compare BL versions if BL magic is corrupted · chunkywill/ArduinoCore-mbed@1f70949 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1f70949

Browse files
giulcioffipennam
authored andcommitted
Do not compare BL versions if BL magic is corrupted
1 parent c994b69 commit 1f70949

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

libraries/STM32H747_System/examples/STM32H747_updateBootloader/STM32H747_updateBootloader.ino

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,16 +97,21 @@ void setup() {
9797
}
9898

9999
if (currentBootloaderIdentifier == availableBootloaderIdentifier) {
100-
if (availableBootloaderVersion > currentBootloaderVersion) {
101-
Serial.print("\nA new bootloader version is available: v" + String(availableBootloaderVersion));
102-
Serial.println(" (Your version: v" + String(currentBootloaderVersion) + ")");
100+
if (bootloader_data[0] != 0xA0) {
101+
Serial.println("\nA new bootloader version (v" + String(availableBootloaderVersion) + ") is available.");
103102
Serial.println("Do you want to update the bootloader? Y/[n]");
104-
} else if (availableBootloaderVersion < currentBootloaderVersion) {
105-
Serial.println("\nA newer bootloader version is already installed: v" + String(currentBootloaderVersion));
106-
Serial.println("Do you want to downgrade the bootloader to v" + String(availableBootloaderVersion) + "? Y/[n]");
107103
} else {
108-
Serial.println("\nThe latest version of the bootloader is already installed (v" + String(currentBootloaderVersion) + ").");
109-
Serial.println("Do you want to update the bootloader anyway? Y/[n]");
104+
if (availableBootloaderVersion > currentBootloaderVersion) {
105+
Serial.print("\nA new bootloader version is available: v" + String(availableBootloaderVersion));
106+
Serial.println(" (Your version: v" + String(currentBootloaderVersion) + ")");
107+
Serial.println("Do you want to update the bootloader? Y/[n]");
108+
} else if (availableBootloaderVersion < currentBootloaderVersion) {
109+
Serial.println("\nA newer bootloader version is already installed: v" + String(currentBootloaderVersion));
110+
Serial.println("Do you want to downgrade the bootloader to v" + String(availableBootloaderVersion) + "? Y/[n]");
111+
} else {
112+
Serial.println("\nThe latest version of the bootloader is already installed (v" + String(currentBootloaderVersion) + ").");
113+
Serial.println("Do you want to update the bootloader anyway? Y/[n]");
114+
}
110115
}
111116
} else {
112117
Serial.println("\nA different bootloader type is available: v" + String(availableBootloaderVersion));
@@ -125,6 +130,7 @@ void setup() {
125130
} else {
126131
Serial.println("It's now safe to reboot or disconnect your board.");
127132
}
133+
128134
}
129135

130136
String getUSBSpeed(uint8_t flag) {

0 commit comments

Comments
 (0)
0