Skip to content

Commit

Permalink
pkg/littlefs: add warning if block size is not reasonable
Browse files Browse the repository at this point in the history
  • Loading branch information
fabian18 committed Jul 31, 2022
1 parent 4dd5cb3 commit 578e628
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/littlefs/fs/littlefs_fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ static int prepare(littlefs_desc_t *fs)

memset(&fs->fs, 0, sizeof(fs->fs));

static_assert(0 > LITTLEFS_MIN_BLOCK_SIZE_EXP ||
6 < LITTLEFS_MIN_BLOCK_SIZE_EXP,
"LITTLEFS_MIN_BLOCK_SIZE_EXP must be at least 7, "
"to configure a reasonable block size of at least 128 bytes.");

size_t block_size = fs->dev->pages_per_sector * fs->dev->page_size;
#if LITTLEFS_MIN_BLOCK_SIZE_EXP >= 0
block_size = ((block_size - 1) + (1u << LITTLEFS_MIN_BLOCK_SIZE_EXP))
Expand Down

0 comments on commit 578e628

Please # to comment.