STM32F103C8脚本(STM32F103C8.JLinkScript):
speed 1000
device STM32F103C8
r
h
loadfile ./build/STM32F103C8Tx.hex
qc
STM32F103C8Tx.hex是要烧录的文件,请根据实际情况修改文件名和路径。
Makefile添加:
Flash:
/opt/JLink_v654c/JLinkExe -if SWD -CommanderScript STM32F103C8.JLinkScript
执行 make Flash即可烧录程序
/opt/JLink_v654c/JLinkGDBServer -if SWD -device STM32F103C8
gdb.init脚本:
target remote 127.0.0.1:2331
mon reset halt
load
b main
c
进入gdb调试:
? ? arm-none-eabi-gdb -x gdb.init?out.elf
---------------------------------------------------------------------
flash: $(BUILD_DIR)/$(TARGET).elf
$(OPENOCD) -f /usr/share/openocd/scripts/interface/stlink-v2-1.cfg -f /usr/share/openocd/scripts/target/stm32f4x.cfg -c "program $(BUILD_DIR)/ $(TARGET).elf verify reset exit"
/usr/bin/openocd -f /usr/share/openocd/scripts/interface/stlink-v2-1.cfg -f /usr/share/openocd/scripts/target/stm32f4x.cfg -c "bindto 0.0.0.0"
target remote 127.0.0.1:3333
mon reset halt
load
b main
c
进入gdb调试: ? ? arm-none-eabi-gdb -x gdb.init?out.elf
|