openocd
$ sudo apt-get update $ sudo apt-get install gdb-arm-none-eabi $ sudo openocd -f /usr/local/share/openocd/scripts/interface/stlink-v2.cfg -f /usr/local/share/openocd/scripts/target/stm32f1x.cfg -c "program main.bin halt 0x8000000"
使用arm版本gdb,而非x64/x86版本的gdb
$ arm-none-eabi-gdb main.elf
(gdb) target remote localhost:3333
Remote debugging using localhost:3333
0x00000100 in _start ()
(gdb) monitor reset init
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08000104 msp: 0x20005000