Skip to content

Commit ec90ceb

Browse files
committed
clean up flash
1 parent d8099f4 commit ec90ceb

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

libraries/InternalFileSytem/src/InternalFileSystem.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ static int _internal_flash_read (const struct lfs_config *c, lfs_block_t block,
4848
(void) c;
4949

5050
uint32_t addr = lba2addr(block) + off;
51-
flash_nrf5x_read(buffer, addr, size);
51+
VERIFY( flash_nrf5x_read(buffer, addr, size) > 0, -1);
5252

5353
return 0;
5454
}
@@ -61,7 +61,7 @@ static int _internal_flash_prog (const struct lfs_config *c, lfs_block_t block,
6161
(void) c;
6262

6363
uint32_t addr = lba2addr(block) + off;
64-
flash_nrf5x_write(addr, buffer, size);
64+
VERIFY( flash_nrf5x_write(addr, buffer, size), -1)
6565

6666
return 0;
6767
}

libraries/InternalFileSytem/src/flash/flash_cache.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ void flash_cache_flush (flash_cache_t* fc)
8383
// skip erase & program if verify() exists, and memory matches
8484
if ( !(fc->verify && fc->verify(fc->cache_addr, fc->cache_buf, FLASH_CACHE_SIZE)) )
8585
{
86-
// indicator
86+
// indicator TODO allow to disable flash indicator
8787
ledOn(LED_BUILTIN);
8888

8989
fc->erase(fc->cache_addr);

libraries/InternalFileSytem/src/flash/flash_nrf5x.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,15 @@ static bool fal_verify (uint32_t addr, void const * buf, uint32_t len);
5959

6060
static uint8_t _cache_buffer[FLASH_CACHE_SIZE] __attribute__((aligned(4)));
6161

62-
static flash_cache_t _cache = {
63-
.erase = fal_erase,
64-
.program = fal_program,
65-
.read = fal_read,
66-
.verify = fal_verify,
62+
static flash_cache_t _cache =
63+
{
64+
.erase = fal_erase,
65+
.program = fal_program,
66+
.read = fal_read,
67+
.verify = fal_verify,
68+
6769
.cache_addr = FLASH_CACHE_INVALID_ADDR,
68-
.cache_buf = _cache_buffer
70+
.cache_buf = _cache_buffer
6971
};
7072

7173
//--------------------------------------------------------------------+
@@ -100,7 +102,7 @@ bool flash_nrf5x_erase(uint32_t addr)
100102
//--------------------------------------------------------------------+
101103
// HAL for caching
102104
//--------------------------------------------------------------------+
103-
bool fal_erase (uint32_t addr)
105+
static bool fal_erase (uint32_t addr)
104106
{
105107
// Init semaphore for first call
106108
if ( _sem == NULL )

0 commit comments

Comments
 (0)