flash/stm32l4x: fix auto-probe when RDP is promoted from 0 to 0.5
Considering this use case: (using STM32 L5 or U5)
1- first probe : TZEN enabled, RDP level 0
flash_regs_base |= STM32L5_REGS_SEC_OFFSET => 0x50022000
2- the user promotes the RDP to level 0.5
3- the second probe, fails to read OPTR using secure flags_regs_base:
used OPTR address is 0x50022040
Step 3 fails because when RDP is level 0.5, we should use Non-Secure
flash registers.
To fix this, always use NS flash regs to read OPTR in probe functions.
Fixes:
80d323c6e82b (flash/stm32l4x: introduce auto-probe when OPTR is changed)
Change-Id: I296aa633972b0c410b927488c999584a07b912d3
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6864
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins