ARMmbed / mbed-os-example-filesystem

The Mbed OS file system example
https://mbed.com
Apache License 2.0
16 stars 33 forks source link

numbers stored on disk are not incremented after boot #40

Closed SamiLappalainenArm closed 6 years ago

SamiLappalainenArm commented 6 years ago

similar ticket has been closed, https://github.com/ARMmbed/mbed-os-example-filesystem/issues/16

used LittleFileSystem

following output has compiled by using ARM.

--- Mbed OS filesystem example --- Mounting the filesystem... lfs error:469: Corrupted dir pair at 0 1 lfs error:2202: Invalid superblock at 64693 500 Fail :( No filesystem found, formatting... OK Opening "/fs/numbers.txt"... Fail :( No file found, creating a new file... OK Writing numbers (10/10)... OK Seeking file... OK Incrementing numbers (10/10)... OK Closing "/fs/numbers.txt"... OK Opening the root directory... OK root directory: . .. numbers.txt Closing the root directory... OK Opening "/fs/numbers.txt"... OK numbers: 1 1 2 3 4 5 6 7 8 9 Closing "/fs/numbers.txt"... OK Unmounting... OK Mbed OS filesystem example done! --- Mbed OS filesystem example --- Mounting the filesystem... OK Opening "/fs/numbers.txt"... OK Incrementing numbers (10/10)... OK Closing "/fs/numbers.txt"... OK Opening the root directory... OK root directory: . .. numbers.txt Closing the root directory... OK Opening "/fs/numbers.txt"... OK numbers: 2 1 2 3 4 5 6 7 8 9 Closing "/fs/numbers.txt"... OK Unmounting... OK Mbed OS filesystem example done!

SamiLappalainenArm commented 6 years ago

compiling with GCC_ARM gives following output (seems to work correctly)

--- Mbed OS filesystem example --- Mounting the filesystem... OK Opening "/fs/numbers.txt"... OK Incrementing numbers (10/10)... OK Closing "/fs/numbers.txt"... OK Opening the root directory... OK root directory: . .. numbers.txt Closing the root directory... OK Opening "/fs/numbers.txt"... OK numbers: 5 3 4 5 6 7 8 9 10 11 Closing "/fs/numbers.txt"... OK Unmounting... OK Mbed OS filesystem example done! --- Mbed OS filesystem example --- Mounting the filesystem... OK Opening "/fs/numbers.txt"... OK Incrementing numbers (10/10)... OK Closing "/fs/numbers.txt"... OK Opening the root directory... OK root directory: . .. numbers.txt Closing the root directory... OK Opening "/fs/numbers.txt"... OK numbers: 6 4 5 6 7 8 9 10 11 12 Closing "/fs/numbers.txt"... OK Unmounting... OK Mbed OS filesystem example done!

SamiLappalainenArm commented 6 years ago

it seems that used filesystem does not have any impact to functionality only used complier has impact to the output

kegilbert commented 6 years ago

Can you try wiping the storage device by pressing BUTTON1? I've seen before when the storage device gets in a bad state on previous runs the behavior can persist across new binaries.

Do you have this commit as well? Had previously fixed it for both @geky and myself.

https://github.com/ARMmbed/mbed-os-example-filesystem/commit/29a91bfe10af6c5fa8e879b85df6fca29029ca31

geky commented 6 years ago

Also which block device are you using?

SamiLappalainenArm commented 6 years ago

I have used block device definition shown below:

SDBlockDevice bd( MBED_CONF_SD_SPI_MOSI, MBED_CONF_SD_SPI_MISO, MBED_CONF_SD_SPI_CLK, MBED_CONF_SD_SPI_CS);

SamiLappalainenArm commented 6 years ago

by pressing Button1 (SW2) before reset does not help:

--- Mbed OS filesystem example --- Mounting the filesystem... Fail :( No filesystem found, formatting... OK Opening "/fs/numbers.txt"... Fail :( No file found, creating a new file... OK Writing numbers (10/10)... OK Seeking file... OK Incrementing numbers (10/10)... OK Closing "/fs/numbers.txt"... OK Opening the root directory... OK root directory: numbers.txt Closing the root directory... OK Opening "/fs/numbers.txt"... OK numbers: 1 1 2 3 4 5 6 7 8 9 Closing "/fs/numbers.txt"... OK Unmounting... OK Mbed OS filesystem example done! Initializing the block device... OK Erasing the block device... OK Deinitializing the block device... OK --- Mbed OS filesystem example --- Mounting the filesystem... OK Opening "/fs/numbers.txt"... OK Incrementing numbers (10/10)... OK Closing "/fs/numbers.txt"... OK Opening the root directory... OK root directory: numbers.txt Closing the root directory... OK Opening "/fs/numbers.txt"... OK numbers: 2 1 2 3 4 5 6 7 8 9 Closing "/fs/numbers.txt"... OK Unmounting... OK Mbed OS filesystem example done!

kegilbert commented 6 years ago

What's your Mbed OS and Filesystem example commit hash? We can try to debug locally.

geky commented 6 years ago

@kegilbert I believe it's the same as https://github.com/ARMmbed/mbed-os-example-filesystem/issues/39#issuecomment-374144985

SamiLappalainenArm commented 6 years ago

above comment is correct related to used commit hash.

kegilbert commented 6 years ago

The fix here: 29a91bf is only on master it looks like, it needs to be cherry picked to the oob branch.

@geky

SamiLappalainenArm commented 6 years ago

this problem was solved after applying above fix

ciarmcom commented 6 years ago

ARM Internal Ref: MBOTRIAGE-510

cmonr commented 6 years ago

Closing since this is resolved.