[platform] H7 Flash now uses interrupts - #9
Conversation
f48364b to
1f9a569
Compare
sylvesterkaczmarek
left a comment
There was a problem hiding this comment.
There is an off-by-one write here: bank is 1 or 2, while bankStatus has indices 0 and 1. Bank 1 updates the wrong slot and bank 2 writes past the array. This should use bankStatus[bank - 1].
sylvesterkaczmarek
left a comment
There was a problem hiding this comment.
Hi, one API-flow issue I noticed: unlock() used to call Flash::enable(), but that call is removed just as enable() gains the important NVIC_EnableIRQ(FLASH_IRQn) behaviour. Existing callers that only unlock before erase/program will therefore never enable the interrupt and can leave the new async status stuck. Could the IRQ enable stay in the existing initialization path?
1f9a569 to
753a863
Compare
sylvesterkaczmarek
left a comment
There was a problem hiding this comment.
Hi, the new failure state looks unreachable for flash errors that do not also generate EOP. initiateErase/Program() only enables EOPIE, while H7 exposes separate error interrupt enables such as WRPERRIE, PGSERRIE, STRBERRIE, INCERRIE, and OPERRIE. A failed operation can therefore leave bankStatus stuck at operationOngoing; could the error interrupts be enabled and handled independently of EOP?
332fec9 to
d2c58f8
Compare
Good catch, should be done in the new revision. |
d2c58f8 to
19b9cd8
Compare
Done. |
Fixed. |
19b9cd8 to
ed3d097
Compare
ed3d097 to
d918a13
Compare
sylvesterkaczmarek
left a comment
There was a problem hiding this comment.
Rechecked the current head. Two compile blockers remain in the new helpers: initErase(uint32_t volatile& CR) references index although it has no index parameter, and initiateProgram() uses sizeof(uin32_t). Please fix both before merge.
d918a13 to
4c36dd8
Compare
sylvesterkaczmarek
left a comment
There was a problem hiding this comment.
The two compile blockers from my previous review are fixed. One correctness issue remains in the new program bounds check: using addr + FlashWord * sizeof(uint32_t) >= OriginAddr + Size rejects the final valid flash word, whose end is exactly OriginAddr + Size. Please use > (or an equivalent subtraction-based check) so the last flash word remains writable.
4c36dd8 to
f66af53
Compare
Fixed! |
sylvesterkaczmarek
left a comment
There was a problem hiding this comment.
Rechecked current f66af534. The final flash word is now accepted by the bounds check, and the earlier compile, bank-index and error-interrupt issues from my reviews are addressed. No remaining blocker from me.
No description provided.