Commit 864bcdbd authored by Johny Mattsson's avatar Johny Mattsson Committed by GitHub
Browse files

Merge pull request #2038 from pjsg/spiffs-blocksize

Fix the SPIFFS blocksize issues
parents 9edcce5b 761c9dff
...@@ -73,7 +73,7 @@ static bool myspiffs_set_location(spiffs_config *cfg, int align, int offset, int ...@@ -73,7 +73,7 @@ static bool myspiffs_set_location(spiffs_config *cfg, int align, int offset, int
* Returns TRUE if FS was found * Returns TRUE if FS was found
* align must be a power of two * align must be a power of two
*/ */
static bool myspiffs_set_cfg(spiffs_config *cfg, int align, int offset, bool force_create) { static bool myspiffs_set_cfg_block(spiffs_config *cfg, int align, int offset, int block_size, bool force_create) {
cfg->phys_erase_block = INTERNAL_FLASH_SECTOR_SIZE; // according to datasheet cfg->phys_erase_block = INTERNAL_FLASH_SECTOR_SIZE; // according to datasheet
cfg->log_page_size = LOG_PAGE_SIZE; // as we said cfg->log_page_size = LOG_PAGE_SIZE; // as we said
...@@ -81,10 +81,8 @@ static bool myspiffs_set_cfg(spiffs_config *cfg, int align, int offset, bool for ...@@ -81,10 +81,8 @@ static bool myspiffs_set_cfg(spiffs_config *cfg, int align, int offset, bool for
cfg->hal_write_f = my_spiffs_write; cfg->hal_write_f = my_spiffs_write;
cfg->hal_erase_f = my_spiffs_erase; cfg->hal_erase_f = my_spiffs_erase;
if (!myspiffs_set_location(cfg, align, offset, LOG_BLOCK_SIZE)) { if (!myspiffs_set_location(cfg, align, offset, block_size)) {
if (!myspiffs_set_location(cfg, align, offset, LOG_BLOCK_SIZE_SMALL_FS)) { return FALSE;
return FALSE;
}
} }
NODE_DBG("fs.start:%x,max:%x\n",cfg->phys_addr,cfg->phys_size); NODE_DBG("fs.start:%x,max:%x\n",cfg->phys_addr,cfg->phys_size);
...@@ -109,6 +107,16 @@ static bool myspiffs_set_cfg(spiffs_config *cfg, int align, int offset, bool for ...@@ -109,6 +107,16 @@ static bool myspiffs_set_cfg(spiffs_config *cfg, int align, int offset, bool for
#endif #endif
} }
static bool myspiffs_set_cfg(spiffs_config *cfg, int align, int offset, bool force_create) {
if (force_create) {
return myspiffs_set_cfg_block(cfg, align, offset, LOG_BLOCK_SIZE , TRUE) ||
myspiffs_set_cfg_block(cfg, align, offset, LOG_BLOCK_SIZE_SMALL_FS, TRUE);
}
return myspiffs_set_cfg_block(cfg, align, offset, LOG_BLOCK_SIZE_SMALL_FS, FALSE) ||
myspiffs_set_cfg_block(cfg, align, offset, LOG_BLOCK_SIZE , FALSE);
}
static bool myspiffs_find_cfg(spiffs_config *cfg, bool force_create) { static bool myspiffs_find_cfg(spiffs_config *cfg, bool force_create) {
int i; int i;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment