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

[STM32H7] Provisioning fs reformat#957

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

Closed
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
61 changes: 47 additions & 14 deletionslibraries/STM32H747_System/examples/QSPIFormat/QSPIFormat.ino
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,15 +3,16 @@
#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


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::MBRBlockDevice kvstore_data(&root, 3);
mbed::MBRBlockDevice user_data(&root, 4);
mbed::FATFileSystem wifi_data_fs("wlan");
mbed::FATFileSystem ota_data_fs("fs");
mbed::FileSystem * user_data_fs;
Expand DownExpand Up@@ -47,11 +48,13 @@ void setup() {
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("Partition 2: OTA and user data 12MB");
Serial.println("Partition 3: Provisioning KVStore 1MB");
Serial.println("\nPartition scheme 2");
Serial.println("Partition 1: WiFi firmware and certificates 1MB");
Serial.println("Partition 2: OTA 5MB");
Serial.println("Partition 3: User data 8MB"),
Serial.println("Partition 3: Provisioning KVStore 1MB");
Serial.println("Partition 4: User data 7MB"),
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();
Expand All@@ -60,25 +63,48 @@ void setup() {
Serial.println("Do you want to proceed? Y/[n]");

if (true == waitResponse()) {
if (root.init() != QSPIF_BD_ERROR_OK) {
Serial.println(F("Error: QSPI init failure."));
return;
}

root.erase(0x0, root.get_erase_size());

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,2, 0x0B, 1024 * 1024,13 * 1024 * 1024);
mbed::MBRBlockDevice::partition(&root,3, 0x0B, 13 * 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, 3, 0x0B, 6* 1024 * 1024, 7 * 1024 * 1024);
mbed::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;
}
Expand All@@ -95,8 +121,15 @@ 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 3 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;
}
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp