-
Notifications
You must be signed in to change notification settings - Fork 3k
Reduce flash page size from 512 to 32 bytes in PSOC6 based boards #9940
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
Conversation
@davidsaada, thank you for your changes. |
@maclobdell could you please notify the relevant people from the cypress team |
What about the number of flash sector erases? This change will reduce the usefull lifetime of flash about 16 times, won't it? |
On the contrary, it will reduce the flash wearing by 16 times. Let me try and explain it using a numerical example: |
You can't change page (row) size, because write API does write of the whole row = 512 bytes. |
This PR doesn't change the physical page size, but the one reflected to the user of this driver. The user will now be able to write pages of 32 bytes, while the driver read the 512 byte physical page, modify the 32 bytes portion in the read data and write the 512 page again. |
OK, I haven't noticed you are now making page size != sector size. |
Each Flash sector has 512 row. The current flash driver implementation does not have APIs to erase whole sector (512 rows) and subsector (8 rows). |
Exactly. Was going to answer your added question above, but you figured it out before that. |
Not sure I understand what you're saying here. Erase API wasn't changed (still erases 512 byte sectors). Only change was in |
|
@hennadiykytsun
Cypress API states, that flash cache should be invalidated with |
Maybe the headline is deceiving, but again - I indeed didn't change the page size, just the program size as reflected to the user. What I do there is indeed read-modify-write, which makes the user think that the page size is 32. |
I don't mind calling |
First, based on the description of Cypress Flash API:
I know think, that original |
Thanks, it's clearer now. So will use this PR to fix current logic. |
1f50a1b
to
81c5e2f
Compare
Added call to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am OK with this update, but Erase row was not done before Program row. It is possible place for bugs.
@ARMmbed/mbed-os-maintainers Travis failures seem unrelated to the PR (tried couple of restarts). |
Page size in all PSOC6 boards is 512 bytes. This is very problematic in all storage applications. This change reduces the page size (in flash_api's flash_program_page API) to 32 by reading the original page, modifying it with programmed data and programming it back. The number 32 for page size conforms to the number of times (16) this action can be done.
81c5e2f
to
9cacd02
Compare
Just pushed a small modification to the program logic, as it could get a size bigger than page size. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check line 53 in flash_api.c
Are you sure? It's a variable declaration (maybe you need to refresh). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Meets PM criteria. Approved.
CI started |
Test run: SUCCESSSummary: 13 of 13 test jobs passed |
Description
Page size in all PSOC6 boards is 512 bytes. This is very problematic in all storage applications. This change reduces the page size (in flash_api's
flash_program_page
API) to 32 by reading the original page, modifying it with programmed data and programming it back. The number 32 for page size conforms to the number of times (16) this action can be done.Tests:
FUTURE_SEQUANA_PSA - FlashIAP driver, all PSA ITS compliance tests.
CY8CKIT_062_BLE (with added FLASHIAP component) - FlashIAP driver, KVStore static tests, NVStore.
Pull request type
Release Notes
Reduce flash page size from 512 to 32 bytes in PSOC6 based boards