Test sigsevs when having too many sectors #13

This commit is contained in:
Peter Andersson
2015-04-18 23:54:37 +02:00
parent be4af57ceb
commit 88b5473bfe
2 changed files with 17 additions and 7 deletions
+14 -7
View File
@@ -26,7 +26,7 @@
static unsigned char area[PHYS_FLASH_SIZE];
static int erases[256];
static int erases[PHYS_FLASH_SIZE/SECTOR_SIZE];
static char _path[256];
static u32_t bytes_rd = 0;
static u32_t bytes_wr = 0;
@@ -313,13 +313,9 @@ static void spiffs_check_cb_f(spiffs_check_type type, spiffs_check_report report
}
}
void fs_reset_specific(u32_t phys_addr, u32_t phys_size,
s32_t fs_mount_specific(u32_t phys_addr, u32_t phys_size,
u32_t phys_sector_size,
u32_t log_block_size, u32_t log_page_size) {
memset(area, 0xcc, sizeof(area));
memset(&area[phys_addr], 0xff, phys_size);
memset(&__fs, 0, sizeof(__fs));
spiffs_config c;
c.hal_erase_f = _erase;
c.hal_read_f = _read;
@@ -330,10 +326,21 @@ void fs_reset_specific(u32_t phys_addr, u32_t phys_size,
c.phys_erase_block = phys_sector_size;
c.phys_size = phys_size;
return SPIFFS_mount(&__fs, &c, _work, _fds, sizeof(_fds), _cache, sizeof(_cache), spiffs_check_cb_f);
}
void fs_reset_specific(u32_t phys_addr, u32_t phys_size,
u32_t phys_sector_size,
u32_t log_block_size, u32_t log_page_size) {
memset(area, 0xcc, sizeof(area));
memset(&area[phys_addr], 0xff, phys_size);
memset(&__fs, 0, sizeof(__fs));
memset(erases,0,sizeof(erases));
memset(_cache,0,sizeof(_cache));
s32_t res = SPIFFS_mount(&__fs, &c, _work, _fds, sizeof(_fds), _cache, sizeof(_cache), spiffs_check_cb_f);
s32_t res = fs_mount_specific(phys_addr, phys_size, phys_sector_size, log_block_size, log_page_size);
#if SPIFFS_USE_MAGIC
if (res == SPIFFS_OK) {
SPIFFS_unmount(&__fs);
+3
View File
@@ -60,6 +60,9 @@ void fs_reset();
void fs_reset_specific(u32_t phys_addr, u32_t phys_size,
u32_t phys_sector_size,
u32_t log_block_size, u32_t log_page_size);
s32_t fs_mount_specific(u32_t phys_addr, u32_t phys_size,
u32_t phys_sector_size,
u32_t log_block_size, u32_t log_page_size);
int read_and_verify(char *name);
int read_and_verify_fd(spiffs_file fd, char *name);
void dump_page(spiffs *fs, spiffs_page_ix p);