PaulStoffregen / LittleFS

75 stars 20 forks source link

Added QSPI Initialize Function for Total erase #4

Closed mjs513 closed 3 years ago

mjs513 commented 3 years ago

Paul - @Defragster

Added a new function for the QSPIFlash, initialize, that does a full media format, guess see this and above: https://forum.pjrc.com/threads/58033-LittleFS-port-to-Teensy-SPIFlash?p=259855&viewfull=1#post259855

Its based on FrankB's eraseChip function and what I also used in spiffs in addition to the basic format command.

You may want to move the LUT60 up to the begin function since its not used anywhere else it seems.

PaulStoffregen commented 3 years ago

I would prefer to add this at the LittleFS base level, using calls to the erase block function (so it's usable on all media types). Do you see any reason why that wouldn't fill the same need as this PR?

Defragster commented 3 years ago

LittleFS base level ... yes would be better. Ideally then there would be the same for SPI and QSPI and Program Flash.

Assuming the first time writes will run faster if used for pushing out a stream of data - like pre-allocating a file on SD.

PaulStoffregen commented 3 years ago

Last night I was thinking about this sort of function when I added the 2nd boolean, so we can know whether the hardware is configured separate from whether the logical filesytem is mounted.

I'm leaning towards a more descriptive name like "eraseAll". The name "initialize" could be mistaken to mean just turning on the hardware. I want a name that clearly communicates you will lose any & all stored data. Any thoughts on that?

Defragster commented 3 years ago

Normally that " lose any & all stored data" comes with Format. On Windows there is a checkbox for 'Quick' that just puts the FS format clean structs in place without spending the time to fully do a byte by byte write of Low Level that "rewrites the magnetic sectors". In either case All data is lost to a 'user'.

When it comes to NOR FLASH that 'low level format' may be useful for what magnetic drives do finding and relocating bad sectors.

That doesn't present a better name - unless lowLevelFormat() sounds good? But it could be needed for the NOR's.

mjs513 commented 3 years ago

Yeah - was struggling with initialize as well. What Frank and I both used was "eraseFlashChip" versus "eraseDevice". May along the lines of what @defragster was talking about formatFull vs format, or possibly change from format (what we have now to quickFormat and use format for the proposed initialize function?

Defragster commented 3 years ago

I like making current format >> quickFormat. And having format() be the lowLevel Format.

As you can tell .format() confused me in what is was doing given that is just did a FS struct init - not a format.

PaulStoffregen commented 3 years ago

Ok, lowlevelFormat() it is! https://github.com/PaulStoffregen/LittleFS/commit/b3a4e4e5403238f85854f04f2f992ab2f33f0c52

Defragster commented 3 years ago

That looks cool

PaulStoffregen commented 3 years ago

Yes, quickFormat() is better. https://github.com/PaulStoffregen/LittleFS/commit/79c1f7e122baeac8947481d2390c821f36a24dc6

Defragster commented 3 years ago

Except I see quickFormat is pending an annoucenment ...

Defragster commented 3 years ago

Just a fun note in my download folder I just got :: LittleFS-main (11).zip

PaulStoffregen commented 3 years ago

looks like this can be closed now

mjs513 commented 3 years ago

Geez - took a nap and the world changes again :)