File tree Expand file tree Collapse file tree 2 files changed +26
-14
lines changed Expand file tree Collapse file tree 2 files changed +26
-14
lines changed Original file line number Diff line number Diff line change 11#include " SFU.h"
22#include " FlashIAPBlockDevice.h"
3- #include " FATFileSystem .h"
3+ #if __has_include("PluggableUSBMSD .h")
44#include " PluggableUSBMSD.h"
5+ #define ADD_USB_MSD
6+ #endif
57
68const unsigned char SFU[0x10000 ] __attribute__ ((section(" .second_stage_ota" ), used)) = {
79 #include " rp2040.h"
810};
911
1012FlashIAPBlockDevice bd (XIP_BASE + 0xF00000 , 0x100000 );
1113
12- void USBMSD::begin ()
13- {
14- int err = getFileSystem ().mount (&bd);
15- if (err) {
16- err = getFileSystem ().reformat (&bd);
17- }
18- }
19-
20- mbed::FATFileSystem& USBMSD::getFileSystem ()
21- {
14+ mbed::FATFileSystem& SFU::getFileSystem () {
2215 static mbed::FATFileSystem fs (" ota" );
2316 return fs;
2417}
2518
26- USBMSD MassStorage (&bd);
27-
2819int SFU::begin () {
29- MassStorage.begin ();
20+ int err = getFileSystem ().mount (&bd);
21+ if (err) {
22+ err = getFileSystem ().reformat (&bd);
23+ }
3024}
3125
3226int SFU::download (const char * url) {
@@ -36,3 +30,19 @@ int SFU::download(const char* url) {
3630int SFU::apply () {
3731 // No autoreboot
3832}
33+
34+ #ifdef ADD_USB_MSD
35+
36+ void USBMSD::begin ()
37+ {
38+ SFU::begin ();
39+ }
40+
41+ mbed::FATFileSystem& USBMSD::getFileSystem ()
42+ {
43+ return SFU::getFileSystem ();
44+ }
45+
46+ USBMSD MassStorage (&bd);
47+
48+ #endif
Original file line number Diff line number Diff line change 11#pragma once
22
33#include " WiFiNINA.h"
4+ #include " FATFileSystem.h"
45
56class SFU {
67public:
78 static int begin ();
89 static int download (const char * url);
910 static int apply ();
11+ static mbed::FATFileSystem& getFileSystem ();
1012};
You can’t perform that action at this time.
0 commit comments