Skip to content

DataFlash: Change erase size to pages to reduce memory usage. #10478

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 1 commit into from
May 21, 2019

Conversation

chrissnow
Copy link
Contributor

@chrissnow chrissnow commented Apr 25, 2019

Description

DataFlash supports page erases, this means that FATFS can use smaller sector sizes and therefore less memory for buffers since read-modify-write can be done in smaller chunks (there are 8 pages to a block)

It would be possible to optimise erases by erasing blocks or sectors where possible but this is not implemented.

This also means that when using non binary pages sizes that you do not exceed FF_MAX_SS of 4096 with 4224 on 16 and 32Mb devices. (DataFlash actually has 264b/528b per page)

Pull request type

[ ] Fix
[ ] Refactor
[ ] Target update
[X] Functionality change
[ ] Docs update
[ ] Test update
[ ] Breaking change

Release Notes

Previously the DataFlash driver exposed the minimum erase size as blocks which are typically 4K, DataFlash however supports page erases as small as 256B.

This change implements page erases which will lower RAM requirements for buffers.

Since this has no relation to any file system and lowers the minimum erase size it should not cause issues with devices with existing data stored on them, however a format of FatFs in future may end up with smaller sectors by default, which will further reduce RAM requirements.

@chrissnow chrissnow changed the title Change DataFlash erase size to pages to reduce memory usage. DataFlash: Change erase size to pages to reduce memory usage. Apr 25, 2019
@ciarmcom ciarmcom requested review from a team April 25, 2019 15:01
@ciarmcom
Copy link
Member

@chrissnow, thank you for your changes.
@ARMmbed/mbed-os-storage @ARMmbed/mbed-os-maintainers please review.

Copy link
Contributor

@davidsaada davidsaada left a comment

Choose a reason for hiding this comment

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

This change is surprising, as I wasn't aware of the fact you could erase a page. Is this supported on all dataflash components?

@chrissnow
Copy link
Contributor Author

Yes. All devices support page erases.

@davidsaada
Copy link
Contributor

Yes. All devices support page erases.

All right then, so this is definitely a good change. Approving.

@0xc0170
Copy link
Contributor

0xc0170 commented Apr 29, 2019

Yes. All devices support page erases.

@chrissnow Where can I verify this detail?

@chrissnow
Copy link
Contributor Author

chrissnow commented Apr 29, 2019

@0xc0170
I went through all of these for a start
https://www.adestotech.com/products/data-flash/

Also https://www.adestotech.com/wp-content/uploads/Adesto-Memory-Products-Brochure.pdf

The Adesto AT45DBxxx DataFlash devices offer uniform page erase size as small as 256 bytes

It seems the docs need an update too, it states it's I2C for a start!
https://os.mbed.com/docs/mbed-os/v5.11/apis/dataflash-block-device.html
it also mentions that there a page erases of 512b, it should really state as low as 256b

Though I can't go through every revision of every device, I'm pretty confident that any AT45 will be fine, small page erases are the main reason to choose DataFlash !

@adbridge
Copy link
Contributor

adbridge commented May 7, 2019

CI started

@mbed-ci
Copy link

mbed-ci commented May 7, 2019

Test run: FAILED

Summary: 2 of 11 test jobs failed
Build number : 1
Build artifacts

Failed test jobs:

  • jenkins-ci/mbed-os-ci_dynamic-memory-usage
  • jenkins-ci/mbed-os-ci_greentea-test

@chrissnow
Copy link
Contributor Author

Are those CI issues related to this PR?

@0xc0170
Copy link
Contributor

0xc0170 commented May 12, 2019

Are those CI issues related to this PR?

I don't think so. CI job restarted

@0xc0170
Copy link
Contributor

0xc0170 commented May 15, 2019

@chrissnow can you rebase this PR? I am seeing unrelated error in the dynamic memory usage (new to me), I would restart testing

@chrissnow chrissnow force-pushed the Dataflash-Erase_Size branch 2 times, most recently from aa93f0f to b09c007 Compare May 15, 2019 22:20
@chrissnow chrissnow force-pushed the Dataflash-Erase_Size branch from b09c007 to 157debf Compare May 15, 2019 22:24
@chrissnow
Copy link
Contributor Author

@0xc0170 rebased, made a bit of a mess with git but should be ok now.

@adbridge
Copy link
Contributor

CI restarted

@0xc0170
Copy link
Contributor

0xc0170 commented May 20, 2019

Internal CI fault, restarted

@0xc0170
Copy link
Contributor

0xc0170 commented May 21, 2019

It again failed to checkout the branch, I restarted

@mbed-ci
Copy link

mbed-ci commented May 21, 2019

Test run: SUCCESS

Summary: 11 of 11 test jobs passed
Build number : 5
Build artifacts

@0xc0170 0xc0170 removed the needs: CI label May 21, 2019
@0xc0170
Copy link
Contributor

0xc0170 commented May 21, 2019

@chrissnow Can you add release notes for this functionality change? (section in your first comment here).

@chrissnow
Copy link
Contributor Author

@0xc0170 Release notes added, Is this roughly the sort of thing you were after?

@0xc0170
Copy link
Contributor

0xc0170 commented May 21, 2019

Thanks , yes

@0xc0170 0xc0170 merged commit 0560ecc into ARMmbed:master May 21, 2019
@chrissnow chrissnow deleted the Dataflash-Erase_Size branch May 21, 2019 14:11
@chrissnow chrissnow restored the Dataflash-Erase_Size branch May 21, 2019 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants