66
77QSPIFBlockDevice root (PD_11, PD_12, PF_7, PD_13, PF_10, PG_6, QSPIF_POLARITY_MODE_1, 40000000 );
88mbed::MBRBlockDevice wifi_data (&root, 1 );
9- mbed::MBRBlockDevice other_data (&root, 2 );
109mbed::FATFileSystem wifi_data_fs (" wlan" );
1110mbed::FATFileSystem other_data_fs (" fs" );
1211
@@ -23,8 +22,8 @@ void setup() {
2322 Serial.begin (115200 );
2423 while (!Serial);
2524
26- mbed::MBRBlockDevice::partition (&root, 1 , 0x0B , 0 , 1024 * 1024 * 8 );
27- mbed::MBRBlockDevice::partition (&root, 2 , 0x0B , 1024 * 1024 * 8 , 2048 * 1024 * 8 );
25+ mbed::MBRBlockDevice::partition (&root, 1 , 0x0B , 0 , 1024 * 1024 );
26+ // use space from 15.5MB to 16 MB for another fw, memory mapped
2827
2928 int err = wifi_data_fs.mount (&wifi_data);
3029 if (err) {
@@ -34,14 +33,6 @@ void setup() {
3433 err = wifi_data_fs.reformat (&wifi_data);
3534 }
3635
37- err = other_data_fs.mount (&other_data);
38- if (err) {
39- // Reformat if we can't mount the filesystem
40- // this should only happen on the first boot
41- Serial.println (" No filesystem found, formatting... " );
42- err = other_data_fs.reformat (&other_data);
43- }
44-
4536 DIR *dir;
4637 struct dirent *ent;
4738
@@ -75,6 +66,8 @@ void setup() {
7566 int ret = fwrite (wifi_firmware_image_data, 421098 , 1 , fp);
7667 fclose (fp);
7768
69+ root.program (wifi_firmware_image_data, 15 * 1024 * 1024 + 1024 * 512 , 421098 );
70+
7871 fp = fopen (" /wlan/cacert.pem" , " wb" );
7972 ret = fwrite (cacert_pem, cacert_pem_len, 1 , fp);
8073 fclose (fp);
@@ -94,4 +87,4 @@ void setup() {
9487
9588void loop () {
9689
97- }
90+ }
0 commit comments