This is an automated email from Gerrit. "zapb <d...@zapb.de>" just uploaded a new patch set to Gerrit, which you can find at https://review.openocd.org/c/openocd/+/7535
-- gerrit commit 3314290b00f18bde355bc5f125924458bb9318ac Author: Marc Schink <d...@zapb.de> Date: Mon Nov 21 13:02:54 2022 +0100 flash/nor/stm32lx: Add 'option_load' command Change-Id: I9e3e055ec7763cefb3f005d95a0821be4d2dd6b4 Signed-off-by: Marc Schink <d...@zapb.de> diff --git a/src/flash/nor/stm32lx.c b/src/flash/nor/stm32lx.c index 1459e942d1..d36d2dc2ef 100644 --- a/src/flash/nor/stm32lx.c +++ b/src/flash/nor/stm32lx.c @@ -93,6 +93,7 @@ static int stm32lx_wait_until_bsy_clear(struct flash_bank *bank); static int stm32lx_lock(struct flash_bank *bank); static int stm32lx_unlock(struct flash_bank *bank); static int stm32lx_mass_erase(struct flash_bank *bank); +static int stm32lx_obl_launch(struct flash_bank *bank); static int stm32lx_wait_until_bsy_clear_timeout(struct flash_bank *bank, int timeout); static int stm32lx_update_part_info(struct flash_bank *bank, uint16_t flash_size_in_kb); @@ -354,6 +355,27 @@ COMMAND_HANDLER(stm32lx_handle_unlock_command) return retval; } +COMMAND_HANDLER(stm32lx_handle_option_load_command) +{ + if (CMD_ARGC != 1) + return ERROR_COMMAND_SYNTAX_ERROR; + + struct flash_bank *bank; + int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank); + if (retval != ERROR_OK) + return retval; + + retval = stm32lx_obl_launch(bank); + if (retval != ERROR_OK) { + command_print(CMD, "stm32lx option load failed"); + return retval; + } + + command_print(CMD, "stm32lx option load completed"); + + return ERROR_OK; +} + static int stm32lx_protect_check(struct flash_bank *bank) { int retval; @@ -921,6 +943,13 @@ static const struct command_registration stm32lx_exec_command_handlers[] = { .usage = "bank_id", .help = "Lower the readout protection from Level 1 to 0.", }, + { + .name = "option_load", + .handler = stm32lx_handle_option_load_command, + .mode = COMMAND_EXEC, + .usage = "bank_id", + .help = "Force re-load of device options (will cause device reset).", + }, COMMAND_REGISTRATION_DONE }; --