mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-21 10:26:06 +03:00
Fix indentation to spaces
Run test/restyle.sh Remove commented code Use #ifdef blocks for debugging. `DEBUG_ESP_CORE` and `DEBUG_ESP_PORT` use `static constexpr layout` which saves ROM ~500B for unused vars
This commit is contained in:
parent
f4a42a0c1b
commit
9feb47ab06
@ -4,38 +4,13 @@
|
|||||||
#include <Esp.h>
|
#include <Esp.h>
|
||||||
|
|
||||||
|
|
||||||
namespace FST {
|
|
||||||
|
|
||||||
const layout layout_512k32 (0x40273000, 0x4027B000, 0x100, 0x1000 );
|
#if defined(DEBUG_ESP_CORE)
|
||||||
const layout layout_512k64 (0x4026B000, 0x4027B000, 0x100, 0x1000 );
|
#define FSTOOLSDEBUG(_1, ...) { DEBUG_ESP_PORT.printf_P( PSTR(_1),##__VA_ARGS__); }
|
||||||
const layout layout_512k128 (0x4025B000, 0x4027B000, 0x100, 0x1000 );
|
#else
|
||||||
|
#define FSTOOLSDEBUG(...) {}
|
||||||
|
#endif
|
||||||
|
|
||||||
const layout layout_1m64 (0x402EB000, 0x402FB000, 0x100, 0x1000 );
|
|
||||||
const layout layout_1m128 (0x402DB000, 0x402FB000, 0x100, 0x1000 );
|
|
||||||
const layout layout_1m144 (0x402D7000, 0x402FB000, 0x100, 0x1000 );
|
|
||||||
const layout layout_1m160 (0x402D3000, 0x402FB000, 0x100, 0x1000 );
|
|
||||||
const layout layout_1m192 (0x402CB000, 0x402FB000, 0x100, 0x1000 );
|
|
||||||
const layout layout_1m256 (0x402BB000, 0x402FB000, 0x100, 0x1000 );
|
|
||||||
const layout layout_1m512 (0x4027B000, 0x402FB000, 0x100, 0x2000 );
|
|
||||||
|
|
||||||
const layout layout_2m64 (0x403F0000, 0x403FB000, 0x100, 0x1000 );
|
|
||||||
const layout layout_2m128 (0x403E0000, 0x403FB000, 0x100, 0x1000 );
|
|
||||||
const layout layout_2m256 (0x403C0000, 0x403FB000, 0x100, 0x1000 );
|
|
||||||
const layout layout_2m512 (0x40380000, 0x403FA000, 0x100, 0x2000 );
|
|
||||||
const layout layout_2m1m (0x40300000, 0x403FA000, 0x100, 0x2000 );
|
|
||||||
|
|
||||||
const layout layout_4m1m (0x40500000, 0x405FA000, 0x100, 0x2000 );
|
|
||||||
const layout layout_4m2m (0x40400000, 0x405FA000, 0x100, 0x2000 );
|
|
||||||
const layout layout_4m3m (0x40300000, 0x405FA000, 0x100, 0x2000 );
|
|
||||||
|
|
||||||
const layout layout_8m6m (0x40400000, 0x409FA000, 0x100, 0x2000 );
|
|
||||||
const layout layout_8m7m (0x40300000, 0x409FA000, 0x100, 0x2000 );
|
|
||||||
|
|
||||||
const layout layout_16m14m (0x40400000, 0x411FA000, 0x100, 0x2000 );
|
|
||||||
const layout layout_16m15m (0x40300000, 0x411FA000, 0x100, 0x2000 );
|
|
||||||
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
FSTools::FSTools()
|
FSTools::FSTools()
|
||||||
{
|
{
|
||||||
@ -52,8 +27,8 @@ bool FSTools::attemptToMountFS(fs::FS & fs)
|
|||||||
{
|
{
|
||||||
LittleFSConfig littleFSCfg(false);
|
LittleFSConfig littleFSCfg(false);
|
||||||
SPIFFSConfig SPIFFSCfg(false);
|
SPIFFSConfig SPIFFSCfg(false);
|
||||||
// try to apply the "safe" no format config to the FS... doesn't matter which.. just need one to apply..
|
// try to apply the "safe" no format config to the FS... doesn't matter which.. just need one to apply correctly..
|
||||||
if (!fs.setConfig(littleFSCfg) && ! fs.setConfig(SPIFFSCfg) )
|
if (!fs.setConfig(littleFSCfg) && ! fs.setConfig(SPIFFSCfg))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -61,28 +36,33 @@ bool FSTools::attemptToMountFS(fs::FS & fs)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool FSTools::mountAlternativeFS( FST::FS_t type, const FST::layout & layout, bool keepMounted )
|
bool FSTools::mountAlternativeFS(FST::FS_t type, const FST::layout & layout, bool keepMounted)
|
||||||
{
|
{
|
||||||
FSConfig * pCfg{nullptr};
|
FSConfig * pCfg{nullptr};
|
||||||
LittleFSConfig littleFSCfg(false);
|
LittleFSConfig littleFSCfg(false);
|
||||||
SPIFFSConfig SPIFFSCfg(false);
|
SPIFFSConfig SPIFFSCfg(false);
|
||||||
reset();
|
reset();
|
||||||
|
|
||||||
switch (type) {
|
switch (type)
|
||||||
case FST::SPIFFS : {
|
{
|
||||||
_pFS.reset( new FS(FSImplPtr(new spiffs_impl::SPIFFSImpl (_getStartAddr(layout) , _getSize(layout) , layout.page, layout.block, 5))) );
|
case FST::SPIFFS :
|
||||||
|
{
|
||||||
|
_pFS.reset(new FS(FSImplPtr(new spiffs_impl::SPIFFSImpl(_getStartAddr(layout), _getSize(layout), layout.page, layout.block, 5))));
|
||||||
pCfg = &SPIFFSCfg;
|
pCfg = &SPIFFSCfg;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case FST::LITTLEFS : {
|
case FST::LITTLEFS :
|
||||||
_pFS.reset( new FS(FSImplPtr(new littlefs_impl::LittleFSImpl(_getStartAddr(layout) , _getSize(layout) , layout.page, layout.block, 5))) );
|
{
|
||||||
|
_pFS.reset(new FS(FSImplPtr(new littlefs_impl::LittleFSImpl(_getStartAddr(layout), _getSize(layout), layout.page, layout.block, 5))));
|
||||||
pCfg = &littleFSCfg;
|
pCfg = &littleFSCfg;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (_pFS && pCfg && _pFS->setConfig(*pCfg) && _pFS->begin()) {
|
if (_pFS && pCfg && _pFS->setConfig(*pCfg) && _pFS->begin())
|
||||||
if (!keepMounted) {
|
{
|
||||||
|
if (!keepMounted)
|
||||||
|
{
|
||||||
_pFS->end();
|
_pFS->end();
|
||||||
}
|
}
|
||||||
_mounted = true;
|
_mounted = true;
|
||||||
@ -90,12 +70,12 @@ bool FSTools::mountAlternativeFS( FST::FS_t type, const FST::layout & layout, b
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_pFS) {
|
if (_pFS)
|
||||||
|
{
|
||||||
_pFS.reset();
|
_pFS.reset();
|
||||||
}
|
}
|
||||||
_mounted = false;
|
_mounted = false;
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -105,67 +85,79 @@ bool FSTools::mounted()
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool FSTools::moveFS(fs::FS & destinationFS)
|
bool FSTools::moveFS(fs::FS & destinationFS)
|
||||||
{
|
{
|
||||||
uint32_t sourceFileCount = 0;
|
uint32_t sourceFileCount = 0;
|
||||||
uint32_t sourceByteTotal = 0;
|
uint32_t sourceByteTotal = 0;
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
// do not init new fs... until old one is copied to test...
|
if (!_mounted || !_pFS)
|
||||||
if (!_mounted || !_pFS) {
|
{
|
||||||
//Serial.println("Source FS not mounted");
|
FSTOOLSDEBUG("Source FS not mounted\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint32_t startSector = (ESP.getSketchSize() + FLASH_SECTOR_SIZE - 1) & (~(FLASH_SECTOR_SIZE - 1));
|
uint32_t startSector = (ESP.getSketchSize() + FLASH_SECTOR_SIZE - 1) & (~(FLASH_SECTOR_SIZE - 1));
|
||||||
//uint32_t endSector = (uint32_t)&_FS_start - FST::lowestSPIFFSstartAddr;
|
|
||||||
uint32_t lowestFSStart = 0x40300000;
|
uint32_t lowestFSStart = 0x40300000;
|
||||||
|
|
||||||
if (_layout) {
|
if (_layout)
|
||||||
|
{
|
||||||
lowestFSStart = _layout->startAddr;
|
lowestFSStart = _layout->startAddr;
|
||||||
//Serial.printf("** _layout->startADDR = 0x%08x\n", _layout->startAddr );
|
FSTOOLSDEBUG("_layout->startADDR = 0x%08x\n", _layout->startAddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t endSector = lowestFSStart - 0x40200000;
|
uint32_t endSector = lowestFSStart - 0x40200000;
|
||||||
uint32_t tempFSsize = endSector - startSector;
|
uint32_t tempFSsize = endSector - startSector;
|
||||||
|
|
||||||
//Serial.printf("TempFS: start: %u, end: %u, size: %u, sketchSize = %u, _FS_start = %u\n", startSector, endSector, tempFSsize, ESP.getSketchSize(), (uint32_t)&_FS_start );
|
FSTOOLSDEBUG("TempFS: start: %u, end: %u, size: %u, sketchSize = %u, _FS_start = %u\n", startSector, endSector, tempFSsize, ESP.getSketchSize(), (uint32_t)&_FS_start);
|
||||||
|
|
||||||
fileListIterator(*_pFS, "/", [&sourceFileCount, &sourceByteTotal, this](File & f) {
|
fileListIterator(*_pFS, "/", [&sourceFileCount, &sourceByteTotal, this](File & f)
|
||||||
if (f) {
|
{
|
||||||
|
if (f)
|
||||||
|
{
|
||||||
sourceFileCount++;
|
sourceFileCount++;
|
||||||
sourceByteTotal += f.size();
|
sourceByteTotal += f.size();
|
||||||
//_dumpFileInfo(f);
|
|
||||||
|
#ifdef DEBUG_ESP_CORE
|
||||||
|
_dumpFileInfo(f);
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//Serial.printf("%u Files Found Total Size = %u\n", sourceFileCount, sourceByteTotal);
|
FSTOOLSDEBUG("%u Files Found Total Size = %u\n", sourceFileCount, sourceByteTotal);
|
||||||
//Serial.printf("Size of dummy FS = %u\n", tempFSsize);
|
FSTOOLSDEBUG("Size of dummy FS = %u\n", tempFSsize);
|
||||||
|
|
||||||
FS tempFS = FS(FSImplPtr(new littlefs_impl::LittleFSImpl(startSector, tempFSsize, FS_PHYS_PAGE, FS_PHYS_BLOCK, 5)));
|
FS tempFS = FS(FSImplPtr(new littlefs_impl::LittleFSImpl(startSector, tempFSsize, FS_PHYS_PAGE, FS_PHYS_BLOCK, 5)));
|
||||||
|
|
||||||
if (tempFS.format() && tempFS.begin()) {
|
if (tempFS.format() && tempFS.begin())
|
||||||
if (_copyFS(*_pFS,tempFS)) {
|
{
|
||||||
//Serial.println("Files copied to temp File System");
|
if (_copyFS(*_pFS, tempFS))
|
||||||
|
{
|
||||||
|
FSTOOLSDEBUG("Files copied to temp File System\n");
|
||||||
reset();
|
reset();
|
||||||
if (destinationFS.format() && destinationFS.begin()) // must format then mount the new FS
|
if (destinationFS.format() && destinationFS.begin()) // must format then mount the new FS
|
||||||
{
|
{
|
||||||
if (_copyFS(tempFS, destinationFS)) {
|
if (_copyFS(tempFS, destinationFS))
|
||||||
//Serial.println("Files copied back to new FS");
|
{
|
||||||
|
FSTOOLSDEBUG("Files copied back to new FS\n");
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
//Serial.println("Error Mounting ");
|
|
||||||
}
|
}
|
||||||
} else {
|
else
|
||||||
//Serial.println("Copy Failed");
|
{
|
||||||
|
FSTOOLSDEBUG("Error Mounting\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FSTOOLSDEBUG("Copy Failed\n");
|
||||||
}
|
}
|
||||||
tempFS.end();
|
tempFS.end();
|
||||||
} else {
|
}
|
||||||
//Serial.println("Failed to begin() TempFS");
|
else
|
||||||
|
{
|
||||||
|
FSTOOLSDEBUG("Failed to begin() TempFS\n");
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
@ -174,23 +166,29 @@ void FSTools::reset()
|
|||||||
{
|
{
|
||||||
_mounted = false;
|
_mounted = false;
|
||||||
_layout = nullptr;
|
_layout = nullptr;
|
||||||
if (_pFS) {
|
if (_pFS)
|
||||||
|
{
|
||||||
_pFS->end();
|
_pFS->end();
|
||||||
_pFS.reset();
|
_pFS.reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FSTools::fileListIterator(FS & fs, const char * dirName, FST::FileCb Cb )
|
void FSTools::fileListIterator(FS & fs, const char * dirName, FST::FileCb Cb)
|
||||||
{
|
{
|
||||||
Dir dir = fs.openDir(dirName);
|
Dir dir = fs.openDir(dirName);
|
||||||
while (dir.next()) {
|
while (dir.next())
|
||||||
if (dir.isFile()) {
|
{
|
||||||
|
if (dir.isFile())
|
||||||
|
{
|
||||||
File f = dir.openFile("r");
|
File f = dir.openFile("r");
|
||||||
if (Cb) {
|
if (Cb)
|
||||||
|
{
|
||||||
Cb(f);
|
Cb(f);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
fileListIterator(fs, dir.fileName().c_str() , Cb);
|
else
|
||||||
|
{
|
||||||
|
fileListIterator(fs, dir.fileName().c_str(), Cb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -198,42 +196,50 @@ void FSTools::fileListIterator(FS & fs, const char * dirName, FST::FileCb Cb )
|
|||||||
|
|
||||||
uint32_t FSTools::_getStartAddr(const FST::layout & layout)
|
uint32_t FSTools::_getStartAddr(const FST::layout & layout)
|
||||||
{
|
{
|
||||||
return ( layout.startAddr - 0x40200000 );
|
return (layout.startAddr - 0x40200000);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t FSTools::_getSize(const FST::layout & layout)
|
uint32_t FSTools::_getSize(const FST::layout & layout)
|
||||||
{
|
{
|
||||||
return (layout.endAddr - layout.startAddr );
|
return (layout.endAddr - layout.startAddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef DEBUG_ESP_CORE
|
||||||
// void FSTools::_dumpFileInfo(File & f)
|
void FSTools::_dumpFileInfo(File & f)
|
||||||
// {
|
{
|
||||||
// if (f) {
|
if (f)
|
||||||
// Serial.printf_P(PSTR(" File: %-30s [%8uB]\n"), f.fullName(), f.size() );
|
{
|
||||||
// }
|
DEBUG_ESP_PORT.printf_P(PSTR(" File: %-30s [%8uB]\n"), f.fullName(), f.size());
|
||||||
// }
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
bool FSTools::_copyFS(FS & sourceFS, FS & destFS)
|
bool FSTools::_copyFS(FS & sourceFS, FS & destFS)
|
||||||
{
|
{
|
||||||
uint32_t sourceFileCount = 0;
|
uint32_t sourceFileCount = 0;
|
||||||
uint32_t sourceByteTotal = 0;
|
uint32_t sourceByteTotal = 0;
|
||||||
|
|
||||||
fileListIterator(sourceFS, "/", [&sourceFileCount, &sourceByteTotal](File & f) {
|
fileListIterator(sourceFS, "/", [&sourceFileCount, &sourceByteTotal](File & f)
|
||||||
if (f) {
|
{
|
||||||
|
if (f)
|
||||||
|
{
|
||||||
sourceFileCount++;
|
sourceFileCount++;
|
||||||
sourceByteTotal += f.size();
|
sourceByteTotal += f.size();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
size_t count = 0;
|
size_t count = 0;
|
||||||
fileListIterator(sourceFS, "/", [&count, &destFS](File & sourceFile){
|
fileListIterator(sourceFS, "/", [&count, &destFS](File & sourceFile)
|
||||||
if (sourceFile) {
|
{
|
||||||
|
if (sourceFile)
|
||||||
|
{
|
||||||
File destFile = destFS.open(sourceFile.fullName(), "w");
|
File destFile = destFS.open(sourceFile.fullName(), "w");
|
||||||
if (destFile) {
|
if (destFile)
|
||||||
destFile.setTimeout(5000);
|
{
|
||||||
|
destFile.setTimeout(5000); // this value was chosen empirically as it failed with default timeout.
|
||||||
size_t written = destFile.write(sourceFile);
|
size_t written = destFile.write(sourceFile);
|
||||||
if (written == sourceFile.size()) {
|
if (written == sourceFile.size())
|
||||||
|
{
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,81 +8,84 @@
|
|||||||
A temporary FS is made between the END of the sketch... and the start of the partition you try to mount, to maximise the available space for copying the FS.
|
A temporary FS is made between the END of the sketch... and the start of the partition you try to mount, to maximise the available space for copying the FS.
|
||||||
The WORST case this is at 0x40300000 which is for a 3m FS on 4m flash.. leaving 460Kb for copying.
|
The WORST case this is at 0x40300000 which is for a 3m FS on 4m flash.. leaving 460Kb for copying.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
I have not worked out a way to prevent linking of ALL the layouts except to use #ifdef guards. Ideas welcome as it uses 400B ROM.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace FST {
|
|
||||||
|
|
||||||
struct layout {
|
namespace FST
|
||||||
layout(uint32_t s, uint32_t e, uint32_t p, uint32_t b) : startAddr(s), endAddr(e), page(p), block(b) {};
|
{
|
||||||
uint32_t startAddr{0};
|
|
||||||
uint32_t endAddr{0};
|
|
||||||
uint32_t page{0};
|
|
||||||
uint32_t block{0};
|
|
||||||
};
|
|
||||||
|
|
||||||
enum FS_t : uint8_t {
|
struct layout
|
||||||
|
{
|
||||||
|
constexpr layout(uint32_t s, uint32_t e, uint32_t p, uint32_t b) : startAddr(s), endAddr(e), page(p), block(b) {};
|
||||||
|
const uint32_t startAddr{0};
|
||||||
|
const uint32_t endAddr{0};
|
||||||
|
const uint32_t page{0};
|
||||||
|
const uint32_t block{0};
|
||||||
|
};
|
||||||
|
|
||||||
|
enum FS_t : uint8_t
|
||||||
|
{
|
||||||
SPIFFS,
|
SPIFFS,
|
||||||
LITTLEFS
|
LITTLEFS
|
||||||
};
|
};
|
||||||
|
|
||||||
extern const layout layout_512k32;
|
static constexpr layout layout_512k32 = { 0x40273000, 0x4027B000, 0x100, 0x1000 };
|
||||||
extern const layout layout_512k64;
|
static constexpr layout layout_512k64 = { 0x4026B000, 0x4027B000, 0x100, 0x1000 };
|
||||||
extern const layout layout_512k128;
|
static constexpr layout layout_512k128 = { 0x4025B000, 0x4027B000, 0x100, 0x1000 };
|
||||||
|
|
||||||
extern const layout layout_1m64;
|
static constexpr layout layout_1m64 = { 0x402EB000, 0x402FB000, 0x100, 0x1000 };
|
||||||
extern const layout layout_1m128;
|
static constexpr layout layout_1m128 = { 0x402DB000, 0x402FB000, 0x100, 0x1000 };
|
||||||
extern const layout layout_1m144;
|
static constexpr layout layout_1m144 = { 0x402D7000, 0x402FB000, 0x100, 0x1000 };
|
||||||
extern const layout layout_1m160;
|
static constexpr layout layout_1m160 = { 0x402D3000, 0x402FB000, 0x100, 0x1000 };
|
||||||
extern const layout layout_1m192;
|
static constexpr layout layout_1m192 = { 0x402CB000, 0x402FB000, 0x100, 0x1000 };
|
||||||
extern const layout layout_1m256;
|
static constexpr layout layout_1m256 = { 0x402BB000, 0x402FB000, 0x100, 0x1000 };
|
||||||
extern const layout layout_1m512;
|
static constexpr layout layout_1m512 = { 0x4027B000, 0x402FB000, 0x100, 0x2000 };
|
||||||
|
|
||||||
extern const layout layout_2m64;
|
static constexpr layout layout_2m64 = { 0x403F0000, 0x403FB000, 0x100, 0x1000 };
|
||||||
extern const layout layout_2m128;
|
static constexpr layout layout_2m128 = { 0x403E0000, 0x403FB000, 0x100, 0x1000 };
|
||||||
extern const layout layout_2m256;
|
static constexpr layout layout_2m256 = { 0x403C0000, 0x403FB000, 0x100, 0x1000 };
|
||||||
extern const layout layout_2m512;
|
static constexpr layout layout_2m512 = { 0x40380000, 0x403FA000, 0x100, 0x2000 };
|
||||||
extern const layout layout_2m1m;
|
static constexpr layout layout_2m1m = { 0x40300000, 0x403FA000, 0x100, 0x2000 };
|
||||||
|
|
||||||
extern const layout layout_4m1m;
|
static constexpr layout layout_4m1m = { 0x40500000, 0x405FA000, 0x100, 0x2000 };
|
||||||
extern const layout layout_4m2m;
|
static constexpr layout layout_4m2m = { 0x40400000, 0x405FA000, 0x100, 0x2000 };
|
||||||
extern const layout layout_4m3m;
|
static constexpr layout layout_4m3m = { 0x40300000, 0x405FA000, 0x100, 0x2000 };
|
||||||
|
|
||||||
extern const layout layout_8m6m;
|
static constexpr layout layout_8m6m = { 0x40400000, 0x409FA000, 0x100, 0x2000 };
|
||||||
extern const layout layout_8m7m;
|
static constexpr layout layout_8m7m = { 0x40300000, 0x409FA000, 0x100, 0x2000 };
|
||||||
|
|
||||||
extern const layout layout_16m14m;
|
static constexpr layout layout_16m14m = { 0x40400000, 0x411FA000, 0x100, 0x2000 };
|
||||||
extern const layout layout_16m15m;
|
static constexpr layout layout_16m15m = { 0x40300000, 0x411FA000, 0x100, 0x2000 };
|
||||||
|
|
||||||
typedef std::function<void(File & f)> FileCb;
|
|
||||||
|
|
||||||
|
typedef std::function<void(File & f)> FileCb;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class FSTools
|
||||||
class FSTools {
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
FSTools();
|
FSTools();
|
||||||
~FSTools();
|
~FSTools();
|
||||||
bool attemptToMountFS(fs::FS & fs);
|
bool attemptToMountFS(fs::FS & fs);
|
||||||
bool mountAlternativeFS( FST::FS_t type, const FST::layout & layout, bool keepMounted = false );
|
bool mountAlternativeFS(FST::FS_t type, const FST::layout & layout, bool keepMounted = false);
|
||||||
bool mounted();
|
bool mounted();
|
||||||
bool moveFS(fs::FS & destinationFS);
|
bool moveFS(fs::FS & destinationFS);
|
||||||
void reset();
|
void reset();
|
||||||
void fileListIterator(FS & fs, const char * dirName, FST::FileCb Cb );
|
void fileListIterator(FS & fs, const char * dirName, FST::FileCb Cb);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint32_t _getStartAddr(const FST::layout & layout);
|
uint32_t _getStartAddr(const FST::layout & layout);
|
||||||
uint32_t _getSize(const FST::layout & layout);
|
uint32_t _getSize(const FST::layout & layout);
|
||||||
// void _dumpFileInfo(File & f);
|
#ifdef DEBUG_ESP_CORE
|
||||||
|
void _dumpFileInfo(File & f);
|
||||||
|
#endif
|
||||||
bool _copyFS(FS & sourceFS, FS & destFS);
|
bool _copyFS(FS & sourceFS, FS & destFS);
|
||||||
|
|
||||||
std::unique_ptr<fs::FS> _pFS;
|
std::unique_ptr<fs::FS> _pFS;
|
||||||
bool _mounted{false};
|
bool _mounted{false};
|
||||||
const FST::layout * _layout{nullptr};
|
const FST::layout * _layout{nullptr};
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
Loading…
x
Reference in New Issue
Block a user