• 使用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)
    有问题可以留言。
     
     
  • 相关阅读:
    Silverlight实用窍门系列:68.Silverlight的资源字典ResourceDictionary
    在HyperlinkButton的URL地址里附加多个参数(以http get的方式)
    SilverLight CheckBox 控件 DataContext属性与DataContextChanged事件
    关于事件在意料之外触发的问题
    关于Telerik RadGridView 数据列拖动后异常的一种情况
    silverlight使用小计(先做记录后续整理)
    Redis_简介和安装
    Python并行系统工具_multiprocessing模块
    Python并行系统工具_程序退出和进程间通信
    Python并行系统工具_进程分支
  • 原文地址:https://www.cnblogs.com/51mcu/p/3404165.html
Copyright © 2020-2023  润新知