cancel
Showing results for 
Search instead for 
Did you mean: 

Openocd not working with STM32F750

KMaen
Associate III

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!

1 ACCEPTED SOLUTION

Accepted Solutions
Andreas Bolsch
Lead II

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.

View solution in original post

1 REPLY 1
Andreas Bolsch
Lead II

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.