April 25, 2025

STM32F746 Discovery Kit - downloading the Demo firmware

I want to download and save an image of the firmware that shipped in the board. Not that it is particularly useful (the source code might be), but I just hate burning bridges and I am eager to load my own software into the board.

Use my F429 setup

This doesn't work (for obvious reasons).
openocd -f /usr/share/openocd/scripts/interface/stlink.cfg -f /usr/share/openocd/scripts/target/stm32f4x.cfg
Open On-Chip Debugger 0.12.0
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : clock speed 2000 kHz
Info : STLINK V2J25M14 (API v2) VID:PID 0483:374B
Info : Target voltage: 3.217860
Warn : UNEXPECTED idcode: 0x5ba02477
Error: expected 1 of 1: 0x2ba01477
The reason is clear, I am using a F4x config file. We can fix this with a one digit change.

Use the right config file and poke around

openocd -f /usr/share/openocd/scripts/interface/stlink.cfg -f /usr/share/openocd/scripts/target/stm32f7x.cfg
Info : STLINK V2J25M14 (API v2) VID:PID 0483:374B
Info : Target voltage: 3.216284
Info : [stm32f7x.cpu] Cortex-M7 r0p1 processor detected
Warn : [stm32f7x.cpu] Silicon bug: single stepping may enter pending exception handler!
Info : [stm32f7x.cpu] target has 8 breakpoints, 4 watchpoints
Info : accepting 'telnet' connection on tcp/4444
Then in another window:
telnet localhost 4444
halt
[stm32f7x.cpu] halted due to debug-request, current mode: Thread
xPSR: 0x81000000 pc: 0x08039828 psp: 0x20007658
dump_image demo.bin 0 0x100000
This does not work. I get no error, but the prompt comes back immediately. I take a hint from the PC displayed when I halt and do this:
dump_image demo.bin 0x08000000 0x100000
dumped 1048576 bytes in 10.409899s (98.368 KiB/s)
A look at the address map in the F746 TRM is clearly in order. However the F429 TRM shows flash at 0x08000000 just like this. It can be aliased to 0x0 depending on boot jumpers

Note that the stack pointer is consistent with ram at 0x20000000.

Thus all of this is just like the F429 and other F4xx processors, which is nice.


Feedback? Questions? Drop me a line!

Tom's Computer Info / tom@mmto.org