openocd/src
Simon Johansson 29912328f0 flash/nor/stm32f2x: Fix erase of bank 2 sectors
This commit corrects the erase function for stm32f2x when dealing with
sectors in bank 2, for STM32F42x/43x devices with 1MB flash.

On STM32F42x/43x with 1MB flash in dual bank configuration, the sector
numbering is not consecutive. The last sector in bank 1 is number 7, and
the first sector in bank 2 is number 12.
The sector indices used by openocd, however, _are_ consecutive (0 to 15
in this case). The arguments "first" and "last" to stm32x_erase() are of
this type, and so the logic surrounding sector numbers needed to be
corrected.
Since the two banks in dual bank mode have the same number of sectors, a
sector index in bank 2 is larger than or equal to half the total number
of sectors.

Change-Id: I15260f8a86d9002769a1ae1c40ebdf62142dae18
Signed-off-by: Simon Johansson <ampleyfly@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6810
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
2022-02-25 10:58:41 +00:00
..
flash flash/nor/stm32f2x: Fix erase of bank 2 sectors 2022-02-25 10:58:41 +00:00
helper helper/list: add list_for_each_entry_direction() 2022-02-14 15:10:41 +00:00
jtag Cadence virtual debug interface (vdebug) integration 2022-02-14 15:12:10 +00:00
pld openocd: use single line for register_commands*() 2021-11-23 11:03:38 +00:00
rtos rtos: threadx: Add hla_target support for ThreadX 2022-02-14 20:25:20 +00:00
rtt openocd: fix doxygen parameters of functions 2021-01-13 11:33:53 +00:00
server server: remove remaining crust from dropped eCos code 2022-02-14 15:13:34 +00:00
svf openocd: fix Yoda conditions with checkpatch 2021-07-24 10:38:31 +01:00
target Fix small memory leak. 2022-02-14 15:13:11 +00:00
transport openocd: remove NULL comparisons with checkpatch [1/2] 2021-07-24 10:38:00 +01:00
xsvf openocd: fix simple cases of NULL comparison 2021-07-24 10:37:49 +01:00
hello.c openocd: fix simple cases of Yoda condition 2021-07-20 14:55:24 +01:00
hello.h Make #include guard naming consistent 2016-05-24 22:30:55 +01:00
main.c Cleanup of config/includes. 2021-05-01 14:35:09 +01:00
Makefile.am build: Fix out-of-tree with --disable-dependency-tracking configure flag 2021-04-05 23:24:14 +01:00
openocd.c log: fix memory leak when log to file is enabled 2022-01-22 10:15:48 +00:00
openocd.h Make #include guard naming consistent 2016-05-24 22:30:55 +01:00