From: OpenOCD-Gerrit <ope...@us...> - 2021-06-27 13:58:04
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 94ba5219ede27d6193ebac15af0468de60c9bfca (commit) from 0478a93ed52fd8ddc0f68434cb2f05f22cbcad70 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 94ba5219ede27d6193ebac15af0468de60c9bfca Author: Marc Schink <de...@za...> Date: Mon Jun 21 16:18:38 2021 +0200 flash/nor/stm32l4: Fix stm32l4_probe() The current implementation fails due to the assert() statements in get_stm32l4_rev_str() and get_stm32l4_bank_type_str(). Rearrange the code in order to fix the problem. Change-Id: If19c648dec8ddd3ef2fb801150114104b34c3bf2 Signed-off-by: Marc Schink <de...@za...> Fixes: 64c2e03b23 ("flash/nor: improved API of flash_driver.info & fixed buffer overruns") Reviewed-on: http://openocd.zylin.com/6326 Tested-by: jenkins Reviewed-by: Jan Matyas <ma...@co...> Reviewed-by: Tarek BOCHKATI <tar...@gm...> Reviewed-by: Antonio Borneo <bor...@gm...> diff --git a/src/flash/nor/stm32l4x.c b/src/flash/nor/stm32l4x.c index cd6229548..9598345c6 100644 --- a/src/flash/nor/stm32l4x.c +++ b/src/flash/nor/stm32l4x.c @@ -1350,7 +1350,6 @@ static const char *get_stm32l4_bank_type_str(struct flash_bank *bank) { struct stm32l4_flash_bank *stm32l4_info = bank->driver_priv; assert(stm32l4_info->part_info); - assert(stm32l4_info->probed); return stm32l4_is_otp(bank) ? "OTP" : stm32l4_info->dual_bank_mode ? "Flash dual" : "Flash single"; @@ -1372,8 +1371,6 @@ static int stm32l4_probe(struct flash_bank *bank) return retval; const uint32_t device_id = stm32l4_info->idcode & 0xFFF; - const uint16_t rev_id = stm32l4_info->idcode >> 16; - const char *rev_str = get_stm32l4_rev_str(bank); for (unsigned int n = 0; n < ARRAY_SIZE(stm32l4_parts); n++) { if (device_id == stm32l4_parts[n].id) { @@ -1388,12 +1385,15 @@ static int stm32l4_probe(struct flash_bank *bank) } part_info = stm32l4_info->part_info; - stm32l4_info->flash_regs = stm32l4_info->part_info->default_flash_regs; + const char *rev_str = get_stm32l4_rev_str(bank); + const uint16_t rev_id = stm32l4_info->idcode >> 16; LOG_INFO("device idcode = 0x%08" PRIx32 " (%s - Rev %s : 0x%04x - %s-bank)", stm32l4_info->idcode, part_info->device_str, rev_str, rev_id, get_stm32l4_bank_type_str(bank)); + stm32l4_info->flash_regs = stm32l4_info->part_info->default_flash_regs; + /* read flash option register */ retval = stm32l4_read_flash_reg_by_index(bank, STM32_FLASH_OPTR_INDEX, &options); if (retval != ERROR_OK) ----------------------------------------------------------------------- Summary of changes: src/flash/nor/stm32l4x.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) hooks/post-receive -- Main OpenOCD repository |