Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

QSPIFormat: add function to restore memory mapped firmware#1062

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
pennam merged 3 commits intoarduino:mainfrompennam:formatter-2
May 13, 2025
Merged
Changes fromall 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
43 changes: 36 additions & 7 deletionslibraries/STM32H747_System/examples/QSPIFormat/QSPIFormat.ino
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -79,8 +79,12 @@ void setup() {
}

Serial.println("Do you want to perform a full erase of the QSPI flash before proceeding? Y/[n]");
if (true ==waitResponse()) {
Serial.println("Note: Full flash erase can take up to one minute.");
bool fullErase =waitResponse();
if (fullErase ==true) {
Serial.println("Full erase started, please wait...");
root->erase(0x0, root->size());
Serial.println("Full erase completed.");
}else {
// Erase only the first sector containing the MBR
root->erase(0x0, root->get_erase_size());
Expand All@@ -93,7 +97,7 @@ void setup() {
// use space from 15.5MB to 16 MB for another fw, memory mapped

bool reformat =true;
if(!wifi_data_fs.mount(&wifi_data)) {
if(!wifi_data_fs.mount(&wifi_data)) {
Serial.println("\nPartition 1 already contains a filesystem, do you want to reformat it? Y/[n]");
wifi_data_fs.unmount();

Expand All@@ -106,7 +110,7 @@ void setup() {
}

bool restore =true;
if (reformat) {
if (reformat || fullErase) {
Serial.println("\nDo you want to restore the WiFi firmware and certificates? Y/[n]");
restore =waitResponse();
}
Expand All@@ -115,8 +119,12 @@ void setup() {
flashWiFiFirmwareAndCertificates();
}

if (fullErase && restore) {
flashWiFiFirmwareMapped();
}

reformat =true;
if(!ota_data_fs.mount(&ota_data)) {
if(!ota_data_fs.mount(&ota_data)) {
Serial.println("\nPartition 2 already contains a filesystem, do you want to reformat it? Y/[n]");
ota_data_fs.unmount();

Expand All@@ -140,7 +148,7 @@ void setup() {
}

reformat =true;
if(!user_data_fs->mount(&user_data)) {
if(!user_data_fs->mount(&user_data)) {
Serial.println("\nPartition 4 already contains a filesystem, do you want to reformat it? Y/[n]");
user_data_fs->unmount();

Expand All@@ -158,10 +166,11 @@ void setup() {
Serial.println("It's now safe to reboot or disconnect your board.");
}

constuint32_t file_size =421098;
externconstunsignedchar wifi_firmware_image_data[];

voidflashWiFiFirmwareAndCertificates() {
externconstunsignedchar wifi_firmware_image_data[];
FILE* fp =fopen("/wlan/4343WA1.BIN","wb");
constuint32_t file_size =421098;
uint32_t chunck_size =1024;
uint32_t byte_count =0;

Expand DownExpand Up@@ -200,6 +209,26 @@ void flashWiFiFirmwareAndCertificates() {
fclose(fp);
}

voidflashWiFiFirmwareMapped() {
uint32_t chunck_size =1024;
uint32_t byte_count =0;
constuint32_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 (ret !=0) {
Serial.println("Error writing memory mapped firmware");
break;
}
byte_count += chunck_size;
printProgress(byte_count, file_size,10,false);
}
}

voidloop() {

}

[8]ページ先頭

©2009-2025 Movatter.jp