GithubHelp home page GithubHelp logo

armmbed / mbed-littlefs Goto Github PK

View Code? Open in Web Editor NEW
74.0 107.0 34.0 436 KB

[experimental] Mbed OS wrapper for LittleFS v2.0 (alpha)

Home Page: https://github.com/ARMmbed/littlefs

C++ 39.80% Makefile 0.36% C 45.92% Python 13.91% Shell 0.01%

mbed-littlefs's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mbed-littlefs's Issues

upgrade script from main repo

@geky as per our previous conversation about upgrade to V2 from main repo here is a script for autorenaming all required files. Just create this file in main repo, run and copy the result back this repo

#!/bin/bash

for fullpath in $(find ./ -type f); do
    # echo "Processing file ${fullpath}"

    # replace string lfs with lfs2 (it renames lfs1 to lfs21, correction is applied)
    sed -i -e 's/lfs/lfs2/g;s/LFS/LFS2/g;s/lfs21/lfs2/g;s/LFS21/LFS2/g' $fullpath

    # rename files begins with lfs* to lfs2*
    filename="${fullpath##*/}"

    if  [[ $filename == lfs* ]]; then
        new_path="${fullpath:0:${#fullpath} - ${#filename}}${filename:0:3}2${filename:3}"
        mv $fullpath $new_path
        # echo "Renamed ${fullpath} -> ${new_path}"
    fi
done

Possible infinite loop in dir fetch match

Hi,

We are using lfs2 along with Mbed-OS and FlashIAP for the STM32G0 target. During our usage in development we've experienced no issue running the application. But after the deployment stage in a client, it occurred that power supply was cutoff from about 100 devices and all experienced the same outcome. They all got stuck on LittleFS initialization, more precisely in the lfs2_dir_fetchmatch while(true) loop, which is called by lfs2_mount. We can't understand exactly why this is happening, and we can't debug further. So far, with the help of GDB and OpenOCD, the only clue we could get is that in normal operation it should in some moment break in the following statement:

 if (!lfs2_tag_isvalid(tag)) {
    dir->erased = (lfs2_tag_type1(ptag) == LFS2_TYPE_CRC &&
            dir->off % lfs2->cfg->prog_size == 0);
    break;
}

We are not sure if the application is just getting stuck in an infinite loop or if some internal error are being thrown out and then the board stops.

I'm attaching a print from GDB server with its backtrace until the application reaches the watchdog timeout handler.
image

fwrite or frpintf or file_write invokes write to littlefs.

I am having query I saw few example in which somwhere used frpintf , fwrite to write to a file in littlefs.

  1. Just wanted to know which of them invokes lfs2_file_write ?
  2. Whether writing to a littlefs file using fwrite or fprintf involves virtual filesytem layer?

Does LFS require ~5 free blocks ?

Hello,

It seems that if I use very small embedded with only 5 blocks,
then after filling a file in size of 1 block, I can't open another file - as if it can't actually use all the blocks...
Why can't we use all available blocks ? And is it that 5 blocks are used for other purpose ?

Thanks

LittleFS: file created, written, closed but seems to be empty for lfs_stat() and lfs_file_read().

The following code demonstrates a bug in LittleFS.
A file is created, written, closed with no errors, but seems to be empty (lfs_stat() shows zero size, lfs_file_read() returns zero).
In the sample below errorCnt increments every 5th iteration. The bug recurrence actually depends on the block_size. The problem occurs when LFS allocates new block to extend the directory.
Reproduced on both HeapBlockDevice and lfs_emubd.

HeapBlockDevice hbd(1024 * 512, 128);
hbd.init();

lfs_t fs = {0};
lfs_config cfg = {0};

cfg.context = &hbd;
cfg.read = lfs_bd_read;
cfg.prog = lfs_bd_prog;
cfg.erase = lfs_bd_erase;
cfg.sync = lfs_bd_sync;
cfg.read_size = hbd.get_read_size();
cfg.prog_size = hbd.get_program_size();
cfg.block_size = hbd.get_erase_size();
cfg.block_count = hbd.size() / cfg.block_size;
cfg.lookahead = 32 * ((cfg.block_count + 31) / 32);

lfs_format(&fs, &cfg);
lfs_mount(&fs, &cfg);

for (int i = 0; i < 32; ++i)
{
	char name[256];
	snprintf(name, 256, "TestFile%u", i);
	lfs_file_t ff;
	lfs_file_open(&fs, &ff, name, LFS_O_WRONLY | LFS_O_CREAT);
	lfs_file_write(&fs, &ff, "Hello World", 11);
	lfs_file_close(&fs, &ff);

	lfs_info info;
	int err = lfs_stat(&fs, name, &info);
	if(0 == err)
	{
		if(info.size != 11)
		{
			static int errorCnt = 0;
			errorCnt++;
		}
	}
}
lfs_unmount(&fs);
hbd.deinit();

TESTS\filesystem\parallel - Not parallel

Test cases in TESTS\filesystem\parallel folder are not actually read/write to files in parallel test case. It is actually read/write to multiple files sequentially.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.