Skip to content

Commit da2db07

Browse files
committed
SFU: move ota partition at the end of flash
1 parent 9213198 commit da2db07

File tree

3 files changed

+23
-10
lines changed

3 files changed

+23
-10
lines changed

libraries/SFU/extra/main.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@
99
#define FULL_UPDATE_FILE_PATH "/" SD_MOUNT_PATH "/" MBED_CONF_APP_UPDATE_FILE
1010

1111
#define POST_APPLICATION_ADDR 0x10000
12+
#define VERSION 1
1213

1314
#if !defined(POST_APPLICATION_ADDR)
1415
#error "target.restrict_size must be set for your target in mbed_app.json"
1516
#endif
1617

1718
//Pin order: MOSI, MISO, SCK, CS
18-
//FlashIAPBlockDevice sd(XIP_BASE + 0xF00000, 0x100000);
19-
FlashIAPBlockDevice sd(XIP_BASE + 0x100000, 0x100000);
19+
FlashIAPBlockDevice sd(XIP_BASE + 0xF00000, 0x100000);
20+
//FlashIAPBlockDevice sd(XIP_BASE + 0x100000, 0x100000);
2021
FATFileSystem fs(SD_MOUNT_PATH);
2122
FlashIAP flash;
2223

libraries/SFU/extra/mbed-os.lib

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
https://github.com/arduino/mbed-os/#1820aade78cbc3e3231def2c3ffd0b363bf1778c
1+
https://github.com/arduino/mbed-os/#45445a4b76d8d05d6083f8bf481e5b4efe7bf1c7

libraries/SFU/src/SFU.cpp

+19-7
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,34 @@
11
#include "SFU.h"
22
#include "FlashIAPBlockDevice.h"
33
#include "FATFileSystem.h"
4-
//#include "PluggableUSBMSD.h"
4+
#include "PluggableUSBMSD.h"
55

66
const unsigned char SFU[0x10000] __attribute__ ((section(".second_stage_ota"), used)) = {
77
#include "rp2040.h"
88
};
99

10-
FlashIAPBlockDevice bd(XIP_BASE + 0x100000, 0x100000);
11-
static mbed::FATFileSystem fs("ota");
10+
FlashIAPBlockDevice bd(XIP_BASE + 0xF00000, 0x100000);
1211

13-
int SFU::begin() {
14-
int err = fs.mount(&bd);
15-
if (err) {
16-
err = fs.reformat(&bd);
12+
void USBMSD::begin()
13+
{
14+
int err = getFileSystem().mount(&bd);
15+
if (err) {
16+
err = getFileSystem().reformat(&bd);
1717
}
1818
}
1919

20+
mbed::FATFileSystem& USBMSD::getFileSystem()
21+
{
22+
static mbed::FATFileSystem fs("ota");
23+
return fs;
24+
}
25+
26+
USBMSD MassStorage(&bd);
27+
28+
int SFU::begin() {
29+
MassStorage.begin();
30+
}
31+
2032
int SFU::download(const char* url) {
2133
// No download at the moment, allow the user to upload a file via mass storage
2234
}

0 commit comments

Comments
 (0)