1111QSPIFBlockDevice root(QSPI_SO0, QSPI_SO1, QSPI_SO2, QSPI_SO3, QSPI_SCK, QSPI_CS, QSPIF_POLARITY_MODE_1, 40000000);
1212mbed::MBRBlockDevice wifi_data(&root, 1);
1313mbed::MBRBlockDevice ota_data(&root, 2);
14- mbed::MBRBlockDevice user_data(&root, 3);
14+ mbed::MBRBlockDevice kvstore_data(&root, 3);
15+ mbed::MBRBlockDevice user_data(&root, 4);
1516mbed::FATFileSystem wifi_data_fs("wlan");
1617mbed::FATFileSystem ota_data_fs("fs");
1718mbed::FileSystem * user_data_fs;
@@ -47,11 +48,13 @@ void setup() {
4748 Serial.println("Available partition schemes:");
4849 Serial.println("\nPartition scheme 1");
4950 Serial.println("Partition 1: WiFi firmware and certificates 1MB");
50- Serial.println("Partition 2: OTA and user data 13MB");
51+ Serial.println("Partition 2: OTA and user data 12MB");
52+ Serial.println("Partition 3: Provisioning KVStore 1MB");
5153 Serial.println("\nPartition scheme 2");
5254 Serial.println("Partition 1: WiFi firmware and certificates 1MB");
5355 Serial.println("Partition 2: OTA 5MB");
54- Serial.println("Partition 3: User data 8MB"),
56+ Serial.println("Partition 3: Provisioning KVStore 1MB");
57+ Serial.println("Partition 4: User data 7MB"),
5558 Serial.println("\nDo you want to use partition scheme 1? Y/[n]");
5659 Serial.println("If No, partition scheme 2 will be used.");
5760 bool default_scheme = waitResponse();
@@ -69,12 +72,14 @@ void setup() {
6972
7073 mbed::MBRBlockDevice::partition(&root, 1, 0x0B, 0, 1024 * 1024);
7174 if(default_scheme) {
72- mbed::MBRBlockDevice::partition(&root, 3, 0x0B, 14 * 1024 * 1024, 14 * 1024 * 1024);
73- mbed::MBRBlockDevice::partition(&root, 2, 0x0B, 1024 * 1024, 14 * 1024 * 1024);
75+ mbed::MBRBlockDevice::partition(&root, 2, 0x0B, 1024 * 1024, 13 * 1024 * 1024);
76+ mbed::MBRBlockDevice::partition(&root, 3, 0x0B, 13 * 1024 * 1024, 14 * 1024 * 1024);
77+ mbed::MBRBlockDevice::partition(&root, 4, 0x0B, 14 * 1024 * 1024, 14 * 1024 * 1024);
7478 // use space from 15.5MB to 16 MB for another fw, memory mapped
7579 } else {
7680 mbed::MBRBlockDevice::partition(&root, 2, 0x0B, 1024 * 1024, 6 * 1024 * 1024);
77- mbed::MBRBlockDevice::partition(&root, 3, 0x0B, 6 * 1024 * 1024, 14 * 1024 * 1024);
81+ mbed::MBRBlockDevice::partition(&root, 3, 0x0B, 6* 1024 * 1024, 7 * 1024 * 1024);
82+ mbed::MBRBlockDevice::partition(&root, 4, 0x0B, 7 * 1024 * 1024, 14 * 1024 * 1024);
7883 // use space from 15.5MB to 16 MB for another fw, memory mapped
7984 }
8085
@@ -83,7 +88,7 @@ void setup() {
8388 Serial.println("Error formatting WiFi partition");
8489 return;
8590 }
86-
91+
8792 err = ota_data_fs.reformat(&ota_data);
8893 if (err) {
8994 Serial.println("Error formatting OTA partition");
0 commit comments