File tree Expand file tree Collapse file tree 2 files changed +16
-10
lines changed
Expand file tree Collapse file tree 2 files changed +16
-10
lines changed Original file line number Diff line number Diff line change @@ -111,16 +111,6 @@ bool isSpiffsFilenameValid(const char* name)
111111// these symbols should be defined in the linker script for each flash layout
112112#ifndef CORE_MOCK
113113#ifdef ARDUINO
114- extern " C" uint32_t _SPIFFS_start;
115- extern " C" uint32_t _SPIFFS_end;
116- extern " C" uint32_t _SPIFFS_page;
117- extern " C" uint32_t _SPIFFS_block;
118-
119- #define SPIFFS_PHYS_ADDR ((uint32_t ) (&_SPIFFS_start) - 0x40200000 )
120- #define SPIFFS_PHYS_SIZE ((uint32_t ) (&_SPIFFS_end) - (uint32_t ) (&_SPIFFS_start))
121- #define SPIFFS_PHYS_PAGE ((uint32_t ) &_SPIFFS_page)
122- #define SPIFFS_PHYS_BLOCK ((uint32_t ) &_SPIFFS_block)
123-
124114#ifndef SPIFFS_MAX_OPEN_FILES
125115#define SPIFFS_MAX_OPEN_FILES 5
126116#endif
Original file line number Diff line number Diff line change 3535
3636using namespace fs ;
3737
38+ #ifdef ARDUINO
39+ extern " C" uint32_t _SPIFFS_start;
40+ extern " C" uint32_t _SPIFFS_end;
41+ extern " C" uint32_t _SPIFFS_page;
42+ extern " C" uint32_t _SPIFFS_block;
43+
44+ #define SPIFFS_PHYS_ADDR ((uint32_t ) (&_SPIFFS_start) - 0x40200000 )
45+ #define SPIFFS_PHYS_SIZE ((uint32_t ) (&_SPIFFS_end) - (uint32_t ) (&_SPIFFS_start))
46+ #define SPIFFS_PHYS_PAGE ((uint32_t ) &_SPIFFS_page)
47+ #define SPIFFS_PHYS_BLOCK ((uint32_t ) &_SPIFFS_block)
48+ #endif
49+
3850extern int32_t spiffs_hal_write (uint32_t addr, uint32_t size, uint8_t *src);
3951extern int32_t spiffs_hal_erase (uint32_t addr, uint32_t size);
4052extern int32_t spiffs_hal_read (uint32_t addr, uint32_t size, uint8_t *dst);
@@ -114,6 +126,10 @@ class SPIFFSImpl : public FSImpl
114126
115127 bool begin () override
116128 {
129+ #if defined(ARDUINO) && !defined(CORE_MOCK)
130+ if (&_SPIFFS_end <= &_SPIFFS_start)
131+ return false ;
132+ #endif
117133 if (SPIFFS_mounted (&_fs) != 0 ) {
118134 return true ;
119135 }
You can’t perform that action at this time.
0 commit comments