mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-19 23:22:16 +03:00
fix SPIFFS when not enabled in build options (#5249)
This commit is contained in:
parent
8e248064b9
commit
8b3f4966e9
@ -111,16 +111,6 @@ bool isSpiffsFilenameValid(const char* name)
|
|||||||
// these symbols should be defined in the linker script for each flash layout
|
// these symbols should be defined in the linker script for each flash layout
|
||||||
#ifndef CORE_MOCK
|
#ifndef CORE_MOCK
|
||||||
#ifdef ARDUINO
|
#ifdef ARDUINO
|
||||||
extern "C" uint32_t _SPIFFS_start;
|
|
||||||
extern "C" uint32_t _SPIFFS_end;
|
|
||||||
extern "C" uint32_t _SPIFFS_page;
|
|
||||||
extern "C" uint32_t _SPIFFS_block;
|
|
||||||
|
|
||||||
#define SPIFFS_PHYS_ADDR ((uint32_t) (&_SPIFFS_start) - 0x40200000)
|
|
||||||
#define SPIFFS_PHYS_SIZE ((uint32_t) (&_SPIFFS_end) - (uint32_t) (&_SPIFFS_start))
|
|
||||||
#define SPIFFS_PHYS_PAGE ((uint32_t) &_SPIFFS_page)
|
|
||||||
#define SPIFFS_PHYS_BLOCK ((uint32_t) &_SPIFFS_block)
|
|
||||||
|
|
||||||
#ifndef SPIFFS_MAX_OPEN_FILES
|
#ifndef SPIFFS_MAX_OPEN_FILES
|
||||||
#define SPIFFS_MAX_OPEN_FILES 5
|
#define SPIFFS_MAX_OPEN_FILES 5
|
||||||
#endif
|
#endif
|
||||||
|
@ -35,6 +35,18 @@
|
|||||||
|
|
||||||
using namespace fs;
|
using namespace fs;
|
||||||
|
|
||||||
|
#ifdef ARDUINO
|
||||||
|
extern "C" uint32_t _SPIFFS_start;
|
||||||
|
extern "C" uint32_t _SPIFFS_end;
|
||||||
|
extern "C" uint32_t _SPIFFS_page;
|
||||||
|
extern "C" uint32_t _SPIFFS_block;
|
||||||
|
|
||||||
|
#define SPIFFS_PHYS_ADDR ((uint32_t) (&_SPIFFS_start) - 0x40200000)
|
||||||
|
#define SPIFFS_PHYS_SIZE ((uint32_t) (&_SPIFFS_end) - (uint32_t) (&_SPIFFS_start))
|
||||||
|
#define SPIFFS_PHYS_PAGE ((uint32_t) &_SPIFFS_page)
|
||||||
|
#define SPIFFS_PHYS_BLOCK ((uint32_t) &_SPIFFS_block)
|
||||||
|
#endif
|
||||||
|
|
||||||
extern int32_t spiffs_hal_write(uint32_t addr, uint32_t size, uint8_t *src);
|
extern int32_t spiffs_hal_write(uint32_t addr, uint32_t size, uint8_t *src);
|
||||||
extern int32_t spiffs_hal_erase(uint32_t addr, uint32_t size);
|
extern int32_t spiffs_hal_erase(uint32_t addr, uint32_t size);
|
||||||
extern int32_t spiffs_hal_read(uint32_t addr, uint32_t size, uint8_t *dst);
|
extern int32_t spiffs_hal_read(uint32_t addr, uint32_t size, uint8_t *dst);
|
||||||
@ -114,6 +126,10 @@ public:
|
|||||||
|
|
||||||
bool begin() override
|
bool begin() override
|
||||||
{
|
{
|
||||||
|
#if defined(ARDUINO) && !defined(CORE_MOCK)
|
||||||
|
if (&_SPIFFS_end <= &_SPIFFS_start)
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
if (SPIFFS_mounted(&_fs) != 0) {
|
if (SPIFFS_mounted(&_fs) != 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user