[AT32F403/403A] 关于OpenOCD下载的flash driver缺失问题

[复制链接]
 楼主| Sancheese 发表于 2022-5-16 10:45 | 显示全部楼层 |阅读模式
本帖最后由 Sancheese 于 2022-5-18 12:31 编辑

开发环境:Clion + gcc-arm-none-eabi + mingw64 + CMakeLists,下载器为 DAPLink ,其中编译环节已确定没有问题
根据官方应用笔记 《AN0033 应用笔记 Eclipse with GCC》及其附件所述,我使用附件内的 OpenOCD_V2.0.0 ,替代了原先使用的 xpack-openocd-0.11.0-2

我的 AT32F403A.cfg 文件内容如下

  1. #CMSIS DAP-HS
  2. source [find interface/atlink.cfg]
  3. # adapter driver cmsis-dap
  4. #SWD
  5. transport select swd
  6. #MCU
  7. source [find target/at32f4xx.cfg]
  8. #10M
  9. adapter speed 10000
  10. # 不使用复位接口
  11. reset_config none


以下是运行下载脚本时的指令:(为方便阅读,手动换行)

  1. D:\DevelopTools\OpenOCD_V2.0.0\bin\ATLINK.exe
  2. -s D:\DevelopTools\OpenOCD_V2.0.0\share\openocd\scripts
  3. -f D:\Documents\AT32workspace\Template\AT32F403A.cfg
  4. -c "tcl_port disabled" -c "gdb_port disabled" -c "tcl_port disabled"
  5. -c "program "D:/Documents/AT32workspace/Develop/cmake-build-debug/Develop.elf"" -c reset -c shutdown



发现搜索路径默认为 share 目录,因此把原先 OpenOCD_V2.0.0 文件夹根目录的 scripts 文件夹拷贝到 share 中,并进行替换

运行结果如下:

  1. Open On-Chip Debugger 0.10.0+dev-snapshot (2021-04-08-11:26)


更换source为
  1. adapter driver cmsis-dap
仍然是一样的报错


我觉得主要错误应该是最后一条的 flash driver not found

希望得到前辈们的指点



 楼主| Sancheese 发表于 2022-5-16 10:49 | 显示全部楼层
现在的下载方案是 pyocd +  ArteryTek.AT32F403A_407_DFP.2.0.8.pack ,下载甚是繁琐,但验证了编译结果并没有问题
 楼主| Sancheese 发表于 2022-5-19 12:25 | 显示全部楼层
有技术人员支持一下吗
muyichuan2012 发表于 2022-5-19 13:28 | 显示全部楼层
运行程序不要使用ATLINK.exe,用OpenOCD.exe
 楼主| Sancheese 发表于 2022-5-19 14:12 | 显示全部楼层
本帖最后由 Sancheese 于 2022-5-19 14:15 编辑

AT32F403A.cfg 配置文件如下
  1. #CMSIS DAP-HS
  2. source [find interface/atlink.cfg]
  3. # adapter driver cmsis-dap
  4. #SWD
  5. # transport select swd
  6. #MCU
  7. source [find target/at32f4xx.cfg]
  8. #10M
  9. adapter speed 5000
  10. # 不使用复位接口
  11. reset_config none
CLion 实际运行的命令如下
  1. D:\DevelopTools\OpenOCD_V2.0.0\bin\openocd.exe
  2. -s D:\DevelopTools\OpenOCD_V2.0.0\share\openocd\scripts
  3. -f D:\Documents\AT32workspace\Develop\AT32F403A.cfg
  4. -c "tcl_port disabled" -c "gdb_port disabled" -c "tcl_port disabled"
  5. -c "program "D:/Documents/AT32workspace/Develop/cmake-build-debug/Develop.elf""
  6. -c reset -c shutdown

报错如下(仍旧是flash driver 'at32f4x' not found
  1. Open On-Chip Debugger 0.10.0+dev-snapshot (2021-12-17-16:55)
  2. Licensed under GNU GPL v2
  3. For bug reports, read
  4.         http://openocd.org/doc/doxygen/bugs.html
  5. adapter speed: 5000 kHz
  6. Error: flash driver 'at32f4x' not found


 楼主| Sancheese 发表于 2022-5-19 14:13 | 显示全部楼层
muyichuan2012 发表于 2022-5-19 13:28
运行程序不要使用ATLINK.exe,用OpenOCD.exe

版主你好,首先应用手册里用的是 ATLINK.exe 所以我才模仿了一下,修改为 OpenOCD.exe 后仍旧是同样的报错,详细内容请第五楼
tanmingjin 发表于 2022-5-19 14:24 来自手机 | 显示全部楼层
Sancheese 发表于 2022-5-19 14:13
版主你好,首先应用手册里用的是 ATLINK.exe 所以我才模仿了一下,修改为 OpenOCD.exe 后仍旧是同样的报 ...

target/at32f4xx.cfg   这个地方请使用at32f403axx.cfg试一试
 楼主| Sancheese 发表于 2022-5-19 14:35 | 显示全部楼层
tanmingjin 发表于 2022-5-19 14:24
target/at32f4xx.cfg   这个地方请使用at32f403axx.cfg试一试

你好,这次可以了,谢谢你的解决办法,接下来我试一下拷贝对应文件到xpack的Openocd文件夹内,看看可否下载
 楼主| Sancheese 发表于 2022-5-19 15:17 | 显示全部楼层
tanmingjin 发表于 2022-5-19 14:24
target/at32f4xx.cfg   这个地方请使用at32f403axx.cfg试一试

你好,我把cfg文件(所有 OpenOCD_V2.0.0\scripts\board 目录下以 at32 开头的.cfg文件)拷贝到xpack版本的 xpack-openocd-0.11.0-2\scripts\target 文件夹后,使用 xpack-openocd-0.11.0-2\bin\openocd.exe 下载仍旧报错Error: flash driver 'at32f403axx' not found,请问有解决办法吗
tanmingjin 发表于 2022-5-19 15:31 来自手机 | 显示全部楼层
Sancheese 发表于 2022-5-19 15:17
你好,我把cfg文件(所有 OpenOCD_V2.0.0\scripts\board 目录下以 at32 开头的.cfg文件)拷贝到xpack版本的 ...

这样是不行的,openocd.exe你要用2.0.0里面的程序才可以
 楼主| Sancheese 发表于 2022-5-19 15:44 | 显示全部楼层
tanmingjin 发表于 2022-5-19 15:31
这样是不行的,openocd.exe你要用2.0.0里面的程序才可以

好吧,原来是特定版本才能进行下载。希望官方开发后续能针对这个问题解决一下,merge到主流分支上
您需要登录后才可以回帖 登录 | 注册

本版积分规则

1

主题

9

帖子

0

粉丝
快速回复 在线客服 返回列表 返回顶部

1

主题

9

帖子

0

粉丝
快速回复 在线客服 返回列表 返回顶部