Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 8ab4ec4

Browse files
committedMar 7, 2022
Fix STM32H747_updateBootloader sketch to support multiple boards
1 parent 7fee0c1 commit 8ab4ec4

File tree

4 files changed

+11431
-6
lines changed

4 files changed

+11431
-6
lines changed
 

‎libraries/STM32H747_System/examples/H747_updateBootloader/H747_updateBootloader.ino renamed to ‎libraries/STM32H747_System/examples/STM32H747_updateBootloader/STM32H747_updateBootloader.ino

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#include "FlashIAP.h"
2-
#include "bootloader.h"
2+
#if defined(ARDUINO_PORTENTA_H7_M7)
3+
#include "portenta_bootloader.h"
4+
#elif defined(ARDUINO_NICLA_VISION)
5+
#include "nicla_vision_bootloader.h"
6+
#endif
37

48
#ifndef CORE_CM7
59
#error Update the bootloader by uploading the sketch to the M7 core instead of the M4 core.
@@ -16,7 +20,7 @@ void setup() {
1620
while (!Serial) {}
1721

1822
uint8_t currentBootloaderVersion = bootloader_data[1];
19-
uint8_t availableBootloaderVersion = (envie_bootloader_mbed_bin + bootloader_data_offset)[1];
23+
uint8_t availableBootloaderVersion = (bootloader_mbed_bin + bootloader_data_offset)[1];
2024

2125
Serial.println("Magic Number (validation): " + String(bootloader_data[0], HEX));
2226
Serial.println("Bootloader version: " + String(currentBootloaderVersion));
@@ -87,7 +91,7 @@ String getClockSource(uint8_t flag) {
8791
}
8892

8993
void applyUpdate(uint32_t address) {
90-
long len = envie_bootloader_mbed_bin_len;
94+
long len = bootloader_mbed_bin_len;
9195

9296
flash.init();
9397

@@ -112,7 +116,7 @@ void applyUpdate(uint32_t address) {
112116
}
113117

114118
// Program page
115-
flash.program(&envie_bootloader_mbed_bin[page_size * pages_flashed], addr, page_size);
119+
flash.program(&bootloader_mbed_bin[page_size * pages_flashed], addr, page_size);
116120

117121
addr += page_size;
118122
if (addr >= next_sector) {

0 commit comments

Comments
 (0)
Please sign in to comment.