博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
下载软件 (二) openocd
阅读量:4285 次
发布时间:2019-05-27

本文共 6286 字,大约阅读时间需要 20 分钟。

  • 简介
openocd 可用来在在linux上运行,做应用,打开相应的调试器对应文件,然后通过调试器控制stm32对应cmsis-dap 来说 不需要驱动,只需要应用openocd调试器对应文件为open("/dev/hidraw1", O_RDWR)            = 3 strace 跟踪的openocd 下载过程 在 log.openocd
  • 安装

sudo apt-get install openocdopenocd --versionOpen On-Chip Debugger 0.9.0 (2018-01-24-01:05)Licensed under GNU GPL v2For bug reports, read        http://openocd.org/doc/doxygen/bugs.html
  • openocd通过cmsis-dap下载hex文件到stm32f407(CS架构)
$sudo openocd -f /usr/share/openocd/scripts/interface/cmsis-dap.cfg -f /usr/share/openocd/scripts/target/stm32f4x.cfg Open On-Chip Debugger 0.9.0 (2018-01-24-01:05)Licensed under GNU GPL v2For bug reports, read        http://openocd.org/doc/doxygen/bugs.htmlInfo : only one transport option; autoselect 'swd'adapter speed: 2000 kHzadapter_nsrst_delay: 100none separatecortex_m reset_config sysresetreqInfo : CMSIS-DAP: SWD  SupportedInfo : CMSIS-DAP: JTAG SupportedInfo : CMSIS-DAP: Interface Initialised (SWD)Info : CMSIS-DAP: FW Version = 2.0.0Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 0 TDO = 1 nTRST = 0 nRESET = 1Info : CMSIS-DAP: Interface readyInfo : clock speed 2000 kHzInfo : SWD IDCODE 0x2ba01477Info : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpoints$ telnet localhost 4444Trying 127.0.0.1...Connected to localhost.Escape character is '^]'.Open On-Chip Debugger> $ sudo openocd -f /usr/share/openocd/scripts/interface/cmsis-dap.cfg -f /usr/share/openocd/scripts/target/stm32f4x.cfg Open On-Chip Debugger 0.9.0 (2018-01-24-01:05)Licensed under GNU GPL v2For bug reports, read        http://openocd.org/doc/doxygen/bugs.htmlInfo : only one transport option; autoselect 'swd'adapter speed: 2000 kHzadapter_nsrst_delay: 100none separatecortex_m reset_config sysresetreqInfo : CMSIS-DAP: SWD  SupportedInfo : CMSIS-DAP: JTAG SupportedInfo : CMSIS-DAP: Interface Initialised (SWD)Info : CMSIS-DAP: FW Version = 2.0.0Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 0 TDO = 1 nTRST = 0 nRESET = 1Info : CMSIS-DAP: Interface readyInfo : clock speed 2000 kHzInfo : SWD IDCODE 0x2ba01477Info : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpointsInfo : accepting 'telnet' connection on tcp/4444$ telnet localhost 4444Trying 127.0.0.1...Connected to localhost.Escape character is '^]'.Open On-Chip Debugger> halttarget state: haltedtarget halted due to debug-request, current mode: Thread xPSR: 0x61000000 pc: 0x08000968 msp: 0x20000528> flash write_image erase /home/pop/stm32/u-boot-2019.10-stm469/u-boot.binauto erase enableddevice id = 0x10076413flash size = 1024kbytesno flash bank found for address 0wrote 0 bytes from file /home/pop/stm32/u-boot-2019.10-stm469/u-boot.bin in 0.009260s (0.000 KiB/s)> flash write_image erase /home/pop/stm32/stm32_template/stm32f407_template/TEST.hexauto erase enabledwrote 16384 bytes from file /home/pop/stm32/stm32_template/stm32f407_template/TEST.hex in 2.756264s (5.805 KiB/s)> reset> $ sudo openocd -f /usr/share/openocd/scripts/interface/cmsis-dap.cfg -f /usr/share/openocd/scripts/target/stm32f4x.cfg Open On-Chip Debugger 0.9.0 (2018-01-24-01:05)Licensed under GNU GPL v2For bug reports, read        http://openocd.org/doc/doxygen/bugs.htmlInfo : only one transport option; autoselect 'swd'adapter speed: 2000 kHzadapter_nsrst_delay: 100none separatecortex_m reset_config sysresetreqInfo : CMSIS-DAP: SWD  SupportedInfo : CMSIS-DAP: JTAG SupportedInfo : CMSIS-DAP: Interface Initialised (SWD)Info : CMSIS-DAP: FW Version = 2.0.0Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 0 TDO = 1 nTRST = 0 nRESET = 1Info : CMSIS-DAP: Interface readyInfo : clock speed 2000 kHzInfo : SWD IDCODE 0x2ba01477Info : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpointsInfo : accepting 'telnet' connection on tcp/4444target state: haltedtarget halted due to debug-request, current mode: Thread xPSR: 0x61000000 pc: 0x08000968 msp: 0x20000528auto erase enabledInfo : device id = 0x10076413Info : flash size = 1024kbytesWarn : no flash bank found for address 0wrote 0 bytes from file /home/pop/stm32/u-boot-2019.10-stm469/u-boot.bin in 0.009260s (0.000 KiB/s)auto erase enabledwrote 16384 bytes from file /home/pop/stm32/stm32_template/stm32f407_template/TEST.hex in 2.756264s (5.805 KiB/s)
  • openocd通过cmsis-dap下载hex文件到stm32f407(非CS架构)
sudo openocd \	-f interface/cmsis-dap.cfg \	-f target/stm32f4x.cfg  \	-c init  \	-c halt \	-c "flash write_image erase /home/pop/stm32/stm32_template/stm32f407_template/TEST.hex" \	-c reset \	-c shutdown-f interface/cmsis-dap.cfg 调试器为cmsis-dap-f target/stm32f4x.cfg 		目标芯片为 stm32f4系列-c init  不可少-c halt  halt住核心-c "flash write_image erase /home/pop/stm32/stm32_template/stm32f407_template/TEST.hex" 下载hex文件到mcu-c reset 让mcu reset-c shutdown 退出openocd // 关闭服务器.----------------------------------log$ sudo openocd -f interface/cmsis-dap.cfg -f target/stm32f4x.cfg  -c init -c halt -c "flash write_image erase /home/pop/stm32/stm32_template/stm32f407_template/TEST.hex" -c reset -c shutdown   Open On-Chip Debugger 0.9.0 (2018-01-24-01:05)Licensed under GNU GPL v2For bug reports, read        http://openocd.org/doc/doxygen/bugs.htmlInfo : only one transport option; autoselect 'swd'adapter speed: 2000 kHzadapter_nsrst_delay: 100none separatecortex_m reset_config sysresetreqInfo : CMSIS-DAP: SWD  SupportedInfo : CMSIS-DAP: JTAG SupportedInfo : CMSIS-DAP: Interface Initialised (SWD)Info : CMSIS-DAP: FW Version = 2.0.0Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 0 TDO = 1 nTRST = 0 nRESET = 1Info : CMSIS-DAP: Interface readyInfo : clock speed 2000 kHzInfo : SWD IDCODE 0x2ba01477Info : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpointstarget state: haltedtarget halted due to debug-request, current mode: Thread xPSR: 0x01000000 pc: 0x08000372 msp: 0x20000530auto erase enabledInfo : device id = 0x10076413Info : flash size = 1024kbyteswrote 16384 bytes from file /home/pop/stm32/stm32_template/stm32f407_template/TEST.hex in 2.814998s (5.684 KiB/s)shutdown command invoked
  • bin文件
sudo openocd -f interface/cmsis-dap.cfg -f target/stm32f4x.cfg  -c init -c halt -c "program /home/pop/stm32f407_in_linux/stm32f407_template/build/target.bin 0x8000000" -c reset -c shutdown// 调整下载速率到10Msudo openocd -f interface/cmsis-dap.cfg -f target/stm32f4x.cfg  -c init -c "adapter_khz 100000" -c halt -c "program ./target.bin 0x8000000" -c reset -c shutdown//wrote 393216 bytes from file ./u-boot.bin in 48.444981s (7.927 KiB/s)

转载地址:http://xrngi.baihongyu.com/

你可能感兴趣的文章
一个js闭包问题的解答
查看>>
Responsive Design常用的媒体查询
查看>>
45个必备的JavaScript Web开发工具
查看>>
CSS3实现酷炫导航
查看>>
编写更好的CSS必备的40个工具
查看>>
设计出色响应式网站的十个技巧
查看>>
文60个有用CSS代码片段
查看>>
trick:CSS 3+checkbox实现JQuery的6个基本动画效果
查看>>
Trick:不用table,怎么等分DIV
查看>>
《机器学习实战》KNN算法实现
查看>>
《机器学习实战》ID3算法实现
查看>>
Linux终端小技巧
查看>>
《机器学习实战》朴素贝叶斯
查看>>
《机器学习实战》Logistic回归
查看>>
协方差和相关系数的概念和含义
查看>>
概率密度函数、概率分布函数、概率质量函数
查看>>
StanFord ML 笔记 第五部分
查看>>
大数定律和中心极限定律
查看>>
StanFord ML 笔记 第六部分&&第七部分
查看>>
StanFord ML 笔记 第八部分
查看>>