Skip to content

Commit 97f0b89

Browse files
committed
WiFi: restructure fw partitions
The firmware will be copied in both the /wlan filesystem and as raw address 0xF80000 (to be added as offset to QSPI base address 0x90000000)
1 parent aafe36f commit 97f0b89

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

libraries/WiFi/examples/PortentaWiFiFirmwareUpdater/PortentaWiFiFirmwareUpdater.ino

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
QSPIFBlockDevice root(PD_11, PD_12, PF_7, PD_13, PF_10, PG_6, QSPIF_POLARITY_MODE_1, 40000000);
88
mbed::MBRBlockDevice wifi_data(&root, 1);
9-
mbed::MBRBlockDevice other_data(&root, 2);
109
mbed::FATFileSystem wifi_data_fs("wlan");
1110
mbed::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

9588
void loop() {
9689

97-
}
90+
}

libraries/WiFi/src/WiFi.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ mbed::FATFileSystem wifi_data_fs("wlan");
289289
bool firmware_available = false;
290290

291291
extern "C" bool wiced_filesystem_mount() {
292-
mbed::MBRBlockDevice::partition(&root, 1, 0x0B, 0, 1024 * 1024 * 8);
292+
mbed::MBRBlockDevice::partition(&root, 1, 0x0B, 0, 1024 * 1024);
293293
int err = wifi_data_fs.mount(&wifi_data);
294294
if (err) {
295295
Serial.println("Failed to mount filesystem");

0 commit comments

Comments
 (0)