Commit 3ddfef0
[zep fromtree] platform: stm: CMSIS_Driver: Fix stale pFlash state
IS_FLASH_SECURE_OPERATION() reads pFlash.ProcedureOnGoing which is only
set inside HAL_FLASH_Program()/HAL_FLASHEx_Erase(), after the unlock
call. On boot pFlash is zero-initialized, so IS_FLASH_SECURE_OPERATION()
always returns true (secure), causing HAL_FLASH_Unlock_SEC() to be
called even for non-secure flash regions. The subsequent HAL erase/write
then uses the NSCR register which is still locked, failing with
HAL_ERROR and triggering an MCUboot swap panic on image index 1.
Replace IS_FLASH_SECURE_OPERATION() with is_range_secure() in the
lock/unlock paths, matching the existing pattern used for write_type
and EraseInit.TypeErase selection in the same functions.
Change-Id: I31ab30bbf4b50212c859d4dbbb7a8c3c62c45fae
Signed-off-by: BUDKE Gerson Fernando <gerson.budke@leica-geosystems.com>
(cherry picked from commit e3ee916)1 parent 3a128df commit 3ddfef0
File tree
1 file changed
+4
-4
lines changed- platform/ext/target/stm/common/hal/CMSIS_Driver
1 file changed
+4
-4
lines changedLines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
569 | 569 | | |
570 | 570 | | |
571 | 571 | | |
572 | | - | |
| 572 | + | |
573 | 573 | | |
574 | 574 | | |
575 | 575 | | |
| |||
603 | 603 | | |
604 | 604 | | |
605 | 605 | | |
606 | | - | |
| 606 | + | |
607 | 607 | | |
608 | 608 | | |
609 | 609 | | |
| |||
711 | 711 | | |
712 | 712 | | |
713 | 713 | | |
714 | | - | |
| 714 | + | |
715 | 715 | | |
716 | 716 | | |
717 | 717 | | |
718 | 718 | | |
719 | 719 | | |
720 | 720 | | |
721 | 721 | | |
722 | | - | |
| 722 | + | |
723 | 723 | | |
724 | 724 | | |
725 | 725 | | |
| |||
0 commit comments