Skip to content

Commit d6fecc0

Browse files
committed
QSPIFormat: remove partition scheme selection
Make partition scheme 2 the default one. Always create 4 partitions.
1 parent 70aa369 commit d6fecc0

File tree

1 file changed

+22
-36
lines changed

1 file changed

+22
-36
lines changed

libraries/STM32H747_System/examples/QSPIFormat/QSPIFormat.ino

Lines changed: 22 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -46,32 +46,20 @@ void setup() {
4646
Serial.begin(115200);
4747
while (!Serial);
4848

49-
Serial.println("Available partition schemes:");
50-
Serial.println("\nPartition scheme 1");
51-
Serial.println("Partition 1: WiFi firmware and certificates 1MB");
52-
Serial.println("Partition 2: OTA and user data 13MB");
53-
Serial.println("\nPartition scheme 2");
49+
Serial.println("\nWARNING! Running the sketch all the content of the QSPI flash will be erased.");
50+
Serial.println("The following partitions will be created:");
5451
Serial.println("Partition 1: WiFi firmware and certificates 1MB");
5552
Serial.println("Partition 2: OTA 5MB");
56-
Serial.println("Partition 3: User data 8MB"),
57-
Serial.println("\nDo you want to use partition scheme 1? Y/[n]");
58-
Serial.println("If No, partition scheme 2 will be used.");
59-
bool default_scheme = waitResponse();
60-
61-
Serial.println("\nWARNING! Running the sketch all the content of the QSPI flash will be erased.");
53+
Serial.println("Partition 3: Provisioning KVStore 1MB");
54+
Serial.println("Partition 4: User data / OPTA PLC runtime 7MB"),
6255
Serial.println("Do you want to proceed? Y/[n]");
6356

6457
if (true == waitResponse()) {
65-
MBRBlockDevice::partition(root, 1, 0x0B, 0, 1024 * 1024);
66-
if(default_scheme) {
67-
MBRBlockDevice::partition(root, 3, 0x0B, 14 * 1024 * 1024, 14 * 1024 * 1024);
68-
mbed::MBRBlockDevice::partition(root, 2, 0x0B, 1024 * 1024, 14 * 1024 * 1024);
69-
// use space from 15.5MB to 16 MB for another fw, memory mapped
70-
} else {
71-
MBRBlockDevice::partition(root, 2, 0x0B, 1024 * 1024, 6 * 1024 * 1024);
72-
MBRBlockDevice::partition(root, 3, 0x0B, 6 * 1024 * 1024, 14 * 1024 * 1024);
73-
// use space from 15.5MB to 16 MB for another fw, memory mapped
74-
}
58+
MBRBlockDevice::partition(root, 1, 0x0B, 0, 1 * 1024 * 1024);
59+
MBRBlockDevice::partition(root, 2, 0x0B, 1 * 1024 * 1024, 6 * 1024 * 1024);
60+
MBRBlockDevice::partition(root, 3, 0x0B, 6 * 1024 * 1024, 7 * 1024 * 1024);
61+
MBRBlockDevice::partition(root, 4, 0x0B, 7 * 1024 * 1024, 14 * 1024 * 1024);
62+
// use space from 15.5MB to 16 MB for another fw, memory mapped
7563

7664
int err = wifi_data_fs.reformat(&wifi_data);
7765
if (err) {
@@ -85,23 +73,21 @@ void setup() {
8573
return;
8674
}
8775

88-
if(!default_scheme) {
89-
Serial.println("\nDo you want to use LittleFS to format user data partition? Y/[n]");
90-
Serial.println("If No, FatFS will be used to format user partition.");
76+
Serial.println("\nDo you want to use LittleFS to format user data partition? Y/[n]");
77+
Serial.println("If No, FatFS will be used to format user partition.");
9178

92-
if (true == waitResponse()) {
93-
Serial.println("Formatting user partition with LittleFS.");
94-
user_data_fs = new mbed::LittleFileSystem("user");
95-
} else {
96-
Serial.println("Formatting user partition with FatFS.");
97-
user_data_fs = new mbed::FATFileSystem("user");
98-
}
79+
if (true == waitResponse()) {
80+
Serial.println("Formatting user partition with LittleFS.");
81+
user_data_fs = new mbed::LittleFileSystem("user");
82+
} else {
83+
Serial.println("Formatting user partition with FatFS.");
84+
user_data_fs = new mbed::FATFileSystem("user");
85+
}
9986

100-
err = user_data_fs->reformat(&user_data);
101-
if (err) {
102-
Serial.println("Error formatting user partition");
103-
return;
104-
}
87+
err = user_data_fs->reformat(&user_data);
88+
if (err) {
89+
Serial.println("Error formatting user partition");
90+
return;
10591
}
10692
Serial.println("\nQSPI Flash formatted!");
10793
}

0 commit comments

Comments
 (0)