Skip to content

Commit 7842b3c

Browse files
ficetoficeto
ficeto
authored and
ficeto
committed
fix SPIFFS to work
1 parent e518425 commit 7842b3c

File tree

8 files changed

+84
-83
lines changed

8 files changed

+84
-83
lines changed

hardware/esp8266com/esp8266/cores/esp8266/spiffs/spiffs.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,18 @@ the entire chip (chip erase). The W25Q32BV has 1,024 erasable sectors and 64 era
3939
The small 4KB sectors allow for greater flexibility in applications that require data and parameter storage.
4040
********************/
4141

42+
extern uint32_t _SPIFFS_start;
43+
extern uint32_t _SPIFFS_end;
44+
4245
spiffs_config spiffs_get_storage_config()
4346
{
4447
spiffs_config cfg = {0};
45-
cfg.phys_addr = ( u32_t )flashmem_get_first_free_block_address();
48+
cfg.phys_addr = (u32_t)&_SPIFFS_start;
4649
if (cfg.phys_addr == 0)
4750
return cfg;
4851
cfg.phys_addr += 0x3000;
4952
cfg.phys_addr &= 0xFFFFC000; // align to 4 sector.
50-
cfg.phys_size = INTERNAL_FLASH_SIZE - ( ( u32_t )cfg.phys_addr - INTERNAL_FLASH_START_ADDRESS );
53+
cfg.phys_size = (u32_t)((u32_t)&_SPIFFS_end - (u32_t)&_SPIFFS_start);
5154
/*cfg.phys_addr = INTERNAL_FLASH_SIZE - SPIFFS_WORK_SIZE + INTERNAL_FLASH_START_ADDRESS;
5255
cfg.phys_addr += 0x3000;
5356
cfg.phys_addr &= 0xFFFFC000; // align to 4 sector.
@@ -69,9 +72,8 @@ bool spiffs_format_internal()
6972

7073
u32_t sect_first, sect_last;
7174
sect_first = cfg.phys_addr;
72-
sect_first = flashmem_get_sector_of_address(sect_first);
73-
sect_last = cfg.phys_addr + cfg.phys_size;
74-
sect_last = flashmem_get_sector_of_address(sect_last);
75+
sect_first = flashmem_get_sector_of_address((u32_t)&_SPIFFS_start);
76+
sect_last = flashmem_get_sector_of_address((u32_t)&_SPIFFS_end);
7577
debugf("sect_first: %x, sect_last: %x\n", sect_first, sect_last);
7678
while( sect_first <= sect_last )
7779
if(!flashmem_erase_sector( sect_first ++ ))

hardware/esp8266com/esp8266/cores/esp8266/spiffs/spiffs_cache.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ static spiffs_cache_page *spiffs_cache_page_get(spiffs *fs, spiffs_page_ix pix)
2020
if ((cache->cpage_use_map & (1<<i)) &&
2121
(cp->flags & SPIFFS_CACHE_FLAG_TYPE_WR) == 0 &&
2222
cp->pix == pix ) {
23-
SPIFFS_CACHE_DBG("CACHE_GET: have cache page %i for %04x\n", i, pix);
23+
SPIFFS_CACHE_DBG("CACHE_GET: have cache page %u for %04x\n", i, pix);
2424
cp->last_access = cache->last_access;
2525
return cp;
2626
}
@@ -46,9 +46,9 @@ static s32_t spiffs_cache_page_free(spiffs *fs, int ix, u8_t write_back) {
4646
cache->cpage_use_map &= ~(1 << ix);
4747

4848
if (cp->flags & SPIFFS_CACHE_FLAG_TYPE_WR) {
49-
SPIFFS_CACHE_DBG("CACHE_FREE: free cache page %i objid %04x\n", ix, cp->obj_id);
49+
SPIFFS_CACHE_DBG("CACHE_FREE: free cache page %u objid %04x\n", ix, cp->obj_id);
5050
} else {
51-
SPIFFS_CACHE_DBG("CACHE_FREE: free cache page %i pix %04x\n", ix, cp->pix);
51+
SPIFFS_CACHE_DBG("CACHE_FREE: free cache page %u pix %04x\n", ix, cp->pix);
5252
}
5353
}
5454

@@ -98,7 +98,7 @@ static spiffs_cache_page *spiffs_cache_page_allocate(spiffs *fs) {
9898
spiffs_cache_page *cp = spiffs_get_cache_page_hdr(fs, cache, i);
9999
cache->cpage_use_map |= (1<<i);
100100
cp->last_access = cache->last_access;
101-
SPIFFS_CACHE_DBG("CACHE_ALLO: allocated cache page %i\n", i);
101+
SPIFFS_CACHE_DBG("CACHE_ALLO: allocated cache page %u\n", i);
102102
return cp;
103103
}
104104
}

hardware/esp8266com/esp8266/cores/esp8266/spiffs/spiffs_check.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ static s32_t spiffs_lookup_check_validate(spiffs *fs, spiffs_obj_id lu_obj_id, s
190190
res = spiffs_rewrite_index(fs, p_hdr->obj_id, p_hdr->span_ix, new_pix, objix_pix);
191191
if (res <= _SPIFFS_ERR_CHECK_FIRST && res > _SPIFFS_ERR_CHECK_LAST) {
192192
// index bad also, cannot mend this file
193-
SPIFFS_CHECK_DBG("LU: FIXUP: index bad %i, cannot mend!\n", res);
193+
SPIFFS_CHECK_DBG("LU: FIXUP: index bad %d, cannot mend!\n", res);
194194
res = spiffs_page_delete(fs, new_pix);
195195
SPIFFS_CHECK_RES(res);
196196
res = spiffs_delete_obj_lazy(fs, p_hdr->obj_id);
@@ -249,7 +249,7 @@ static s32_t spiffs_lookup_check_validate(spiffs *fs, spiffs_obj_id lu_obj_id, s
249249
res = spiffs_rewrite_index(fs, p_hdr->obj_id, p_hdr->span_ix, new_pix, objix_pix);
250250
if (res <= _SPIFFS_ERR_CHECK_FIRST && res > _SPIFFS_ERR_CHECK_LAST) {
251251
// index bad also, cannot mend this file
252-
SPIFFS_CHECK_DBG("LU: FIXUP: index bad %i, cannot mend!\n", res);
252+
SPIFFS_CHECK_DBG("LU: FIXUP: index bad %d, cannot mend!\n", res);
253253
res = spiffs_page_delete(fs, new_pix);
254254
SPIFFS_CHECK_RES(res);
255255
res = spiffs_delete_obj_lazy(fs, p_hdr->obj_id);
@@ -597,7 +597,7 @@ static s32_t spiffs_page_consistency_check_i(spiffs *fs) {
597597
data_spix_offset + i, data_pix, cur_pix);
598598
if (res <= _SPIFFS_ERR_CHECK_FIRST && res > _SPIFFS_ERR_CHECK_LAST) {
599599
// index bad also, cannot mend this file
600-
SPIFFS_CHECK_DBG("PA: FIXUP: index bad %i, cannot mend - delete object\n", res);
600+
SPIFFS_CHECK_DBG("PA: FIXUP: index bad %u, cannot mend - delete object\n", res);
601601
if (fs->check_cb_f) fs->check_cb_f(SPIFFS_CHECK_PAGE, SPIFFS_CHECK_DELETE_BAD_FILE, objix_p_hdr->obj_id, 0);
602602
// delete file
603603
res = spiffs_page_delete(fs, cur_pix);
@@ -647,7 +647,7 @@ static s32_t spiffs_page_consistency_check_i(spiffs *fs) {
647647
res = spiffs_rewrite_index(fs, p_hdr.obj_id, data_spix_offset + i, data_pix, cur_pix);
648648
if (res <= _SPIFFS_ERR_CHECK_FIRST && res > _SPIFFS_ERR_CHECK_LAST) {
649649
// index bad also, cannot mend this file
650-
SPIFFS_CHECK_DBG("PA: FIXUP: index bad %i, cannot mend!\n", res);
650+
SPIFFS_CHECK_DBG("PA: FIXUP: index bad %d, cannot mend!\n", res);
651651
if (fs->check_cb_f) fs->check_cb_f(SPIFFS_CHECK_PAGE, SPIFFS_CHECK_DELETE_BAD_FILE, p_hdr.obj_id, 0);
652652
res = spiffs_delete_obj_lazy(fs, p_hdr.obj_id);
653653
} else {
@@ -763,7 +763,7 @@ static s32_t spiffs_page_consistency_check_i(spiffs *fs) {
763763
res = spiffs_rewrite_index(fs, p_hdr.obj_id, p_hdr.span_ix, cur_pix, objix_pix);
764764
if (res <= _SPIFFS_ERR_CHECK_FIRST && res > _SPIFFS_ERR_CHECK_LAST) {
765765
// index bad also, cannot mend this file
766-
SPIFFS_CHECK_DBG("PA: FIXUP: index bad %i, cannot mend!\n", res);
766+
SPIFFS_CHECK_DBG("PA: FIXUP: index bad %u, cannot mend!\n", res);
767767
if (fs->check_cb_f) fs->check_cb_f(SPIFFS_CHECK_PAGE, SPIFFS_CHECK_DELETE_BAD_FILE, p_hdr.obj_id, 0);
768768
res = spiffs_page_delete(fs, cur_pix);
769769
SPIFFS_CHECK_RES(res);

hardware/esp8266com/esp8266/cores/esp8266/spiffs/spiffs_config.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,19 +62,19 @@ typedef uint8_t u8_t;
6262

6363
// Set generic spiffs debug output call.
6464
#ifndef SPIFFS_DGB
65-
#define SPIFFS_DBG(...) os_printf(__VA_ARGS__)
65+
#define SPIFFS_DBG(...) //os_printf(__VA_ARGS__)
6666
#endif
6767
// Set spiffs debug output call for garbage collecting.
6868
#ifndef SPIFFS_GC_DGB
69-
#define SPIFFS_GC_DBG(...) os_printf(__VA_ARGS__)
69+
#define SPIFFS_GC_DBG(...) //os_printf(__VA_ARGS__)
7070
#endif
7171
// Set spiffs debug output call for caching.
7272
#ifndef SPIFFS_CACHE_DGB
73-
#define SPIFFS_CACHE_DBG(...) os_printf(__VA_ARGS__)
73+
#define SPIFFS_CACHE_DBG(...) //os_printf(__VA_ARGS__)
7474
#endif
7575
// Set spiffs debug output call for system consistency checks.
7676
#ifndef SPIFFS_CHECK_DGB
77-
#define SPIFFS_CHECK_DBG(...) os_printf(__VA_ARGS__)
77+
#define SPIFFS_CHECK_DBG(...) //os_printf(__VA_ARGS__)
7878
#endif
7979

8080
// Enable/disable API functions to determine exact number of bytes

hardware/esp8266com/esp8266/cores/esp8266/spiffs/spiffs_gc.c

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ static s32_t spiffs_gc_erase_block(
1111
u32_t addr = SPIFFS_BLOCK_TO_PADDR(fs, bix);
1212
s32_t size = SPIFFS_CFG_LOG_BLOCK_SZ(fs);
1313

14-
SPIFFS_GC_DBG("gc: erase block %i\n", bix);
14+
SPIFFS_GC_DBG("gc: erase block %d\n", bix);
1515

1616
// here we ignore res, just try erasing the block
1717
while (size > 0) {
@@ -129,10 +129,10 @@ s32_t spiffs_gc_check(
129129
return SPIFFS_OK;
130130
}
131131

132-
//printf("gcing started %i dirty, blocks %i free, want %i bytes\n", fs->stats_p_allocated + fs->stats_p_deleted, fs->free_blocks, len);
132+
//printf("gcing started %d dirty, blocks %d free, want %d bytes\n", fs->stats_p_allocated + fs->stats_p_deleted, fs->free_blocks, len);
133133

134134
do {
135-
SPIFFS_GC_DBG("\ngc_check #%i: run gc free_blocks:%i pfree:%i pallo:%i pdele:%i [%i] len:%i of %i\n",
135+
SPIFFS_GC_DBG("\ngc_check #%d: run gc free_blocks:%d pfree:%d pallo:%d pdele:%d [%d] len:%d of %d\n",
136136
tries,
137137
fs->free_blocks, free_pages, fs->stats_p_allocated, fs->stats_p_deleted, (free_pages+fs->stats_p_allocated+fs->stats_p_deleted),
138138
len, free_pages*SPIFFS_DATA_PAGE_SIZE(fs));
@@ -151,13 +151,13 @@ s32_t spiffs_gc_check(
151151
#endif
152152
cand = cands[0];
153153
fs->cleaning = 1;
154-
//printf("gcing: cleaning block %i\n", cand);
154+
//printf("gcing: cleaning block %d\n", cand);
155155
res = spiffs_gc_clean(fs, cand);
156156
fs->cleaning = 0;
157157
if (res < 0) {
158-
SPIFFS_GC_DBG("gc_check: cleaning block %i, result %i\n", cand, res);
158+
SPIFFS_GC_DBG("gc_check: cleaning block %d, result %d\n", cand, res);
159159
} else {
160-
SPIFFS_GC_DBG("gc_check: cleaning block %i, result %i\n", cand, res);
160+
SPIFFS_GC_DBG("gc_check: cleaning block %d, result %d\n", cand, res);
161161
}
162162
SPIFFS_CHECK_RES(res);
163163

@@ -175,7 +175,7 @@ s32_t spiffs_gc_check(
175175
len > free_pages*SPIFFS_DATA_PAGE_SIZE(fs)));
176176
SPIFFS_GC_DBG("gc_check: finished\n");
177177

178-
//printf("gcing finished %i dirty, blocks %i free, %i pages free, %i tries, res %i\n",
178+
//printf("gcing finished %d dirty, blocks %d free, %d pages free, %d tries, res %d\n",
179179
// fs->stats_p_allocated + fs->stats_p_deleted,
180180
// fs->free_blocks, free_pages, tries, res);
181181

@@ -213,7 +213,7 @@ s32_t spiffs_gc_erase_page_stats(
213213
} // per entry
214214
obj_lookup_page++;
215215
} // per object lookup page
216-
SPIFFS_GC_DBG("gc_check: wipe pallo:%i pdele:%i\n", allo, dele);
216+
SPIFFS_GC_DBG("gc_check: wipe pallo:%d pdele:%d\n", allo, dele);
217217
fs->stats_p_allocated -= allo;
218218
fs->stats_p_deleted -= dele;
219219
return res;
@@ -249,7 +249,6 @@ s32_t spiffs_gc_find_candidate(
249249
while (res == SPIFFS_OK && blocks--) {
250250
u16_t deleted_pages_in_block = 0;
251251
u16_t used_pages_in_block = 0;
252-
253252
int obj_lookup_page = 0;
254253
// check each object lookup page
255254
while (res == SPIFFS_OK && obj_lookup_page < (int)SPIFFS_OBJ_LOOKUP_PAGES(fs)) {
@@ -298,7 +297,7 @@ s32_t spiffs_gc_find_candidate(
298297
used_pages_in_block * SPIFFS_GC_HEUR_W_USED +
299298
erase_age * SPIFFS_GC_HEUR_W_ERASE_AGE;
300299
int cand_ix = 0;
301-
SPIFFS_GC_DBG("gc_check: bix:%i del:%i use:%i score:%i\n", cur_block, deleted_pages_in_block, used_pages_in_block, score);
300+
SPIFFS_GC_DBG("\ngc_check: bix:%d del:%d use:%d score:%d\n", cur_block, deleted_pages_in_block, used_pages_in_block, score);
302301
while (cand_ix < max_candidates) {
303302
if (cand_blocks[cand_ix] == (spiffs_block_ix)-1) {
304303
cand_blocks[cand_ix] = cur_block;
@@ -367,7 +366,7 @@ s32_t spiffs_gc_clean(spiffs *fs, spiffs_block_ix bix) {
367366
spiffs_page_object_ix_header *objix_hdr = (spiffs_page_object_ix_header *)fs->work;
368367
spiffs_page_object_ix *objix = (spiffs_page_object_ix *)fs->work;
369368

370-
SPIFFS_GC_DBG("gc_clean: cleaning block %i\n", bix);
369+
SPIFFS_GC_DBG("gc_clean: cleaning block %d\n", bix);
371370

372371
c_memset(&gc, 0, sizeof(spiffs_gc));
373372
gc.state = FIND_OBJ_DATA;
@@ -376,11 +375,11 @@ s32_t spiffs_gc_clean(spiffs *fs, spiffs_block_ix bix) {
376375
// move free cursor to next block, cannot use free pages from the block we want to clean
377376
fs->free_cursor_block_ix = (bix+1)%fs->block_count;
378377
fs->free_cursor_obj_lu_entry = 0;
379-
SPIFFS_GC_DBG("gc_clean: move free cursor to block %i\n", fs->free_cursor_block_ix);
378+
SPIFFS_GC_DBG("gc_clean: move free cursor to block %d\n", fs->free_cursor_block_ix);
380379
}
381380

382381
while (res == SPIFFS_OK && gc.state != FINISHED) {
383-
SPIFFS_GC_DBG("gc_clean: state = %i entry:%i\n", gc.state, cur_entry);
382+
SPIFFS_GC_DBG("gc_clean: state = %d entry:%d\n", gc.state, cur_entry);
384383
gc.obj_id_found = 0;
385384

386385
// scan through lookup pages
@@ -403,7 +402,7 @@ s32_t spiffs_gc_clean(spiffs *fs, spiffs_block_ix bix) {
403402
case FIND_OBJ_DATA:
404403
if (obj_id != SPIFFS_OBJ_ID_DELETED && obj_id != SPIFFS_OBJ_ID_FREE &&
405404
((obj_id & SPIFFS_OBJ_ID_IX_FLAG) == 0)) {
406-
SPIFFS_GC_DBG("gc_clean: FIND_DATA state:%i - found obj id %04x\n", gc.state, obj_id);
405+
SPIFFS_GC_DBG("gc_clean: FIND_DATA state:%d - found obj id %04x\n", gc.state, obj_id);
407406
gc.obj_id_found = 1;
408407
gc.cur_obj_id = obj_id;
409408
scan = 0;
@@ -547,7 +546,7 @@ s32_t spiffs_gc_clean(spiffs *fs, spiffs_block_ix bix) {
547546
cur_entry = 0;
548547
break;
549548
}
550-
SPIFFS_GC_DBG("gc_clean: state-> %i\n", gc.state);
549+
SPIFFS_GC_DBG("gc_clean: state-> %d\n", gc.state);
551550
} // while state != FINISHED
552551

553552

hardware/esp8266com/esp8266/cores/esp8266/spiffs/spiffs_hydrogen.c

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,14 @@ s32_t SPIFFS_mount(spiffs *fs, spiffs_config *config, u8_t *work,
6868
s32_t res = spiffs_obj_lu_scan(fs);
6969
SPIFFS_API_CHECK_RES_UNLOCK(fs, res);
7070

71-
SPIFFS_DBG("page index byte len: %i\n", SPIFFS_CFG_LOG_PAGE_SZ(fs));
72-
SPIFFS_DBG("object lookup pages: %i\n", SPIFFS_OBJ_LOOKUP_PAGES(fs));
73-
SPIFFS_DBG("page pages per block: %i\n", SPIFFS_PAGES_PER_BLOCK(fs));
74-
SPIFFS_DBG("page header length: %i\n", sizeof(spiffs_page_header));
75-
SPIFFS_DBG("object header index entries: %i\n", SPIFFS_OBJ_HDR_IX_LEN(fs));
76-
SPIFFS_DBG("object index entries: %i\n", SPIFFS_OBJ_IX_LEN(fs));
77-
SPIFFS_DBG("available file descriptors: %i\n", fs->fd_count);
78-
SPIFFS_DBG("free blocks: %i\n", fs->free_blocks);
71+
SPIFFS_DBG("page index byte len: %d\n", SPIFFS_CFG_LOG_PAGE_SZ(fs));
72+
SPIFFS_DBG("object lookup pages: %d\n", SPIFFS_OBJ_LOOKUP_PAGES(fs));
73+
SPIFFS_DBG("page pages per block: %d\n", SPIFFS_PAGES_PER_BLOCK(fs));
74+
SPIFFS_DBG("page header length: %d\n", sizeof(spiffs_page_header));
75+
SPIFFS_DBG("object header index entries: %d\n", SPIFFS_OBJ_HDR_IX_LEN(fs));
76+
SPIFFS_DBG("object index entries: %d\n", SPIFFS_OBJ_IX_LEN(fs));
77+
SPIFFS_DBG("available file descriptors: %d\n", fs->fd_count);
78+
SPIFFS_DBG("free blocks: %d\n", fs->free_blocks);
7979

8080
fs->check_cb_f = check_cb_f;
8181

@@ -314,7 +314,7 @@ s32_t SPIFFS_write(spiffs *fs, spiffs_file fh, void *buf, u32_t len) {
314314
#endif
315315
}
316316

317-
SPIFFS_DBG("SPIFFS_write %i %04x offs:%i len %i\n", fh, fd->obj_id, offset, len);
317+
SPIFFS_DBG("SPIFFS_write %d %04x offs:%d len %d\n", fh, fd->obj_id, offset, len);
318318

319319
#if SPIFFS_CACHE_WR
320320
if ((fd->flags & SPIFFS_DIRECT) == 0) {
@@ -328,7 +328,7 @@ s32_t SPIFFS_write(spiffs *fs, spiffs_file fh, void *buf, u32_t len) {
328328
offset + len > fd->cache_page->offset + SPIFFS_CFG_LOG_PAGE_SZ(fs)) // writing beyond cache page
329329
{
330330
// boundary violation, write back cache first and allocate new
331-
SPIFFS_CACHE_DBG("CACHE_WR_DUMP: dumping cache page %i for fd %i:&04x, boundary viol, offs:%i size:%i\n",
331+
SPIFFS_CACHE_DBG("CACHE_WR_DUMP: dumping cache page %d for fd %d:&04x, boundary viol, offs:%d size:%d\n",
332332
fd->cache_page->ix, fd->file_nbr, fd->obj_id, fd->cache_page->offset, fd->cache_page->size);
333333
res = spiffs_hydro_write(fs, fd,
334334
spiffs_get_cache_page(fs, spiffs_get_cache(fs), fd->cache_page->ix),
@@ -345,14 +345,14 @@ s32_t SPIFFS_write(spiffs *fs, spiffs_file fh, void *buf, u32_t len) {
345345
if (fd->cache_page) {
346346
fd->cache_page->offset = offset;
347347
fd->cache_page->size = 0;
348-
SPIFFS_CACHE_DBG("CACHE_WR_ALLO: allocating cache page %i for fd %i:%04x\n",
348+
SPIFFS_CACHE_DBG("CACHE_WR_ALLO: allocating cache page %d for fd %d:%04x\n",
349349
fd->cache_page->ix, fd->file_nbr, fd->obj_id);
350350
}
351351
}
352352

353353
if (fd->cache_page) {
354354
u32_t offset_in_cpage = offset - fd->cache_page->offset;
355-
SPIFFS_CACHE_DBG("CACHE_WR_WRITE: storing to cache page %i for fd %i:%04x, offs %i:%i len %i\n",
355+
SPIFFS_CACHE_DBG("CACHE_WR_WRITE: storing to cache page %d for fd %d:%04x, offs %d:%d len %d\n",
356356
fd->cache_page->ix, fd->file_nbr, fd->obj_id,
357357
offset, offset_in_cpage, len);
358358
spiffs_cache *cache = spiffs_get_cache(fs);
@@ -373,7 +373,7 @@ s32_t SPIFFS_write(spiffs *fs, spiffs_file fh, void *buf, u32_t len) {
373373
// big write, no need to cache it - but first check if there is a cached write already
374374
if (fd->cache_page) {
375375
// write back cache first
376-
SPIFFS_CACHE_DBG("CACHE_WR_DUMP: dumping cache page %i for fd %i:%04x, big write, offs:%i size:%i\n",
376+
SPIFFS_CACHE_DBG("CACHE_WR_DUMP: dumping cache page %d for fd %d:%04x, big write, offs:%d size:%d\n",
377377
fd->cache_page->ix, fd->file_nbr, fd->obj_id, fd->cache_page->offset, fd->cache_page->size);
378378
res = spiffs_hydro_write(fs, fd,
379379
spiffs_get_cache_page(fs, spiffs_get_cache(fs), fd->cache_page->ix),
@@ -574,7 +574,7 @@ static s32_t spiffs_fflush_cache(spiffs *fs, spiffs_file fh) {
574574
fd->cache_page = spiffs_cache_page_get_by_fd(fs, fd);
575575
}
576576
if (fd->cache_page) {
577-
SPIFFS_CACHE_DBG("CACHE_WR_DUMP: dumping cache page %i for fd %i:%04x, flush, offs:%i size:%i\n",
577+
SPIFFS_CACHE_DBG("CACHE_WR_DUMP: dumping cache page %d for fd %d:%04x, flush, offs:%d size:%d\n",
578578
fd->cache_page->ix, fd->file_nbr, fd->obj_id, fd->cache_page->offset, fd->cache_page->size);
579579
res = spiffs_hydro_write(fs, fd,
580580
spiffs_get_cache_page(fs, spiffs_get_cache(fs), fd->cache_page->ix),
@@ -850,20 +850,20 @@ s32_t SPIFFS_vis(spiffs *fs) {
850850
SPIFFS_CHECK_RES(res);
851851

852852
if (erase_count != (spiffs_obj_id)-1) {
853-
spiffs_printf("\tera_cnt: %i\n", erase_count);
853+
spiffs_printf("\tera_cnt: %d\n", erase_count);
854854
} else {
855855
spiffs_printf("\tera_cnt: N/A\n");
856856
}
857857

858858
bix++;
859859
} // per block
860860

861-
spiffs_printf("era_cnt_max: %i\n", fs->max_erase_count);
862-
spiffs_printf("last_errno: %i\n", fs->errno);
863-
spiffs_printf("blocks: %i\n", fs->block_count);
864-
spiffs_printf("free_blocks: %i\n", fs->free_blocks);
865-
spiffs_printf("page_alloc: %i\n", fs->stats_p_allocated);
866-
spiffs_printf("page_delet: %i\n", fs->stats_p_deleted);
861+
spiffs_printf("era_cnt_max: %d\n", fs->max_erase_count);
862+
spiffs_printf("last_errno: %d\n", fs->errno);
863+
spiffs_printf("blocks: %d\n", fs->block_count);
864+
spiffs_printf("free_blocks: %d\n", fs->free_blocks);
865+
spiffs_printf("page_alloc: %d\n", fs->stats_p_allocated);
866+
spiffs_printf("page_delet: %d\n", fs->stats_p_deleted);
867867

868868
SPIFFS_UNLOCK(fs);
869869
return res;

0 commit comments

Comments
 (0)