Skip to content

Fix typo in QSPIFormat example #1065

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions libraries/STM32H747_System/examples/QSPIFormat/QSPIFormat.ino
Original file line number Diff line number Diff line change
Expand Up @@ -171,60 +171,60 @@ extern const unsigned char wifi_firmware_image_data[];

void flashWiFiFirmwareAndCertificates() {
FILE* fp = fopen("/wlan/4343WA1.BIN", "wb");
uint32_t chunck_size = 1024;
uint32_t chunk_size = 1024;
uint32_t byte_count = 0;

Serial.println("Flashing WiFi firmware");
printProgress(byte_count, file_size, 10, true);
while (byte_count < file_size) {
if(byte_count + chunck_size > file_size)
chunck_size = file_size - byte_count;
int ret = fwrite(&wifi_firmware_image_data[byte_count], chunck_size, 1, fp);
if(byte_count + chunk_size > file_size)
chunk_size = file_size - byte_count;
int ret = fwrite(&wifi_firmware_image_data[byte_count], chunk_size, 1, fp);
if (ret != 1) {
Serial.println("Error writing firmware data");
break;
}
byte_count += chunck_size;
byte_count += chunk_size;
printProgress(byte_count, file_size, 10, false);
}
fclose(fp);

fp = fopen("/wlan/cacert.pem", "wb");

Serial.println("Flashing certificates");
chunck_size = 128;
chunk_size = 128;
byte_count = 0;
printProgress(byte_count, cacert_pem_len, 10, true);
while (byte_count < cacert_pem_len) {
if(byte_count + chunck_size > cacert_pem_len)
chunck_size = cacert_pem_len - byte_count;
int ret = fwrite(&cacert_pem[byte_count], chunck_size, 1 ,fp);
if(byte_count + chunk_size > cacert_pem_len)
chunk_size = cacert_pem_len - byte_count;
int ret = fwrite(&cacert_pem[byte_count], chunk_size, 1 ,fp);
if (ret != 1) {
Serial.println("Error writing certificates");
break;
}
byte_count += chunck_size;
byte_count += chunk_size;
printProgress(byte_count, cacert_pem_len, 10, false);
}
fclose(fp);
}

void flashWiFiFirmwareMapped() {
uint32_t chunck_size = 1024;
uint32_t chunk_size = 1024;
uint32_t byte_count = 0;
const uint32_t offset = 15 * 1024 * 1024 + 1024 * 512;

Serial.println("Flashing memory mapped WiFi firmware");
printProgress(byte_count, file_size, 10, true);
while (byte_count < file_size) {
if (byte_count + chunck_size > file_size)
chunck_size = file_size - byte_count;
int ret = root->program(wifi_firmware_image_data, offset + byte_count, chunck_size);
if (byte_count + chunk_size > file_size)
chunk_size = file_size - byte_count;
int ret = root->program(wifi_firmware_image_data, offset + byte_count, chunk_size);
if (ret != 0) {
Serial.println("Error writing memory mapped firmware");
break;
}
byte_count += chunck_size;
byte_count += chunk_size;
printProgress(byte_count, file_size, 10, false);
}
}
Expand Down