1
1
#include " QSPIFBlockDevice.h"
2
2
#include " MBRBlockDevice.h"
3
3
#include " FATFileSystem.h"
4
+ #include " wiced_resource.h"
4
5
5
6
QSPIFBlockDevice root (PD_11, PD_12, PF_7, PD_13, PF_10, PG_6, QSPIF_POLARITY_MODE_1, 40000000 );
6
7
mbed::MBRBlockDevice wifi_data (&root, 1 );
7
8
mbed::MBRBlockDevice other_data (&root, 2 );
8
9
mbed::FATFileSystem wifi_data_fs (" wlan" );
9
10
mbed::FATFileSystem other_data_fs (" fs" );
10
11
12
+ long getFileSize (FILE *fp) {
13
+ fseek (fp, 0 , SEEK_END);
14
+ int size = ftell (fp);
15
+ fseek (fp, 0 , SEEK_SET);
16
+
17
+ return size;
18
+ }
19
+
11
20
void setup () {
12
21
13
22
Serial.begin (115200 );
@@ -46,6 +55,7 @@ void setup() {
46
55
if (Serial.available ()) {
47
56
int c = Serial.read ();
48
57
if (c == ' Y' || c == ' y' ) {
58
+ wifi_data_fs.reformat (&wifi_data);
49
59
break ;
50
60
}
51
61
if (c == ' N' || c == ' n' ) {
@@ -59,10 +69,13 @@ void setup() {
59
69
}
60
70
61
71
extern const unsigned char wifi_firmware_image_data[];
62
- FILE* fp = fopen (" /wlan/4343WA1.BIN" , " w" );
63
- fwrite (wifi_firmware_image_data, 420690 , 1 , fp);
72
+ extern const resource_hnd_t wifi_firmware_image;
73
+ FILE* fp = fopen (" /wlan/4343WA1.BIN" , " wb" );
74
+ int ret = fwrite (wifi_firmware_image_data, 421098 , 1 , fp);
64
75
fclose (fp);
65
76
77
+ Serial.println (ret);
78
+ Serial.println (wifi_firmware_image.size );
66
79
Serial.println (" Firmware and certificates updated!" );
67
80
}
68
81
0 commit comments