Skip to content

Commit bdfb885

Browse files
authored
Merge pull request #1094 from pennam/wifi-updater-fix
WiFi firmware updater memory mapped fix
2 parents 264de24 + 0abb5f8 commit bdfb885

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

libraries/STM32H747_System/examples/QSPIFormat/QSPIFormat.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ void flashWiFiFirmwareMapped() {
219219
while (byte_count < file_size) {
220220
if (byte_count + chunk_size > file_size)
221221
chunk_size = file_size - byte_count;
222-
int ret = root->program(wifi_firmware_image_data, offset + byte_count, chunk_size);
222+
int ret = root->program(&wifi_firmware_image_data[byte_count], offset + byte_count, chunk_size);
223223
if (ret != 0) {
224224
Serial.println("Error writing memory mapped firmware");
225225
break;

libraries/STM32H747_System/examples/WiFiFirmwareUpdater/WiFiFirmwareUpdater.ino

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,18 @@ void setup() {
107107
byte_count = 0;
108108
const uint32_t offset = 15 * 1024 * 1024 + 1024 * 512;
109109

110+
// Make sure QSPI is erased before programming
111+
Serial.println("Erasing memory mapped firmware area...");
112+
err = root.erase(14 * 1024 * 1024, 2 * 1024 * 1024);
113+
if (err != 0) {
114+
Serial.println("Error erasing memory mapped firmware area");
115+
}
110116
Serial.println("Flashing memory mapped firmware");
111117
printProgress(byte_count, file_size, 10, true);
112118
while (byte_count < file_size) {
113119
if(byte_count + chunck_size > file_size)
114120
chunck_size = file_size - byte_count;
115-
int ret = root.program(wifi_firmware_image_data, offset + byte_count, chunck_size);
121+
int ret = root.program(&wifi_firmware_image_data[byte_count], offset + byte_count, chunck_size);
116122
if (ret != 0) {
117123
Serial.println("Error writing firmware data");
118124
break;

0 commit comments

Comments
 (0)