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 1
1
#include " SFU.h"
2
2
#include " FlashIAPBlockDevice.h"
3
- #include " FATFileSystem .h"
3
+ #if __has_include("PluggableUSBMSD .h")
4
4
#include " PluggableUSBMSD.h"
5
+ #define ADD_USB_MSD
6
+ #endif
5
7
6
8
const unsigned char SFU[0x10000 ] __attribute__ ((section(" .second_stage_ota" ), used)) = {
7
9
#include " rp2040.h"
8
10
};
9
11
10
12
FlashIAPBlockDevice bd (XIP_BASE + 0xF00000 , 0x100000 );
11
13
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 () {
22
15
static mbed::FATFileSystem fs (" ota" );
23
16
return fs;
24
17
}
25
18
26
- USBMSD MassStorage (&bd);
27
-
28
19
int SFU::begin () {
29
- MassStorage.begin ();
20
+ int err = getFileSystem ().mount (&bd);
21
+ if (err) {
22
+ err = getFileSystem ().reformat (&bd);
23
+ }
30
24
}
31
25
32
26
int SFU::download (const char * url) {
@@ -36,3 +30,19 @@ int SFU::download(const char* url) {
36
30
int SFU::apply () {
37
31
// No autoreboot
38
32
}
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 1
1
#pragma once
2
2
3
3
#include " WiFiNINA.h"
4
+ #include " FATFileSystem.h"
4
5
5
6
class SFU {
6
7
public:
7
8
static int begin ();
8
9
static int download (const char * url);
9
10
static int apply ();
11
+ static mbed::FATFileSystem& getFileSystem ();
10
12
};
You can’t perform that action at this time.
0 commit comments