@@ -46,32 +46,20 @@ void setup() {
46
46
Serial.begin (115200 );
47
47
while (!Serial);
48
48
49
- Serial.println (" Available partition schemes:" );
50
- Serial.println (" \n Partition 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 (" \n Partition scheme 2" );
49
+ Serial.println (" \n WARNING! Running the sketch all the content of the QSPI flash will be erased." );
50
+ Serial.println (" The following partitions will be created:" );
54
51
Serial.println (" Partition 1: WiFi firmware and certificates 1MB" );
55
52
Serial.println (" Partition 2: OTA 5MB" );
56
- Serial.println (" Partition 3: User data 8MB" ),
57
- Serial.println (" \n Do 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 (" \n WARNING! 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" ),
62
55
Serial.println (" Do you want to proceed? Y/[n]" );
63
56
64
57
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
75
63
76
64
int err = wifi_data_fs.reformat (&wifi_data);
77
65
if (err) {
@@ -85,23 +73,21 @@ void setup() {
85
73
return ;
86
74
}
87
75
88
- if (!default_scheme) {
89
- Serial.println (" \n Do 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 (" \n Do 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." );
91
78
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
+ }
99
86
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 ;
105
91
}
106
92
Serial.println (" \n QSPI Flash formatted!" );
107
93
}
0 commit comments