前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >使用OpenOCD

使用OpenOCD

作者头像
iot-me.club
发布2022-02-11 11:16:04
2.3K0
发布2022-02-11 11:16:04
举报
文章被收录于专栏:iot-me

openocd使用介绍

一款调试工具

1.环境

默认已经搭建好了开发环境,使用brew安装好了openocd 各种介绍网上有很多这里就不多说 下面是我的openocd的安装路径/usr/local/Homebrew/share/openocd 一会要用到

2.使用

这部分仅介绍使用,具体更深层次的介绍,可以看以后的介绍

a.连接设备

连接stm32开发板之后使用命令连接openocd -f /usr/local/Homebrew/share/openocd/scripts/interface/stlink-v2-1.cfg -f /usr/local/Homebrew/share/openocd/scripts/target/stm32g0x.cfg 这里第一个参数.cfg是指定连接的工具stlink等等,后面的stm32g0x.cfg是选择的芯片型号;选择对应的型号就可以 运行成功之后的提示信息,注意提示的端口

代码语言:javascript
复制
 ✘ yjhm@yjhmdeMacBook-Pro  /usr/local/Homebrew/share/openocd/scripts/interface   stable  openocd -f /usr/local/Homebrew/share/openocd/scripts/interface/stlink-v2-1.cfg -f /usr/local/Homebrew/share/openocd/scripts/target/stm32g0x.cfg
Open On-Chip Debugger 0.11.0
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
WARNING: interface/stlink-v2-1.cfg is deprecated, please switch to interface/stlink.cfg
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : clock speed 2000 kHz
Info : STLINK V2J37M27 (API v2) VID:PID 0483:374B
Info : Target voltage: 3.240865
Info : stm32g0x.cpu: hardware has 4 breakpoints, 2 watchpoints
Info : starting gdb server for stm32g0x.cpu on 3333
Info : Listening on port 3333 for gdb connections
b.使用telnet连接openocd

在openocd连接成功后会发现这条信息,就可以使用telnet通过4444端口,连接openocd了

Info : Listening on port 4444 for telnet connections

执行telnet指定端口 telnet localhost 4444 连接上之后是这样的,右边是telnet

image.png
image.png
c.常用命令
  1. halt 停止
  2. resume 继续,在halt之后才可以继续执行
  3. reset 复位
  4. init Initializes configured targets and servers. Changes command mode from CONFIG to EXEC. Unless 'noinit' is called, this command is called automatically at the end of startup. (command valid any time) 初始化配置的目标和服务器。 更改命令模式从 CONFIG 到 EXEC。 除非调用“noinit”,否则此命令为在启动结束时自动调用。 (命令随时有效)
  5. ms Returns ever increasing milliseconds. Used to calculate differences in time. (command valid any time)
d.下载

使用这个命令下载 flash write_image erase target.bin 0x08000000 如果使用.bin文件刷,一定要指定flash的地址这里是0x0800 0000,具体可查手册

END

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2021年12月02日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • openocd使用介绍
    • 1.环境
      • 2.使用
        • a.连接设备
        • b.使用telnet连接openocd
        • c.常用命令
        • d.下载
    • END
    领券
    问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档