普中开源电子分享网

 找回密码
 立即注册
搜索
查看: 171|回复: 1

普中玄武F103开发板用openocd无法下载程序到flash

[复制链接]

1

主题

2

帖子

15

积分

新手上路

Rank: 1

积分
15
发表于 2024-4-15 18:20:54 | 显示全部楼层 |阅读模式
普中玄武F103开发板,采用随开发板官方自带的下载器。
用keil软件时魔法棒的debug选项卡中reset选择的是SYSRESETREQ,能够正常下载程序到flash。
但是切换成openocd可以连接,但是用program命名下载程序时报错,信息大致是 halt 超时。
在cfg文件中试着将reset_config设置成 none,或srst_only,或srst_nogate,或其他,总之所有子命令都尝试了一遍,还是出错。
同时也设置了 cortex_m reset_config sysresetreq,也都没有用。
请问高手还问题该如何解决?谢谢!
回复

使用道具 举报

1

主题

2

帖子

15

积分

新手上路

Rank: 1

积分
15
 楼主| 发表于 2024-4-15 20:44:41 | 显示全部楼层
添加问题的附加描述:

keil软件中的设置没有特别之处,就是debug settings中的Reset采用了 SYSRESETREQ。
keil软件是能够正确下载程序到flash中的。

但采用openocd时,虽然能够成功连接上芯片
然后打开telnet连接上openocd架设的telnet服务器,分别直接执行halt和resume命令都是可以的。

然而一旦执行了 reset halt命令,则会出现错误信息:
> reset halt
timed out while waiting for target halted
TARGET: stm32f1x.cpu - Not halted
Halt timed out, wake up GDB.


此时,程序已经运行不正常,且无法停止。

用program命令下载程序到flash也失败:
> program project.hex
timed out while waiting for target halted
embedded:startup.tcl:1467: Error: ** Unable to reset target **
in procedure 'program'
in procedure 'program_error' called at file "embedded:startup.tcl", line 1504
at file "embedded:startup.tcl", line 1467
Halt timed out, wake up GDB.


openocd 装载的cfg文件中与reset相关的命令为:
reset_config srst_only
cortex_m reset_config sysresetreq


与reset_config 相关的子命令
reset_config [none|trst_only|srst_only|trst_and_srst]
          [srst_pulls_trst|trst_pulls_srst|combined|separate]
          [srst_gates_jtag|srst_nogate] [trst_push_pull|trst_open_drain]
          [srst_push_pull|srst_open_drain]
          [connect_deassert_srst|connect_assert_srst]

等等都尝试过,结果都不正确!都会出现上述 timed out while waiting for target halted 的出错信息。

所以,想问问各位大神,该问题如何解决?

或者说,keil软件中的Reset 设置为 SYSRESETREQ,对应于openocd的命令应该是啥?


回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

站长推荐上一条 /1 下一条

Archiver|手机版|小黑屋|普中开源电子分享网 粤ICP备16123577号-2

GMT+8, 2024-4-30 22:28 , Processed in 0.087542 second(s), 30 queries .

Powered by 论坛搭建 X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表