This is my openocd.cfg file:
# STM32F429i-Disco # Using stlink as SWD programmer source [find interface/stlink-v2.cfg] # SWD as transport transport select hla_swd # Use STM32F4x target set WORKAREASIZE 0x4000 source [find target/stm32f4x.cfg]
Just connect miniUSB cable to STM32F429i-Disco board and execute:
$ sudo openocd -f openocd.cfg
Now using telnet to connect on openocd server execute:
$ telnet 127.0.0.1 4444 Trying 127.0.0.1... Connected to 127.0.0.1. Escape character is '^]'. Open On-Chip Debugger Previous state query failed, trying to reconnect jtag status contains invalid mode value - communication failure Polling target stm32f4x.cpu failed, GDB will be halted. Polling again in 6300ms > reset halt Previous state query failed, trying to reconnect target state: halted target halted due to debug-request, current mode: Thread xPSR: 0x01000000 pc: 0x0800051c msp: 0x2000439c Polling target stm32f4x.cpu succeeded again, trying to reexamine stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpoints > flash probe 0 device id = 0x10036419 flash size = 2048kbytes flash 'stm32f2x' found at 0x08000000 > flash write_image erase nuttx.bin 0x08000000 auto erase enabled target state: halted target halted due to breakpoint, current mode: Thread xPSR: 0x61000000 pc: 0x20000042 msp: 0x2000439c wrote 65536 bytes from file nuttx.bin in 2.970617s (21.544 KiB/s) > reset run jtag status contains invalid mode value - communication failure Polling target stm32f4x.cpu failed, GDB will be halted. Polling again in 100ms > exit
The serial console is on the pins PA9 (connect to RXD) and PA10 (connect to TXD).
That is all!
Other option:
$ sudo openocd -f interface/stlink-v2.cfg -f target/stm32f4x.cfg -c init -c “reset halt” -c “flash write_image erase nuttx.bin 0x08000000”