mtd: refactor mtd struct for better erase support#8411
mtd: refactor mtd struct for better erase support#8411vincent-d wants to merge 10 commits intoRIOT-OS:masterfrom
Conversation
f49aff0 to
b6a4107
Compare
b6a4107 to
dab2ce4
Compare
|
Rebased |
Add a min_erase_size field and sector_size and remove pages_per_sector field. This allow to use a different erase size than the sector size.
7841e27 to
ed80909
Compare
ed80909 to
cdee757
Compare
|
Rebased. Could someone take a look at this one? |
|
@gebart can you review or shall we look for someone new? |
|
@gebart can you review or shall we look for a new reviewer? |
jnohlgard
left a comment
There was a problem hiding this comment.
A useful improvement when using memories which support smaller erase sizes.
The changes to the mtd driver implementations look OK. The FS pkg changes look OK, but it would be good if someone with better knowledge of the fatfs and littlefs drivers would take a look as well.
See inline comment on a possible typo in the tests.
Good to see the test mock driver updated with flash AND behavior 👍
| #ifndef PAGE_PER_SECTOR | ||
| #define PAGE_PER_SECTOR 4 | ||
| #ifndef SECTOR_SIZE | ||
| #define SECTOR_SIZE 128 |
There was a problem hiding this comment.
Is this a typo or was it intentional?
4*64 = 256
There was a problem hiding this comment.
I think it was intentional to reduce the RAM usage and allow testing on more boards. It's been quite some time since I wrote this ;)
There was a problem hiding this comment.
IIRC @vincent-d is right, we reduced that some time ago to allow for testing on more boards ... specifically some smaller nucleo32s, reducing it even further can only help.
|
Maybe also @x3ro can easily help here? |
|
Interesting, I'll see if I can find time to look at this during the next week. |
|
Hmm, I understand the need for |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions. |
|
@vincent-d Could you give this a rebase? I can give this a review one of these days. |
|
Since this PR has been stale for several years, I'll convert it to a draft. Please feel free to remove the draft state if anyone wants to pick this up again. |
Contribution description
As said in #8400, erase in mtd spi nor is not working correctly as on some flash, the erase size might be smaller than the sector size.
Thie PR adds
min_erase_sizeandsector_sizefields in themtd_dev_tto fix that.On spi flashes supporting different erase size, the config can be (for instance a flash with 64KB blocks and 4KB erasable sectors):
sector_size = 65536min_erase_size = 4096Issues/PRs references
This is based on #8399 and #8400