-
Notifications
You must be signed in to change notification settings - Fork 3k
flash: add note about program size #5000
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
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.
LGTM
One question was raised though: is there a risk to actually degrade performance by defining the page size to 1 if the application tries to program page by page ?
I would say yes. @LMESTM there is a PR from you that is setting it to a small number, you can test it by flashing big chunk of data (or do you have datasheets that would have timings for different page sizes) ? |
@0xc0170 my point is about how people do interpret and use get_page_size as of now in mbed programs. |
2d8a4fc
to
038b30e
Compare
I rebased, the minimum was not correct, as it invokes a question - what is then maximum. The page size defines a writeable page size - this is the number of bytes that flash controller supports. It could state the optimum writable chunk (in your case it would be set to optimum size).
FlashIAP is protected with mutex, thus only one program page at the time. |
Any review for this small change? @LMESTM Does it add a value as requested? |
Looking a bit further, maybe it is possible to add a note like: And I think the flash_program_page needs some update as well.
But looking at the code FlashIAP.cpp that calls to flash_program_page, it says
So I guess that flash_program_page (should be flash_program_pages ?) must actually program a entire number of pages (within a sector). not One |
should we say minimum programmable size? There is no API that queries the capabilities of the underlying implementation. So i think this api should tell the user what they can do, not what they should do. |
Program size - the writable page size that flash controller supports. Plus fix program page description - multiple pages program
038b30e
to
3f58d3e
Compare
I fixed program_page HAL as suggested above by @LMESTM |
Looks ok with this comment. And now that I better understand the API, maybe "minimum" could even be used, as the "maximum" size is known: this is the number of bytes until next sector boundary:
|
/morph test |
Result: SUCCESSYour command has finished executing! Here's what you wrote!
OutputAll builds and test passed! |
This unit is the minimum writable size that flash controller supports.
Raised here #4966
@LMESTM @LiyouZhou @c1728p9