Skip to content

Add support for external flash chips and improve mass storage. #31

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

Merged
merged 11 commits into from
Oct 21, 2016

Conversation

tannewt
Copy link
Member

@tannewt tannewt commented Oct 21, 2016

This is a whole host of changes that add support for external flash chips rather than internal flash.

Flash chips tend to have erase sectors larger than the 512 byte sector size. These commits add two ways to temporarily save the information next to the sector being written. The first added is a slower, low ram solution that uses a spare sector at the end of the flash as scratch space. This is slow and wears that last spare sector a lot so theres a ram cache also added that grabs a sector's worth of memory from the MicroPython heap and uses it to cache the data. This is used most often and falls back to the scratch sector method when low on memory.

Lastly, there are a few odds and ends:

  • Makes USB accessible volumes read-only to MicroPython to prevent file system corruption due to two computers at once changing it.
  • Saves 3.5k ram by reducing the max sector size in FatFs.
  • Improves USB write/Python read responsiveness by updating the FatFs sector cache when the USB writes to the same sector.

storage to use micropython's VFS interface.

This makes mass storage work with any VFS implementation rather
than a single one.
This uses a scratch flash sector to save data before writing a full sector.
The code will fallback to the flash scratch space when the GC
cannot allocate us enough memory.
This prevents file system corruption due to two systems mutating
it at once.
same.

Also switch the max size back to 512 for atmel-samd to save ram.
to the same sector.

This fixes #20, the issue where a listdir or import won't work
without a reset when it was run before the file was copied.
Copy link

@tdicola tdicola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@tannewt tannewt merged commit 30dc241 into adafruit:master Oct 21, 2016
tannewt pushed a commit that referenced this pull request Nov 10, 2020
Update from adafruit/main
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

Successfully merging this pull request may close these issues.

2 participants