2020-01-17 01:52 PM
I was successfully using openocd with GDB with STM32F746-DISCO. However, my new STM32F750-DISCO does not work.
I use this commands:
openocd -f /usr/share/openocd/scripts/board/stm32f7discovery.cfg
telnet localhost 4444
reset halt
flash write_image erase ../bld/main.bin 0x8000000
which throws the following error:
openocd: src/flash/nor/stm32f2x.c:774: setup_sector: Assertion `i < bank->num_sectors' failed.
I think this is maybe because stm32f750 has smaller flash that stm32f746 (64k vs 1M). However, I have no idea how to fix this. I can successfully program it with st-flash so I don't think it is the problem of the Flash size itself, but some configuration being incompatible.
Thank you!
Solved! Go to Solution.
2020-01-17 02:10 PM
A simple makeshift solution is to edit 'stm32f7x.cfg' : Change
flash bank $_FLASHNAME stm32f2x 0 0 0 0 $_TARGETNAME
into
flash bank $_FLASHNAME stm32f2x 0 0x100000 0 0 $_TARGETNAME
This will override the auto-detection of flash size so that size 1MByte (which is in fact present anyway, but the part beyond 64kByte may be untested or even defective) will be assumed. As long as the image to be downloaded does not exceed the bottom 64kByte, no further impact.
The 'real' fix is
http://openocd.zylin.com/#/c/4926/
but for this you must a rebuild openocd from current source.
2020-01-17 02:10 PM
A simple makeshift solution is to edit 'stm32f7x.cfg' : Change
flash bank $_FLASHNAME stm32f2x 0 0 0 0 $_TARGETNAME
into
flash bank $_FLASHNAME stm32f2x 0 0x100000 0 0 $_TARGETNAME
This will override the auto-detection of flash size so that size 1MByte (which is in fact present anyway, but the part beyond 64kByte may be untested or even defective) will be assumed. As long as the image to be downloaded does not exceed the bottom 64kByte, no further impact.
The 'real' fix is
http://openocd.zylin.com/#/c/4926/
but for this you must a rebuild openocd from current source.