File tree 2 files changed +21
-10
lines changed
2 files changed +21
-10
lines changed Original file line number Diff line number Diff line change @@ -110,16 +110,6 @@ bool isSpiffsFilenameValid(const char* name)
110
110
111
111
// these symbols should be defined in the linker script for each flash layout
112
112
#ifdef ARDUINO
113
- extern " C" uint32_t _SPIFFS_start;
114
- extern " C" uint32_t _SPIFFS_end;
115
- extern " C" uint32_t _SPIFFS_page;
116
- extern " C" uint32_t _SPIFFS_block;
117
-
118
- #define SPIFFS_PHYS_ADDR ((uint32_t ) (&_SPIFFS_start) - 0x40200000 )
119
- #define SPIFFS_PHYS_SIZE ((uint32_t ) (&_SPIFFS_end) - (uint32_t ) (&_SPIFFS_start))
120
- #define SPIFFS_PHYS_PAGE ((uint32_t ) &_SPIFFS_page)
121
- #define SPIFFS_PHYS_BLOCK ((uint32_t ) &_SPIFFS_block)
122
-
123
113
#ifndef SPIFFS_MAX_OPEN_FILES
124
114
#define SPIFFS_MAX_OPEN_FILES 5
125
115
#endif
Original file line number Diff line number Diff line change 35
35
36
36
using namespace fs ;
37
37
38
+ extern " C" uint32_t _SPIFFS_start;
39
+ extern " C" uint32_t _SPIFFS_end;
40
+ extern " C" uint32_t _SPIFFS_page;
41
+ extern " C" uint32_t _SPIFFS_block;
42
+
43
+ #define SPIFFS_PHYS_ADDR ((uint32_t ) (&_SPIFFS_start) - 0x40200000 )
44
+ #define SPIFFS_PHYS_SIZE ((uint32_t ) (&_SPIFFS_end) - (uint32_t ) (&_SPIFFS_start))
45
+ #define SPIFFS_PHYS_PAGE ((uint32_t ) &_SPIFFS_page)
46
+ #define SPIFFS_PHYS_BLOCK ((uint32_t ) &_SPIFFS_block)
47
+
38
48
extern int32_t spiffs_hal_write (uint32_t addr, uint32_t size, uint8_t *src);
39
49
extern int32_t spiffs_hal_erase (uint32_t addr, uint32_t size);
40
50
extern int32_t spiffs_hal_read (uint32_t addr, uint32_t size, uint8_t *dst);
@@ -114,6 +124,14 @@ class SPIFFSImpl : public FSImpl
114
124
115
125
bool begin () override
116
126
{
127
+ return begin (true );
128
+ }
129
+
130
+ bool begin (bool autoformat)
131
+ {
132
+ if (_SPIFFS_start <= _SPIFFS_end)
133
+ return false ;
134
+
117
135
if (SPIFFS_mounted (&_fs) != 0 ) {
118
136
return true ;
119
137
}
@@ -124,6 +142,9 @@ class SPIFFSImpl : public FSImpl
124
142
if (_tryMount ()) {
125
143
return true ;
126
144
}
145
+ if (!autoformat) {
146
+ return false ;
147
+ }
127
148
auto rc = SPIFFS_format (&_fs);
128
149
if (rc != SPIFFS_OK) {
129
150
DEBUGV (" SPIFFS_format: rc=%d, err=%d\r\n " , rc, _fs.err_code );
You can’t perform that action at this time.
0 commit comments