From: OpenOCD-Gerrit <ope...@us...> - 2021-09-18 18:15:41
|
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 a1903f2867037ada39ab814658e1034eb96d1827 (commit) from 050fcb176071cadc7142c4d9acd3f5a9e67d3ac6 (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 a1903f2867037ada39ab814658e1034eb96d1827 Author: Tarek BOCHKATI <tar...@gm...> Date: Thu Sep 2 12:03:59 2021 +0100 flash/stm32l4x: fix dual bank support for STM32L552xC devices For STM32L552xC devices with 256K flash: dual bank mode is activated if DB256 is set page size is 2KB if DBANK is set For parts with 512K (aka STM32L5x2xE): DBANK controls both of dual/single bank mode and page size as well. Change-Id: I8be668d5552fefe81acffaf2e3e35ef5e938162e Signed-off-by: Tarek BOCHKATI <tar...@gm...> Reported-by: Patrik Bachan <di...@us...> Fixes: https://sourceforge.net/p/openocd/tickets/317/ Reviewed-on: https://review.openocd.org/c/openocd/+/6538 Tested-by: jenkins Reviewed-by: Oleksij Rempel <li...@re...> diff --git a/src/flash/nor/stm32l4x.c b/src/flash/nor/stm32l4x.c index 0182aae66..8c292e76d 100644 --- a/src/flash/nor/stm32l4x.c +++ b/src/flash/nor/stm32l4x.c @@ -1923,15 +1923,17 @@ static int stm32l4_probe(struct flash_bank *bank) /* STM32L55/L56xx can be single/dual bank: * if size = 512K check DBANK bit * if size = 256K check DB256K bit + * + * default page size is 4kb, if DBANK = 1, the page size is 2kb. */ - page_size_kb = 4; + + page_size_kb = (stm32l4_info->optr & FLASH_L5_DBANK) ? 2 : 4; num_pages = flash_size_kb / page_size_kb; stm32l4_info->bank1_sectors = num_pages; + if ((is_max_flash_size && (stm32l4_info->optr & FLASH_L5_DBANK)) || (!is_max_flash_size && (stm32l4_info->optr & FLASH_L5_DB256))) { stm32l4_info->dual_bank_mode = true; - page_size_kb = 2; - num_pages = flash_size_kb / page_size_kb; stm32l4_info->bank1_sectors = num_pages / 2; } break; ----------------------------------------------------------------------- Summary of changes: src/flash/nor/stm32l4x.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) hooks/post-receive -- Main OpenOCD repository |