赞
踩
新版STM32CubeIDE不再直接支持DAPLink下载器,而是通过OpenOCD中间组件间接支持第三方下载器,扩展了所支持的调试下载器种类
要使用DAPLink作为下载器,需要选择ST-LINK(OpenOCD)作为探头(如下图),OpenOCD默认配置文件Script File默认为ST-Link,需要手动修改为自定义配置文件 dap.cfg
在使用DAPLink烧录STM32固件后,需要手动对STM32进行硬件复位才能进入运行状态,不然会一直处于死机状态。通过分析STM32CubeIDE发送给OpenOCD的配置文件,并没有发现下载完成后复位的命令
在完成下载后增加复位命令即可实现目的。在自定义配置文件dap.cfg末尾增加如下指令即可。该指令在STM32CubeIDE断开OpenOCD GDB Server后,OpenOCD会自动对STM32进行复位操作,
$_TARGETNAME configure -event gdb-detach {
gdb_detach_hook
reset
}
dap.cfg 配置文件示例如下,不同芯片略微不同。需要修改三处
# This is an genericBoard board with a single STM32F401CCUx chip # # Generated by STM32CubeIDE # Take care that such file, as generated, may be overridden without any early notice. Please have a look to debug launch configuration setup(s) # DAPLink 需要修改下面一行 source [find interface/cmsis-dap.cfg] set WORKAREASIZE 0x8000 # DAPLink 需要修改下面一行 transport select "swd" set CHIPNAME STM32F401CCUx set BOARDNAME genericBoard # Enable debug when in low power modes set ENABLE_LOW_POWER 1 # Stop Watchdog counters when halt set STOP_WATCHDOG 1 # STlink Debug clock frequency set CLOCK_FREQ 4000 # Reset configuration # use hardware reset, connect under reset # connect_assert_srst needed if low power mode application running (WFI...) reset_config srst_only srst_nogate connect_assert_srst set CONNECT_UNDER_RESET 1 set CORE_RESET 0 # ACCESS PORT NUMBER set AP_NUM 0 # GDB PORT set GDB_PORT 3333 # BCTM CPU variables source [find target/stm32f4x.cfg] # 下面代码段实现下载程序后自动复位STM32 $_TARGETNAME configure -event gdb-detach { gdb_detach_hook reset }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。