From 20ca4f4bee16d7571356dada3d56bd1025003a8c Mon Sep 17 00:00:00 2001 From: Marc Schink Date: Sun, 13 Jul 2025 19:56:45 +0000 Subject: [PATCH] flash/nor/stm32l4x: Change 'option_read' output Remove the verbose command output to enable processing with Tcl. Change-Id: I97c2ffbd7bbbb3064a98f8977373f6c48272e71e Signed-off-by: Marc Schink Reviewed-on: https://review.openocd.org/c/openocd/+/9000 Tested-by: jenkins Reviewed-by: Antonio Borneo --- doc/openocd.texi | 6 ++---- src/flash/nor/stm32l4x.c | 7 +++---- 2 files changed, 5 insertions(+), 8 deletions(-) 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)