diff --git a/doc/openocd.texi b/doc/openocd.texi index bfcdc857e..987339eb7 100644 --- a/doc/openocd.texi +++ b/doc/openocd.texi @@ -8486,10 +8486,8 @@ is the register offset of the Option byte to read. For example to read the FLASH_OPTR register: @example -stm32l4x option_read 0 0x20 -# Option Register (for STM32L4x): <0x40022020> = 0xffeff8aa -# Option Register (for STM32WBx): <0x58004020> = ... -# The correct flash base address will be used automatically +> stm32l4x option_read 0 0x20 +0xffeff8aa @end example The above example will read out the FLASH_OPTR register which contains the RDP diff --git a/src/flash/nor/stm32l4x.c b/src/flash/nor/stm32l4x.c index 0c56ef6d9..4c25875ab 100644 --- a/src/flash/nor/stm32l4x.c +++ b/src/flash/nor/stm32l4x.c @@ -2441,19 +2441,18 @@ COMMAND_HANDLER(stm32l4_handle_option_read_command) if (retval != ERROR_OK) return retval; - uint32_t reg_offset, reg_addr; + uint32_t reg_offset; uint32_t value = 0; COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], reg_offset); - reg_addr = stm32l4_get_flash_reg(bank, reg_offset); retval = stm32l4_read_flash_reg(bank, reg_offset, &value); if (retval != ERROR_OK) return retval; - command_print(CMD, "Option Register: <0x%" PRIx32 "> = 0x%" PRIx32, reg_addr, value); + command_print(CMD, "0x%" PRIx32, value); - return retval; + return ERROR_OK; } COMMAND_HANDLER(stm32l4_handle_option_write_command)