flash/nor/stm32h7x: remove options cache and some driver enhancements
functions managing option bytes cache (stm32x_read/write_options) have bee removed, and a new functions to modify a single option byte have been introduced (stm32x_write/modify_option). by the way, some helpers have been introduced to access flash registers: - stm32x_read_flash_reg(bank, offset, *value): int - stm32x_write_flash_reg(bank, offset, value): int and a new commands to read and write a single flash option register: - stm32h7x option_read <bank> <option_reg offset> - stm32h7x option_write <bank> <option_reg offset> <value> [mask] also lock and unlock handlers' have been reduced by using the same routine (stm32x_set_rdp) and have been optimized to not write options unless there is a change in RDP level. finally, several functions have been fixed to lock flash / options in case of failure. Change-Id: I75057949ab9f5b4e0f602bafb76f9f80d53a522b Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: http://openocd.zylin.com/5293 Tested-by: jenkins Reviewed-by: Christopher Head <chead@zaber.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
This commit is contained in:
committed by
Tomas Vanek
parent
8d8c6df557
commit
9c196b0b2b
@@ -6769,6 +6769,37 @@ The @var{num} parameter is a value shown by @command{flash banks}.
|
||||
Mass erases the entire stm32h7x device.
|
||||
The @var{num} parameter is a value shown by @command{flash banks}.
|
||||
@end deffn
|
||||
|
||||
@deffn Command {stm32h7x option_read} num reg_offset
|
||||
Reads an option byte register from the stm32h7x device.
|
||||
The @var{num} parameter is a value shown by @command{flash banks}, @var{reg_offset}
|
||||
is the register offset of the option byte to read from the used bank registers' base.
|
||||
For example: in STM32H74x/H75x the bank 1 registers' base is 0x52002000 and 0x52002100 for bank 2.
|
||||
|
||||
Example usage:
|
||||
@example
|
||||
# read OPTSR_CUR
|
||||
stm32h7x option_read 0 0x1c
|
||||
# read WPSN_CUR1R
|
||||
stm32h7x option_read 0 0x38
|
||||
# read WPSN_CUR2R
|
||||
stm32h7x option_read 1 0x38
|
||||
@end example
|
||||
@end deffn
|
||||
|
||||
@deffn Command {stm32h7x option_write} num reg_offset value [reg_mask]
|
||||
Writes an option byte register of the stm32h7x device.
|
||||
The @var{num} parameter is a value shown by @command{flash banks}, @var{reg_offset}
|
||||
is the register offset of the option byte to write from the used bank register base,
|
||||
and @var{reg_mask} is the mask to apply when writing the register (only bits with a '1'
|
||||
will be touched).
|
||||
|
||||
Example usage:
|
||||
@example
|
||||
# swap bank 1 and bank 2 in dual bank devices, by setting SWAP_BANK_OPT bit in OPTSR_PRG
|
||||
stm32h7x option_write 0 0x20 0x8000000 0x8000000
|
||||
@end example
|
||||
@end deffn
|
||||
@end deffn
|
||||
|
||||
@deffn {Flash Driver} stm32lx
|
||||
|
||||
Reference in New Issue
Block a user