openocd安装与调试

openocd安装与调试,第1张

概述环境: 硬件:PC机<------>ARM仿真器v8.00<------>已下载好bit流的Xinlinx SoC开发板(其上有arm cortex-a9核) 软件:Redhat Linux6(或虚拟机) + openocd 使用openocd下载程序,调试arm cortex-a9核。 一、openocd安装 下载libusb库安装或直接yum install libusb* 下载openocd 环境:

硬件:PC<------>ARM仿真器v8.00<------>已下载好bit流的Xinlinx SoC开发板(其上有arm cortex-a9核)

软件:Redhat linux6(或虚拟机) + openocd

使用openocd下载程序,调试arm cortex-a9核。

一、openocd安装 下载libusb库安装或直接yum install libusb* 下载openocd-0.10.0.ziphttps://sourceforge.net/projects/openocd/解压,进入目录 $ ./configure --prefix=/home/benben/openocd --enable-jlink $ make                                    #若编译有错根据提示信息修改 $ sudo make install 二、openocd使用

$ lsusb

能查到仿真器usb信息...

$ openocd -f em8302_jtag.cfg(其中引用了jlink.cfgv7arm.cfg#连接开发板

打印出一些无Error的信息...

$ telnet localhost 4444 #启动守护程序

> resume 0 #0地址开始运行

> halt #暂停cpu

> mDW 0 12 #0地址读12个数32位)

>mww 地址 写的数 #向某地址写数(32位)

>reg #查看寄存器

 

em8302_jtag.cfg内容

# The 8301 Board use jlink to DeBUG

source [find interface/jlink.cfg]

transport select jtag

# THe 8301 Board use a single v7arm chip

source [find target/v7arm.cfg]

 

echo "8302 Board Loaded."

 

# Set reset type and may be changed in some particular cases

reset_config trst_only

#reset_config separate

#reset_config trst_open_drain srst_open_drain

 

adapter_khz 200

 

# Wait after deasserting nTRST before starting new JTAG operations

#jtag_ntrst_delay 200

 

jlink.cfg内容(指定类型为jlink

#

# Segger J-link

#

# http://www.segger.com/jlink.HTML

#

 

interface jlink

 

# The serial number can be used to select a specific interface in case more than one

# is connected to the host.

#

# Segger software omits leading zeros in serial number displays,

# OpenOCD requires them.

#

# Example: Select J-link with serial 123456789

#

# jlink serial 000123456789

 

v7arm.cfg(指定cpu信息)

if { [info exists CHIPname] } {

    set _CHIPname $CHIPname

} else {

    set _CHIPname ecictv7

}

 

# CoreSight DeBUG Access Port

if { [info exists DAP_TAPID] } {

        set _DAP_TAPID $DAP_TAPID

} else {

        set _DAP_TAPID 0x4ba00477

}

 

jtag newtap $_CHIPname dap -irlen 4 -ircapture 0x01 -irmask 0x0f \

        -expected-ID $_DAP_TAPID

 

#

# Cortex A9 target

#

 

# GDB target: Cortex-A9,using DAP,configuring only one core

# Base addresses of cores:

# core 0  -  0x1fffc000

# core 1  -  0x2fffc000

 

set _TARGETname1 $_CHIPname.cpu.0

set _TARGETname2 $_CHIPname.cpu.1

 

# A9 core 0

target create $_TARGETname1 cortex_a -chain-position $_CHIPname.dap \

        -coreID 0 -dbgbase 0x80090000

       # -coreID 0 -dbgbase 0xc0000000

#$_TARGETname1 configure -work-area-phys 0x80000000 -work-area-size 8096

 

$_TARGETname1 configure -event reset-start { adapter_khz 50 }

#$_TARGETname1 configure -event reset-assert-post "cycv_dbginit $_TARGETname1"

$_TARGETname1 configure -event gdb-attach { halt }

 

#smp mode cannot halt only one cpu core,have no IDea,by yzq

# A9 core 1

#target create $_TARGETname2 cortex_a -chain-position $_CHIPname.dap \

#        -coreID 1 -dbgbase 0xc0002000

 

#$_TARGETname2 configure -event reset-start { adapter_khz 1000 }

#$_TARGETname2 configure -event reset-assert-post "cycv_dbginit $_TARGETname2"

#$_TARGETname2 configure -event gdb-attach { halt }

#target smp $_CHIPname.cpu.1 $_CHIPname.cpu.0

 

proc cycv_dbginit {target} {

        # General Cortex A8/A9 deBUG initialisation

        cortex_a dbginit

}

总结

以上是内存溢出为你收集整理的openocd安装与调试全部内容,希望文章能够帮你解决openocd安装与调试所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/yw/1019137.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-23
下一篇 2022-05-23

发表评论

登录后才能评论

评论列表(0条)

保存