diff --git a/soc/runtime/flash_storage.c b/soc/runtime/flash_storage.c index 547087fd0..34bc3a508 100644 --- a/soc/runtime/flash_storage.c +++ b/soc/runtime/flash_storage.c @@ -9,6 +9,7 @@ #include #include +#include "log.h" #include "flash_storage.h" #if (defined CSR_SPIFLASH_BASE && defined SPIFLASH_PAGE_SIZE) @@ -62,21 +63,21 @@ static int record_iter_next(struct iter_state *is, struct record *record, int *f return 0; if(record->size < 6) { - printf("flash_storage might be corrupted: record size is %u (<6) at address %08x\n", record->size, record->raw_record); + log("flash_storage might be corrupted: record size is %u (<6) at address %08x", record->size, record->raw_record); if(fatal) *fatal = 1; return 0; } if(is->seek > is->buf_len - sizeof(record->size) - 2) { /* 2 is the minimum key length */ - printf("flash_storage might be corrupted: END_MARKER missing at the end of the storage sector\n"); + log("flash_storage might be corrupted: END_MARKER missing at the end of the storage sector"); if(fatal) *fatal = 1; return 0; } if(record->size > is->buf_len - is->seek) { - printf("flash_storage might be corrupted: invalid record_size %d at address %08x\n", record->size, record->raw_record); + log("flash_storage might be corrupted: invalid record_size %d at address %08x", record->size, record->raw_record); if(fatal) *fatal = 1; return 0; @@ -86,7 +87,7 @@ static int record_iter_next(struct iter_state *is, struct record *record, int *f record->key_len = strnlen(record->key, record->size - sizeof(record->size)) + 1; if(record->key_len == record->size - sizeof(record->size) + 1) { - printf("flash_storage might be corrupted: invalid key length at address %08x\n", record->raw_record); + log("flash_storage might be corrupted: invalid key length at address %08x", record->raw_record); if(fatal) *fatal = 1; return 0; @@ -258,7 +259,7 @@ int fs_write(char *key, void *buffer, unsigned int buf_len) return 0; // Storage is definitely full. fatal_error: - printf("fatal error: flash storage might be corrupted\n"); + log("fatal error: flash storage might be corrupted"); return 0; } @@ -289,7 +290,7 @@ unsigned int fs_read(char *key, void *buffer, unsigned int buf_len, unsigned int } if(fatal) - printf("fatal error: flash storage might be corrupted\n"); + log("fatal error: flash storage might be corrupted"); return read_length; }