-
Notifications
You must be signed in to change notification settings - Fork 402
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
spiffs_page_delete relies on 0 -> 1 transitions being ignored #172
Comments
#173 is my quick whack at it. i'm not at all sure this is all that needs to be done, but tests are now passing without the "flags exemption". |
We can drop the SLFS container contraption now! It doesn't work properly on CC3220 anyway: it is no longer possible to read an SLFS file while it's open for writing, it needs to be re-opened read-only, which means even more container switches and even more terrible write performance. Good riddance. Instead, we put SPIFFS at the end of internal flash. The TRM speaks about flash bing organized in two banks of 512K, so i think this limits code size to 512K (or we'll have to put flash programming routines in RAM and play other tricks to avoid trying to execute code from the bank that is being programmed). But we're nowhere near 512K anyway (~200K currently), so it's grand. Since it is not possible to program internal flash directly when flashing, we instead put a container on SLFS and transfer it to internal flash on first boot. TI's flash controller is a bit anal-retentive about writes and raises an error if you try to flip bits from 0 to 1 instead of just ignoring it like everybody else in the world. Turns out, SPIFFS is playing fast and loose with this in some places, which has been reported upstream: pellepl/spiffs#172 This PR integrates pellepl/spiffs#173 which is my humble attempt at fixing it, and seems to work ok. PUBLISHED_FROM=65ffe0169b75a5c5685f6a336eb6fd875f181195
We can drop the SLFS container contraption now! It doesn't work properly on CC3220 anyway: it is no longer possible to read an SLFS file while it's open for writing, it needs to be re-opened read-only, which means even more container switches and even more terrible write performance. Good riddance. Instead, we put SPIFFS at the end of internal flash. The TRM speaks about flash bing organized in two banks of 512K, so i think this limits code size to 512K (or we'll have to put flash programming routines in RAM and play other tricks to avoid trying to execute code from the bank that is being programmed). But we're nowhere near 512K anyway (~200K currently), so it's grand. Since it is not possible to program internal flash directly when flashing, we instead put a container on SLFS and transfer it to internal flash on first boot. TI's flash controller is a bit anal-retentive about writes and raises an error if you try to flip bits from 0 to 1 instead of just ignoring it like everybody else in the world. Turns out, SPIFFS is playing fast and loose with this in some places, which has been reported upstream: pellepl/spiffs#172 This PR integrates pellepl/spiffs#173 which is my humble attempt at fixing it, and seems to work ok. PUBLISHED_FROM=65ffe0169b75a5c5685f6a336eb6fd875f181195
Sorry for belated reply. I am deliberately sloppy here as, in my view, this is an optimization. |
controller is the one built into TI CC3220, but i think it's generic to TI (Tiva chips have the same).
and indeed controller refuses the entire write operation if any of the data loaded into the data registers tries to flip bits from 0 to 1. yes, it saves a read. makes sense to make it a config option, sure. |
what would you call the option? i'll amend #173. |
Ummm.... That is a very good question. _CONFIG_READB4WRITE? I'm open to
suggestions. 😉
|
Off topic, but the CC32 flash, that is the internal flash rom you're referring to? Not anything external to the uC itself? |
yes, i'm using part of internal flash for the filesystem. |
SPIFFS_CONFIG_NO_BLIND_WRITES ?
Splendid! Much better.
Ok, internal flashes seem to have more weird constraints in general. The
EFR only allows two writes to same address before one must erase IIRC.
|
I am working with a flash controller that does not like it when application tried to set bits from 0 to 1.
naturally, it's not possible, and most controllers just ignore it, but not this one - it raises an error for such writes, and I found that SPIFFS is a bit sloppy in this regard.
It seems that
spiffs_page_delete
tries to set the flags blindly, assuming that 0 -> 1 transitions will be ignored. Well, that is not always the case and SPIFFS should not assume this behavior of the underlying controller.The text was updated successfully, but these errors were encountered: