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)
    有问题可以留言。
     
     
  • 相关阅读:
    mui-popover显示、隐藏弹出菜单的方法
    mui使用总结
    js 原生 document.querySelectorAll document.getElementsByTagName document.querySelector document.getElementById的区别
    mui.min.js:7 Uncaught DOMException: Failed to execute 'send' on 'XMLHttpRequest': Failed to load
    三个div并排
    菜单栏伸缩(附jquery-1.12.1.js)
    验证码生成(点击就更换)
    IDEA算法导包后 import javax.crypto.Cipher; import javax.crypto.KeyGenerator; import javax.crypto.SecretKey;报错
    IDEA加密算法(含所需jar包(commons-codec-1.11.jar ,bcprov-jdk15on-160.jar))
    1,eclipse导入项目jdk版本不一样解决方案 2,java报javax.servlet.jsp cannot be resolved to a type
  • 原文地址:https://www.cnblogs.com/51mcu/p/3404165.html
Copyright © 2011-2022 走看看