How to use the GDB (Gnu Debugger) and OpenOCD for microcontroller debugging – from the terminal?

As I remember it I had some trouble with the straight load command too, so I switched to “flash write_image erase my_project.hex 0 ihex” .. obviously I was using hex files but it looks like elf files should work to, see http://openocd.org/doc/html/Flash-Commands.html … the good thing about this command is it also erases only the flash sections that are being written to which is really handy and you don’t need an erase

Before you run the above command you will need to run “stm32f1x unlock 0” to ensure the chip is unlocked and your allowed to wire to the flash … See The datasheet about this

Also for getting started the command “stm32f1x mass_erase 0” will erase the chip fully and quickly so it’s good to ensure you start in a known state

I know some of these commands say they are for the f1’s but trust me they work for the f4 series to

Btw this file contains most of the command I use to flash my f4 so it might be a good reference https://github.com/othane/mos/blob/master/hal/stm32f373/stm32f373.mk

I Hope that gets you unstuck

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)