You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Process returned 0 (0x0) execution time : 0.009 s
Press any key to continue.`
Trying to test it on RAM buffer, but even lot of memory is there, it is still erasing each block after writing just a small string!!
If I increase all prog size, read size, cache size etc to 128 or so, it works, but this should not be the expected behaviour and this can damage my flash memory due to this buggy erase behaviour !! Any clue ?
The text was updated successfully, but these errors were encountered:
Trying to test it on RAM buffer, but even lot of memory is there, it is still erasing each block after writing just a small string!!
If I increase all prog size, read size, cache size etc to 128 or so, it works, but this should not be the expected behaviour and this can damage my flash memory due to this buggy erase behaviour !! Any clue ?
I have the same "issue", however this is actually just how littlefs works. littlefs doesn't track what has been erased! See #905 (comment) .
**#include "lfs.h"
lfs_t lfs;
lfs_file_t file;
#define BLOCK_COUNT 10
#define BLOCK_SIZE (1024*8)
uint8_t buff[BLOCK_SIZE * BLOCK_COUNT];
static int lfs_hal_read(const struct lfs_config *c, lfs_block_t block, lfs_off_t off, void *buffer, lfs_size_t size)
{
// printf("read from block %d with offset %d with size %d\n", block, off, size);
}
static int lfs_hal_prog(const struct lfs_config *c, lfs_block_t block, lfs_off_t off, const void *buffer, lfs_size_t size)
{
//printf("write to block %d with offset %d with size %d\n", block, off, size);
}
static int lfs_hal_erase(const struct lfs_config *c, lfs_block_t block)
{
memset( buff + (BLOCK_SIZE * block), 0xff, BLOCK_SIZE);
printf("erasing block %d\n", block);
return 0;
}
static int lfs_hal_sync(const struct lfs_config *c)
{
printf("sync\n");
return 0;
}
// configuration of the filesystem is provided by this struct
const struct lfs_config cfg = {
// block device operations
.read = lfs_hal_read,
.prog = lfs_hal_prog,
.erase = lfs_hal_erase,
.sync = lfs_hal_sync,
};
void main(void)
{
int err = lfs_mount(&lfs, &cfg);
}**
`F:\PROJECT\scratch\littlefs\lfs.c:1370:error: Corrupted dir pair at {0x0, 0x1}
erasing block 0
sync
erasing block 1
sync
sync
read data =
erasing block 8
sync
sync
read data = http://broker.hivemq.com/0
erasing block 9
sync
sync
read data = http://broker.hivemq.com/1
erasing block 2
sync
sync
read data = http://broker.hivemq.com/2
erasing block 3
sync
sync
read data = http://broker.hivemq.com/3
erasing block 4
sync
sync
read data = http://broker.hivemq.com/4
erasing block 5
sync
sync
read data = http://broker.hivemq.com/5
erasing block 6
sync
sync
read data = http://broker.hivemq.com/6
erasing block 7
sync
sync
read data = http://broker.hivemq.com/7
erasing block 8
sync
sync
read data = http://broker.hivemq.com/8
erasing block 9
sync
sync
Process returned 0 (0x0) execution time : 0.009 s
Press any key to continue.`
Trying to test it on RAM buffer, but even lot of memory is there, it is still erasing each block after writing just a small string!!
If I increase all prog size, read size, cache size etc to 128 or so, it works, but this should not be the expected behaviour and this can damage my flash memory due to this buggy erase behaviour !! Any clue ?
The text was updated successfully, but these errors were encountered: