stm32f407-openocd/openocd_flash.cfg

31 lines
944 B
INI
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 加载 OpenOCD 的默认配置,这通常包括用于通信的接口配置
# source [find interface/stlink-v2.cfg] # 假设你使用 ST-Link/V2 作为调试器
# 或者对于其他调试器,如 J-Link
# source [find interface/jlink.cfg]
source [find interface/cmsis-dap.cfg]
# source [find interface/stlink.cfg]
# 加载 STM32F407 的目标配置
source [find target/stm32f4x.cfg]
# 初始化目标
init
# 复位目标
reset halt
# 解锁 Flash
# stm32f4x unlock_flash 0
# 加载固件到 RAM可选通常用于调试
# load_image <your-firmware.elf> 0x8000000
# 烧写固件到 Flash
# 注意:你需要一个二进制文件(.bin或者使用 OpenOCD 的 flash write_image_erase 命令处理 ELF 文件
flash write_image erase build/f407-2.bin 0x08000000
# 验证 Flash
verify_image build/f407-2.bin 0x08000000
# 重置目标并退出 OpenOCD
reset run
shutdown