zoukankan      html  css  js  c++  java
  • 使用openocd和jlink在ubuntu12.04下下载程序

    简单的总结下首先是openocd是一个开源的上位机平台,这个可以去谷歌上面找到他的资料很多,我一直不知道怎么下载程序,网上的资料很多都是关于2440或者更加高级的ram 平台的,所以看了有点晕晕的。金国自己看openocd user guide 和自己先前在网上找到资料,我大概掌握了stm32 的下载办法。

     
    先是安装openocd 软件,这个在ubuntu的源中就有的,直接可以着软件管理中心找到的。我们可以直接使用软件管理中心安装。接下来我们先将我们的jlink插入电脑,打开终端
    输入一下语句
     openocd -f /usr/share/openocd/scripts/interface/jlink.cfg  -f /usr/share/openocd/scripts/target/stm32f1x.cfg
    这个语句很简单的,就是一个openocd命令加上两个参数,其中-f表示后面接的是我们的配置文件,这里面配置文件的地址根据自己的来,我这里因为使用的是stm32的开发板。所以就这样子搞了。
     如果顺利的话你可以看到如下的信息
    Open On-Chip Debugger 0.5.0 (2011-12-03-08:57)
    Licensed under GNU GPL v2
    For bug reports, read
    http://openocd.berlios.de/doc/doxygen/bugs.html
    Warn : Adapter driver 'jlink' did not declare which transports it allows; assuming legacy JTAG-only
    Info : only one transport option; autoselect 'jtag'
    1000 kHz
    adapter_nsrst_delay: 100
    jtag_ntrst_delay: 100
    cortex_m3 reset_config sysresetreq
    Info : J-Link initialization started / target CPU reset initiated
    Info : J-Link ARM V7 compiled Jun 30 2009 11:05:27
    Info : J-Link caps 0xb9ff7bbf
    Info : J-Link hw version 70000
    Info : J-Link hw type J-Link
    Info : J-Link max mem block 9152
    Info : J-Link configuration
    Info : USB-Address: 0x0
    Info : Kickstart power on JTAG-pin 19: 0x0
    Info : Vref = 3.287 TCK = 1 TDI = 0 TDO = 1 TMS = 0 SRST = 0 TRST = 0
    Info : J-Link JTAG Interface ready
    Info : clock speed 1000 kHz
    Info : JTAG tap: stm32.cpu tap/device found: 0x3ba00477 (mfg: 0x23b, part: 0xba00, ver: 0x3)
    Info : JTAG tap: stm32.bs tap/device found: 0x06414041 (mfg: 0x020, part: 0x6414, ver: 0x0)
    Info : stm32.cpu: hardware has 6 breakpoints, 4 watchpoints
    这样的花说明我们的配置文件是对的,我们已经可以和jilnk和开发板子通讯了。
    接着我们从新打开一个终端,注意原先的不要关闭。
    在新的终端里面输入telnet localhost 4444
    我们可以看到这样的启动信息
    Trying 127.0.0.1...
    Connected to localhost.
    Escape character is '^]'.
    Open On-Chip Debugger
    这样及说明我们已经可以输入命令了
    想要下载程序我们输入如下命令
    先让单片机停止工作
    > halt
    然后我们擦除flash下载
    命令:> flash write_image erase /home/xiaofei/workspace/test/Debug/test.hex
    后面的命令是路径更据自己的文件修改
    下面是加入整个过程顺利的话可以出来的界面
     
    Trying 127.0.0.1...
    Connected to localhost.
    Escape character is '^]'.
    Open On-Chip Debugger
    > halt
    target state: halted
    target halted due to debug-request, current mode: Thread 
    xPSR: 0x21000000 pc: 0x08000176 msp: 0x20000218
    > flash write_image erase /home/xiaofei/workspace/test/Debug/test.hex
    auto erase enabled
    device id = 0x10036414
    flash size = 512kbytes
    wrote 12288 bytes from file /home/xiaofei/workspace/test/Debug/test.hex in 1.331907s (9.010 KiB/s)
    有问题可以留言。
     
     
  • 相关阅读:
    Atitit attilax要工作研究的要素 纪要 方案 趋势 方向 概念 理论
    Atitit 常见每日流程日程日常工作.docx v7 r8f
    Atitit it 互联网 软件牛人的博客列表
    Atitit 信息链(Information Chain)的概念理解 attilax总结
    Atitit 知识点的体系化 框架与方法 如何了解 看待xxx
    Atitit 聚合搜索多个微博 attilax总结
    Atitit 企业知识管理PKM与PIM
    Atitit 项目沟通管理 Atitit 沟通之道 attilax著.docx
    Atitit 项目管理软件 在线服务 attilax总结 1. 项目管理协作的历史 1 1.1. Worktile 406k 1 1.2. Teambition  584k in baidu
    Atitit.每周末总结 于每周一计划日程表 流程表 v8 import 上周遗漏日志补充 检查话费 检查流量情况 Crm问候 Crm表total and 问候
  • 原文地址:https://www.cnblogs.com/51mcu/p/3404165.html
Copyright © 2011-2022 走看看