Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to create a new file or directory in a file generated using LFS? #95

Open
pine-fish opened this issue Jun 29, 2024 · 8 comments
Open

Comments

@pine-fish
Copy link

I only found a way to create a new LFS file in the example, without adding content to the existing LFS file, I think this should be achievable, If possible, please give me a demonstration. Thank you

@pine-fish
Copy link
Author

I have found a way to manipulate the contents of the lfs file. I export the data from the LFS partition on the device to bin and put it into this library. The library can correctly recognize the files in bin, and then I use the library to add files to bin. When I recognize it again, it shows that it has been successfully added, which means that this bin contains both the device's own files and the newly created files using the library. Next, I will rewrite this bin into the device's flash. When I start the device, it prompts a mount failure and receives an -84 error code. Why did this issue occur

@BrianPugh
Copy link
Collaborator

What version of littlefs are you running on your microcontroller? Newer version of littlefs are not backwards compatible with older versions (~1yr old).

@pine-fish
Copy link
Author

2.5.0,I tried to upgrade the device's LFS to 2.9.0 today, which is the same as the version of this library, but it still failed
In addition, my previous tests were not completely unsuccessful. There were a few times when the LFS on the device could recognize the files and data contained in the library generated files, but only those few times. Afterwards, either the mount failed or the mount succeeded but the files inside were not recognized
I took a look and the biggest difference is that in the files generated by the library, the operation records start from super block 3, while the device's LFS starts recording operations from super block 2. I tried to have the device write data repeatedly, bring the operation records to super block 3, and then rewrite them to flash, but it still failed
These are the two LFS files I am using. Can you help me analyze this issue? thank you
bin.zip

@pine-fish pine-fish reopened this Jul 1, 2024
@BrianPugh
Copy link
Collaborator

what is the block_size that created these files?

@pine-fish
Copy link
Author

4096

@BrianPugh
Copy link
Collaborator

I was unable to unpack the Library generated.bin you uploaded. I unpacked the device-generated and repacked it, does the following work for you? The contents should be (all 0 bytes in size):

111.bin
2222.hex
33333.jpg

library-generated.bin.zip

@BrianPugh
Copy link
Collaborator

related: I just opened a PR reworking the CLI to be a bit more intuitive, you can try playing around with it if you'd like:

#96

@pine-fish
Copy link
Author

I was unable to unpack the Library generated.bin you uploaded. I unpacked the device-generated and repacked it, does the following work for you? The contents should be (all 0 bytes in size):

111.bin
2222.hex
33333.jpg

library-generated.bin.zip

I wrote this bin into the device's flash, but it still returns -84.
The super block number in this bin still starts from 3. Do you have a way to make it start from 2? Because my device starts recording from Super Block 2, which can also be seen in the bin I uploaded

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants