programming external quad SPI flash with openocd - FrankBau/STM32F746G-disco_Buildroot GitHub Wiki

The goal is to flash binaries using the external flash. An example is the original demonstration code which is available in the STM32F7 firmware pack (STM32Cube\Repository\STM32Cube_FW_F7_V1.12.0\Projects\STM32746G-Discovery\Demonstration\STemWin\Binaries\STM32746G-DISCO_Demo_V1.4.0.hex).

openocd can currently (version 0.10) only flash the internal (on-chip) flash, but there are patches by Andreas Bolsch in http://openocd.zylin.com/#/c/3918/

sudo apt install libtool
sudo apt install autotools-dev
sudo apt install automake
sudo apt install autoconf
sudo apt install autotools-dev
sudo apt install pkg-config
sudo apt install libusb-1.0.0-dev
git clone http://openocd.zylin.com/openocd
cd openocd
git fetch http://openocd.zylin.com/openocd refs/changes/18/3918/16 && git checkout FETCH_HEAD
./bootstrap
./configure --enable-stlink
make
sudo make install

testing

sudo openocd -f board/stm32f746g-disco.cfg  -c "program /home/embedded/Desktop/STM32746G-DISCO_Demo_V1.4.0.hex reset exit"
Open On-Chip Debugger 0.10.0+dev-00208-gc892814f (2018-10-09-21:15)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 2000 kHz
adapter_nsrst_delay: 100
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : clock speed 1800 kHz
Info : STLINK v2 JTAG v32 API v2 SWIM v22 VID 0x0483 PID 0x374B
Info : using stlink api v2
Info : Target voltage: 3.224753
Warn : Silicon bug: single stepping will enter pending exception handler!
Info : stm32f7x.cpu: hardware has 8 breakpoints, 4 watchpoints
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x080979d8 msp: 0x2001cf28
adapter speed: 4000 kHz
** Programming Started **
auto erase enabled
Info : device id = 0x10016449
Info : flash size = 1024kbytes
Info : flash1 'micron n25q128' id = 0x18ba20 size = 16384kbytes
wrote 5701632 bytes from file /home/embedded/Desktop/STM32746G-DISCO_Demo_V1.4.0.hex in 212.953491s (26.147 KiB/s)
** Programming Finished **
** Resetting Target **
shutdown command invoked