From ca1cd953f55d541d1310b0810050d54e8087391d Mon Sep 17 00:00:00 2001 From: pennam Date: Mon, 5 May 2025 16:12:51 +0200 Subject: [PATCH 01/11] QSPIFormat: use BlockDevice::get_default_instance() --- .../examples/QSPIFormat/QSPIFormat.ino | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/libraries/STM32H747_System/examples/QSPIFormat/QSPIFormat.ino b/libraries/STM32H747_System/examples/QSPIFormat/QSPIFormat.ino index 8d2b537dc..d788eb046 100644 --- a/libraries/STM32H747_System/examples/QSPIFormat/QSPIFormat.ino +++ b/libraries/STM32H747_System/examples/QSPIFormat/QSPIFormat.ino @@ -1,4 +1,4 @@ -#include "QSPIFBlockDevice.h" +#include "BlockDevice.h" #include "MBRBlockDevice.h" #include "LittleFileSystem.h" #include "FATFileSystem.h" @@ -8,10 +8,10 @@ #endif -QSPIFBlockDevice root(QSPI_SO0, QSPI_SO1, QSPI_SO2, QSPI_SO3, QSPI_SCK, QSPI_CS, QSPIF_POLARITY_MODE_1, 40000000); -mbed::MBRBlockDevice wifi_data(&root, 1); -mbed::MBRBlockDevice ota_data(&root, 2); -mbed::MBRBlockDevice user_data(&root, 3); +mbed::BlockDevice* root = mbed::BlockDevice::get_default_instance(); +mbed::MBRBlockDevice wifi_data(root, 1); +mbed::MBRBlockDevice ota_data(root, 2); +mbed::MBRBlockDevice user_data(root, 3); mbed::FATFileSystem wifi_data_fs("wlan"); mbed::FATFileSystem ota_data_fs("fs"); mbed::FileSystem * user_data_fs; @@ -60,14 +60,14 @@ void setup() { Serial.println("Do you want to proceed? Y/[n]"); if (true == waitResponse()) { - mbed::MBRBlockDevice::partition(&root, 1, 0x0B, 0, 1024 * 1024); + mbed::MBRBlockDevice::partition(root, 1, 0x0B, 0, 1024 * 1024); if(default_scheme) { - mbed::MBRBlockDevice::partition(&root, 3, 0x0B, 14 * 1024 * 1024, 14 * 1024 * 1024); - mbed::MBRBlockDevice::partition(&root, 2, 0x0B, 1024 * 1024, 14 * 1024 * 1024); + mbed::MBRBlockDevice::partition(root, 3, 0x0B, 14 * 1024 * 1024, 14 * 1024 * 1024); + mbed::MBRBlockDevice::partition(root, 2, 0x0B, 1024 * 1024, 14 * 1024 * 1024); // use space from 15.5MB to 16 MB for another fw, memory mapped } else { - mbed::MBRBlockDevice::partition(&root, 2, 0x0B, 1024 * 1024, 6 * 1024 * 1024); - mbed::MBRBlockDevice::partition(&root, 3, 0x0B, 6 * 1024 * 1024, 14 * 1024 * 1024); + mbed::MBRBlockDevice::partition(root, 2, 0x0B, 1024 * 1024, 6 * 1024 * 1024); + mbed::MBRBlockDevice::partition(root, 3, 0x0B, 6 * 1024 * 1024, 14 * 1024 * 1024); // use space from 15.5MB to 16 MB for another fw, memory mapped } From b9f1b32b9f6b92c8ed46d22b96c8322b77e0ec32 Mon Sep 17 00:00:00 2001 From: pennam Date: Mon, 5 May 2025 16:14:38 +0200 Subject: [PATCH 02/11] QSPIFormat: use mbed namespace --- .../examples/QSPIFormat/QSPIFormat.ino | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/libraries/STM32H747_System/examples/QSPIFormat/QSPIFormat.ino b/libraries/STM32H747_System/examples/QSPIFormat/QSPIFormat.ino index d788eb046..323a4af75 100644 --- a/libraries/STM32H747_System/examples/QSPIFormat/QSPIFormat.ino +++ b/libraries/STM32H747_System/examples/QSPIFormat/QSPIFormat.ino @@ -7,14 +7,15 @@ #error Format QSPI flash by uploading the sketch to the M7 core instead of the M4 core. #endif +using namespace mbed; -mbed::BlockDevice* root = mbed::BlockDevice::get_default_instance(); -mbed::MBRBlockDevice wifi_data(root, 1); -mbed::MBRBlockDevice ota_data(root, 2); -mbed::MBRBlockDevice user_data(root, 3); -mbed::FATFileSystem wifi_data_fs("wlan"); -mbed::FATFileSystem ota_data_fs("fs"); -mbed::FileSystem * user_data_fs; +BlockDevice* root = BlockDevice::get_default_instance(); +MBRBlockDevice wifi_data(root, 1); +MBRBlockDevice ota_data(root, 2); +MBRBlockDevice user_data(root, 3); +FATFileSystem wifi_data_fs("wlan"); +FATFileSystem ota_data_fs("fs"); +FileSystem * user_data_fs; bool waitResponse() { bool confirmation = false; @@ -60,14 +61,14 @@ void setup() { Serial.println("Do you want to proceed? Y/[n]"); if (true == waitResponse()) { - mbed::MBRBlockDevice::partition(root, 1, 0x0B, 0, 1024 * 1024); + MBRBlockDevice::partition(root, 1, 0x0B, 0, 1024 * 1024); if(default_scheme) { - mbed::MBRBlockDevice::partition(root, 3, 0x0B, 14 * 1024 * 1024, 14 * 1024 * 1024); + MBRBlockDevice::partition(root, 3, 0x0B, 14 * 1024 * 1024, 14 * 1024 * 1024); mbed::MBRBlockDevice::partition(root, 2, 0x0B, 1024 * 1024, 14 * 1024 * 1024); // use space from 15.5MB to 16 MB for another fw, memory mapped } else { - mbed::MBRBlockDevice::partition(root, 2, 0x0B, 1024 * 1024, 6 * 1024 * 1024); - mbed::MBRBlockDevice::partition(root, 3, 0x0B, 6 * 1024 * 1024, 14 * 1024 * 1024); + MBRBlockDevice::partition(root, 2, 0x0B, 1024 * 1024, 6 * 1024 * 1024); + MBRBlockDevice::partition(root, 3, 0x0B, 6 * 1024 * 1024, 14 * 1024 * 1024); // use space from 15.5MB to 16 MB for another fw, memory mapped } From 70aa36985a0f423a879281eda2e04e8d0310bb27 Mon Sep 17 00:00:00 2001 From: Andrea Gilardoni Date: Mon, 23 Sep 2024 15:43:28 +0200 Subject: [PATCH 03/11] added an additional parition for provisioning in QSPIFormat sketch --- libraries/STM32H747_System/examples/QSPIFormat/QSPIFormat.ino | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libraries/STM32H747_System/examples/QSPIFormat/QSPIFormat.ino b/libraries/STM32H747_System/examples/QSPIFormat/QSPIFormat.ino index 323a4af75..0116521f6 100644 --- a/libraries/STM32H747_System/examples/QSPIFormat/QSPIFormat.ino +++ b/libraries/STM32H747_System/examples/QSPIFormat/QSPIFormat.ino @@ -12,7 +12,8 @@ using namespace mbed; BlockDevice* root = BlockDevice::get_default_instance(); MBRBlockDevice wifi_data(root, 1); MBRBlockDevice ota_data(root, 2); -MBRBlockDevice user_data(root, 3); +MBRBlockDevice kvstore_data(root, 3); +MBRBlockDevice user_data(root, 4); FATFileSystem wifi_data_fs("wlan"); FATFileSystem ota_data_fs("fs"); FileSystem * user_data_fs; From d6fecc0bb5751e3ee5ac30efef5466392c754ff4 Mon Sep 17 00:00:00 2001 From: pennam Date: Mon, 5 May 2025 16:30:11 +0200 Subject: [PATCH 04/11] QSPIFormat: remove partition scheme selection Make partition scheme 2 the default one. Always create 4 partitions. --- .../examples/QSPIFormat/QSPIFormat.ino | 58 +++++++------------ 1 file changed, 22 insertions(+), 36 deletions(-) diff --git a/libraries/STM32H747_System/examples/QSPIFormat/QSPIFormat.ino b/libraries/STM32H747_System/examples/QSPIFormat/QSPIFormat.ino index 0116521f6..c2112a381 100644 --- a/libraries/STM32H747_System/examples/QSPIFormat/QSPIFormat.ino +++ b/libraries/STM32H747_System/examples/QSPIFormat/QSPIFormat.ino @@ -46,32 +46,20 @@ void setup() { Serial.begin(115200); while (!Serial); - Serial.println("Available partition schemes:"); - Serial.println("\nPartition scheme 1"); - Serial.println("Partition 1: WiFi firmware and certificates 1MB"); - Serial.println("Partition 2: OTA and user data 13MB"); - Serial.println("\nPartition scheme 2"); + Serial.println("\nWARNING! Running the sketch all the content of the QSPI flash will be erased."); + Serial.println("The following partitions will be created:"); Serial.println("Partition 1: WiFi firmware and certificates 1MB"); Serial.println("Partition 2: OTA 5MB"); - Serial.println("Partition 3: User data 8MB"), - Serial.println("\nDo you want to use partition scheme 1? Y/[n]"); - Serial.println("If No, partition scheme 2 will be used."); - bool default_scheme = waitResponse(); - - Serial.println("\nWARNING! Running the sketch all the content of the QSPI flash will be erased."); + Serial.println("Partition 3: Provisioning KVStore 1MB"); + Serial.println("Partition 4: User data / OPTA PLC runtime 7MB"), Serial.println("Do you want to proceed? Y/[n]"); if (true == waitResponse()) { - MBRBlockDevice::partition(root, 1, 0x0B, 0, 1024 * 1024); - if(default_scheme) { - MBRBlockDevice::partition(root, 3, 0x0B, 14 * 1024 * 1024, 14 * 1024 * 1024); - mbed::MBRBlockDevice::partition(root, 2, 0x0B, 1024 * 1024, 14 * 1024 * 1024); - // use space from 15.5MB to 16 MB for another fw, memory mapped - } else { - MBRBlockDevice::partition(root, 2, 0x0B, 1024 * 1024, 6 * 1024 * 1024); - MBRBlockDevice::partition(root, 3, 0x0B, 6 * 1024 * 1024, 14 * 1024 * 1024); - // use space from 15.5MB to 16 MB for another fw, memory mapped - } + MBRBlockDevice::partition(root, 1, 0x0B, 0, 1 * 1024 * 1024); + MBRBlockDevice::partition(root, 2, 0x0B, 1 * 1024 * 1024, 6 * 1024 * 1024); + MBRBlockDevice::partition(root, 3, 0x0B, 6 * 1024 * 1024, 7 * 1024 * 1024); + MBRBlockDevice::partition(root, 4, 0x0B, 7 * 1024 * 1024, 14 * 1024 * 1024); + // use space from 15.5MB to 16 MB for another fw, memory mapped int err = wifi_data_fs.reformat(&wifi_data); if (err) { @@ -85,23 +73,21 @@ void setup() { return; } - if(!default_scheme) { - Serial.println("\nDo you want to use LittleFS to format user data partition? Y/[n]"); - Serial.println("If No, FatFS will be used to format user partition."); + Serial.println("\nDo you want to use LittleFS to format user data partition? Y/[n]"); + Serial.println("If No, FatFS will be used to format user partition."); - if (true == waitResponse()) { - Serial.println("Formatting user partition with LittleFS."); - user_data_fs = new mbed::LittleFileSystem("user"); - } else { - Serial.println("Formatting user partition with FatFS."); - user_data_fs = new mbed::FATFileSystem("user"); - } + if (true == waitResponse()) { + Serial.println("Formatting user partition with LittleFS."); + user_data_fs = new mbed::LittleFileSystem("user"); + } else { + Serial.println("Formatting user partition with FatFS."); + user_data_fs = new mbed::FATFileSystem("user"); + } - err = user_data_fs->reformat(&user_data); - if (err) { - Serial.println("Error formatting user partition"); - return; - } + err = user_data_fs->reformat(&user_data); + if (err) { + Serial.println("Error formatting user partition"); + return; } Serial.println("\nQSPI Flash formatted!"); } From 35c5c0e07c83c19e7f95ff73966e57cac4fdd9f6 Mon Sep 17 00:00:00 2001 From: Andrea Gilardoni Date: Wed, 12 Mar 2025 11:18:14 +0100 Subject: [PATCH 05/11] removed trailing spaces --- libraries/STM32H747_System/examples/QSPIFormat/QSPIFormat.ino | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/STM32H747_System/examples/QSPIFormat/QSPIFormat.ino b/libraries/STM32H747_System/examples/QSPIFormat/QSPIFormat.ino index c2112a381..19c549538 100644 --- a/libraries/STM32H747_System/examples/QSPIFormat/QSPIFormat.ino +++ b/libraries/STM32H747_System/examples/QSPIFormat/QSPIFormat.ino @@ -3,7 +3,7 @@ #include "LittleFileSystem.h" #include "FATFileSystem.h" -#ifndef CORE_CM7 +#ifndef CORE_CM7 #error Format QSPI flash by uploading the sketch to the M7 core instead of the M4 core. #endif @@ -66,7 +66,7 @@ void setup() { Serial.println("Error formatting WiFi partition"); return; } - + err = ota_data_fs.reformat(&ota_data); if (err) { Serial.println("Error formatting OTA partition"); From 12ed4820f978f098c37e7233f3a7bfccf044332b Mon Sep 17 00:00:00 2001 From: Andrea Gilardoni Date: Mon, 23 Sep 2024 14:03:08 +0200 Subject: [PATCH 06/11] erasing MBR table before creating a new partitioning scheme --- .../STM32H747_System/examples/QSPIFormat/QSPIFormat.ino | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libraries/STM32H747_System/examples/QSPIFormat/QSPIFormat.ino b/libraries/STM32H747_System/examples/QSPIFormat/QSPIFormat.ino index 19c549538..6b7470eb1 100644 --- a/libraries/STM32H747_System/examples/QSPIFormat/QSPIFormat.ino +++ b/libraries/STM32H747_System/examples/QSPIFormat/QSPIFormat.ino @@ -55,6 +55,12 @@ void setup() { Serial.println("Do you want to proceed? Y/[n]"); if (true == waitResponse()) { + if (root->init() != BD_ERROR_OK) { + Serial.println(F("Error: QSPI init failure.")); + return; + } + + root->erase(0x0, root->get_erase_size()); MBRBlockDevice::partition(root, 1, 0x0B, 0, 1 * 1024 * 1024); MBRBlockDevice::partition(root, 2, 0x0B, 1 * 1024 * 1024, 6 * 1024 * 1024); MBRBlockDevice::partition(root, 3, 0x0B, 6 * 1024 * 1024, 7 * 1024 * 1024); From 236ea5cc713acdb2f8cd110478c9ccbc84e0b601 Mon Sep 17 00:00:00 2001 From: Andrea Gilardoni Date: Wed, 12 Mar 2025 11:17:50 +0100 Subject: [PATCH 07/11] QSPIFormat: Added confirmation request before reformatting fs --- .../examples/QSPIFormat/QSPIFormat.ino | 35 +++++++++++++++---- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/libraries/STM32H747_System/examples/QSPIFormat/QSPIFormat.ino b/libraries/STM32H747_System/examples/QSPIFormat/QSPIFormat.ino index 6b7470eb1..cf929dcd5 100644 --- a/libraries/STM32H747_System/examples/QSPIFormat/QSPIFormat.ino +++ b/libraries/STM32H747_System/examples/QSPIFormat/QSPIFormat.ino @@ -67,14 +67,29 @@ void setup() { MBRBlockDevice::partition(root, 4, 0x0B, 7 * 1024 * 1024, 14 * 1024 * 1024); // use space from 15.5MB to 16 MB for another fw, memory mapped - int err = wifi_data_fs.reformat(&wifi_data); - if (err) { + bool reformat = true; + + 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(); + + reformat = waitResponse(); + } + + if (reformat && wifi_data_fs.reformat(&wifi_data)) { Serial.println("Error formatting WiFi partition"); return; } - err = ota_data_fs.reformat(&ota_data); - if (err) { + reformat = true; + 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(); + + reformat = waitResponse(); + } + + if (reformat && ota_data_fs.reformat(&ota_data)) { Serial.println("Error formatting OTA partition"); return; } @@ -90,11 +105,19 @@ void setup() { user_data_fs = new mbed::FATFileSystem("user"); } - err = user_data_fs->reformat(&user_data); - if (err) { + reformat = true; + 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(); + + reformat = waitResponse(); + } + + if (reformat && user_data_fs->reformat(&user_data)) { Serial.println("Error formatting user partition"); return; } + Serial.println("\nQSPI Flash formatted!"); } From edeaf3d1cedbd5fca3a11c47b0e8714506421738 Mon Sep 17 00:00:00 2001 From: pennam Date: Mon, 5 May 2025 17:36:39 +0200 Subject: [PATCH 08/11] QSPIFormat: add option to restore WiFi firmware and certificates --- .../examples/QSPIFormat/QSPIFormat.ino | 70 ++++++++++++++++++- .../examples/QSPIFormat/certificates.h | 1 + 2 files changed, 70 insertions(+), 1 deletion(-) create mode 120000 libraries/STM32H747_System/examples/QSPIFormat/certificates.h diff --git a/libraries/STM32H747_System/examples/QSPIFormat/QSPIFormat.ino b/libraries/STM32H747_System/examples/QSPIFormat/QSPIFormat.ino index cf929dcd5..0a8eb53fe 100644 --- a/libraries/STM32H747_System/examples/QSPIFormat/QSPIFormat.ino +++ b/libraries/STM32H747_System/examples/QSPIFormat/QSPIFormat.ino @@ -2,6 +2,8 @@ #include "MBRBlockDevice.h" #include "LittleFileSystem.h" #include "FATFileSystem.h" +#include "wiced_resource.h" +#include "certificates.h" #ifndef CORE_CM7 #error Format QSPI flash by uploading the sketch to the M7 core instead of the M4 core. @@ -41,6 +43,20 @@ bool waitResponse() { } } +void printProgress(uint32_t offset, uint32_t size, uint32_t threshold, bool reset) { + static int percent_done = 0; + if (reset == true) { + percent_done = 0; + Serial.println("Flashed " + String(percent_done) + "%"); + } else { + uint32_t percent_done_new = offset * 100 / size; + if (percent_done_new >= percent_done + threshold) { + percent_done = percent_done_new; + Serial.println("Flashed " + String(percent_done) + "%"); + } + } +} + void setup() { Serial.begin(115200); @@ -68,7 +84,6 @@ 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)) { Serial.println("\nPartition 1 already contains a filesystem, do you want to reformat it? Y/[n]"); wifi_data_fs.unmount(); @@ -81,6 +96,16 @@ void setup() { return; } + bool restore = true; + if (reformat) { + Serial.println("\nDo you want to restore the WiFi firmware and certificates? Y/[n]"); + restore = waitResponse(); + } + + if (reformat && restore) { + flashWiFiFirmwareAndCertificates(); + } + reformat = true; if(!ota_data_fs.mount(&ota_data)) { Serial.println("\nPartition 2 already contains a filesystem, do you want to reformat it? Y/[n]"); @@ -124,6 +149,49 @@ void setup() { Serial.println("It's now safe to reboot or disconnect your board."); } +void flashWiFiFirmwareAndCertificates() { + extern const unsigned char wifi_firmware_image_data[]; + extern const resource_hnd_t wifi_firmware_image; + FILE* fp = fopen("/wlan/4343WA1.BIN", "wb"); + const int file_size = 421098; + int chunck_size = 1024; + int 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 (ret != 1) { + Serial.println("Error writing firmware data"); + break; + } + byte_count += chunck_size; + printProgress(byte_count, file_size, 10, false); + } + fclose(fp); + + fp = fopen("/wlan/cacert.pem", "wb"); + + Serial.println("Flashing certificates"); + chunck_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 (ret != 1) { + Serial.println("Error writing certificates"); + break; + } + byte_count += chunck_size; + printProgress(byte_count, cacert_pem_len, 10, false); + } + fclose(fp); +} + void loop() { } diff --git a/libraries/STM32H747_System/examples/QSPIFormat/certificates.h b/libraries/STM32H747_System/examples/QSPIFormat/certificates.h new file mode 120000 index 000000000..7b4170776 --- /dev/null +++ b/libraries/STM32H747_System/examples/QSPIFormat/certificates.h @@ -0,0 +1 @@ +../WiFiFirmwareUpdater/certificates.h \ No newline at end of file From 45c9eae3d7f52f5cba4985a14730f3f6b10904d0 Mon Sep 17 00:00:00 2001 From: pennam Date: Tue, 6 May 2025 11:21:38 +0200 Subject: [PATCH 09/11] QSPIFormat: fix warnings --- .../examples/QSPIFormat/QSPIFormat.ino | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/libraries/STM32H747_System/examples/QSPIFormat/QSPIFormat.ino b/libraries/STM32H747_System/examples/QSPIFormat/QSPIFormat.ino index 0a8eb53fe..fa55824ce 100644 --- a/libraries/STM32H747_System/examples/QSPIFormat/QSPIFormat.ino +++ b/libraries/STM32H747_System/examples/QSPIFormat/QSPIFormat.ino @@ -22,6 +22,7 @@ FileSystem * user_data_fs; bool waitResponse() { bool confirmation = false; + bool proceed = false; while (confirmation == false) { if (Serial.available()) { char choice = Serial.read(); @@ -29,18 +30,19 @@ bool waitResponse() { case 'y': case 'Y': confirmation = true; - return true; + proceed = true; break; case 'n': case 'N': confirmation = true; - return false; + proceed = false; break; default: continue; } } } + return proceed; } void printProgress(uint32_t offset, uint32_t size, uint32_t threshold, bool reset) { @@ -151,11 +153,10 @@ void setup() { void flashWiFiFirmwareAndCertificates() { extern const unsigned char wifi_firmware_image_data[]; - extern const resource_hnd_t wifi_firmware_image; FILE* fp = fopen("/wlan/4343WA1.BIN", "wb"); - const int file_size = 421098; - int chunck_size = 1024; - int byte_count = 0; + const uint32_t file_size = 421098; + uint32_t chunck_size = 1024; + uint32_t byte_count = 0; Serial.println("Flashing WiFi firmware"); printProgress(byte_count, file_size, 10, true); From 752c1e964d678ec7dd2e3a59f846e40c6e32a0a3 Mon Sep 17 00:00:00 2001 From: pennam Date: Tue, 6 May 2025 11:22:16 +0200 Subject: [PATCH 10/11] QSPIFlash: add note about LittleFS and OPTA PLC runtime --- libraries/STM32H747_System/examples/QSPIFormat/QSPIFormat.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/STM32H747_System/examples/QSPIFormat/QSPIFormat.ino b/libraries/STM32H747_System/examples/QSPIFormat/QSPIFormat.ino index fa55824ce..1d4a90834 100644 --- a/libraries/STM32H747_System/examples/QSPIFormat/QSPIFormat.ino +++ b/libraries/STM32H747_System/examples/QSPIFormat/QSPIFormat.ino @@ -123,7 +123,7 @@ void setup() { Serial.println("\nDo you want to use LittleFS to format user data partition? Y/[n]"); Serial.println("If No, FatFS will be used to format user partition."); - + Serial.println("Note: LittleFS is not supported by the OPTA PLC runtime."); if (true == waitResponse()) { Serial.println("Formatting user partition with LittleFS."); user_data_fs = new mbed::LittleFileSystem("user"); From a831fd2485bfbeb75b55f3b38d9f510a17c4174e Mon Sep 17 00:00:00 2001 From: pennam Date: Tue, 6 May 2025 11:22:47 +0200 Subject: [PATCH 11/11] QSPIFormat: add option to perform a full erase --- .../STM32H747_System/examples/QSPIFormat/QSPIFormat.ino | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libraries/STM32H747_System/examples/QSPIFormat/QSPIFormat.ino b/libraries/STM32H747_System/examples/QSPIFormat/QSPIFormat.ino index 1d4a90834..b3ecbf222 100644 --- a/libraries/STM32H747_System/examples/QSPIFormat/QSPIFormat.ino +++ b/libraries/STM32H747_System/examples/QSPIFormat/QSPIFormat.ino @@ -78,7 +78,14 @@ void setup() { return; } - root->erase(0x0, root->get_erase_size()); + Serial.println("Do you want to perform a full erase of the QSPI flash before proceeding? Y/[n]"); + if (true == waitResponse()) { + root->erase(0x0, root->size()); + } else { + // Erase only the first sector containing the MBR + root->erase(0x0, root->get_erase_size()); + } + MBRBlockDevice::partition(root, 1, 0x0B, 0, 1 * 1024 * 1024); MBRBlockDevice::partition(root, 2, 0x0B, 1 * 1024 * 1024, 6 * 1024 * 1024); MBRBlockDevice::partition(root, 3, 0x0B, 6 * 1024 * 1024, 7 * 1024 * 1024); pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy