/**

******************************************************************************
* @author    Maoxiao Hu
* @version   V1.0.0
* @date       Dec-2014
******************************************************************************
* < COPYRIGHT 2014 ISE of SHANDONG UNIVERSITY >
******************************************************************************
**/
 
当我们使用jLink调试Cortex-A9及以下核心的时候,往往会使用eclipse CDT+GDB插件+GDB Server的形式调试程序。
下面罗列一下jLink支持的GDB命令,来源于Segger公司的UM08001_JLink.pdf,在这里精简,以供备忘。
不再支持的指令:

Note1: The remote commands are case-insensitive.

Note2: Optional parameters are set into square brackets.

Note3: The examples are described as follows:

Note4: Lines starting with ’#’ are comments and not used in GDB / GDB Server.

Note5: Lines starting with ’>’ are input commands from the GDB.

Note6: Lines starting with ’<’ is the output from GDB Server as printed in GDB.

3.3.3.1 clrbp

Syntax

ClrBP [<BPHandle>]

or

ci [<BPHandle>]

Description

Removes an instruction breakpoint, where <BPHandle> is the handle of breakpoint to be removed. If no handle is specified this command removes all pending breakpoints.

Example

> monitor clrbp 1

or

> monitor ci 1

3.3.3.2 cp15

Syntax

cp15 <CRn>, <CRm>, <op1>, <op2> [= <data>]

Description

Reads or writes from/to cp15 register. If <data> is specified, this command writes the data to the cp15 register. Otherwise this command reads from the cp15 register. For further information please refer to the ARM reference manual.

Example

#Read:

> monitor cp15 1, 2, 6, 7

< Reading CP15 register (1,2,6,7 = 0x0460B77D)

#Write:

> monitor cp15 1, 2, 6, 7 = 0xFFFFFFFF

3.3.3.3 device

Note: Deprecated. Use command line option -device instead.

Syntax

device <DeviceName>

Description

Selects the specified target device. This is necessary for the connection and some special handling of the device.

Note: The device should be selected via commandline option -device when starting GDB Server.

Example

> monitor device STM32F417IG

< Selecting device: STM32F417IG

3.3.3.4 DisableChecks

Syntax

DisableChecks

Description

Disables checking if a memory read caused an abort (ARM7/9 devices only). On some CPUs during the init sequence for enabling access to the internal memory (for exam- ple on the TMS470) some dummy reads of memory are required which will cause an abort as long as the access-init is not completed.

3.3.3.5 EnableChecks

Syntax

EnableChecks

Description

Enables checking if a memory read caused an abort (ARM7/9 devices only). On some CPUs during the init sequence for enabling access to the internal memory (for exam- ple on the TMS470) some dummy reads of memory are required which will cause an abort as long as the access-init is not completed. The default state is: Checks enabled.

 

3.3.3.6 flash breakpoints

Syntax

monitor flash breakpoints = <Value>

Description

This command enables/disables the Flash Breakpoints feature.

By default Flash Breapkoints are enabled and can be used for evaluation.

Example

#Disable Flash Breakpoints:

> monitor flash breakpoints = 0

< Flash breakpoints disabled

#Enable Flash Breakpoins:

> monitor flash breakpoints = 1

< Flash breakpoints enabled

 

3.3.3.7 getargs

Syntax

getargs

Description

Get the currently set argument list which will be given to the application when calling semihosting command SYS_GET_CMDLINE (0x15). The argument list is given as one string.

Example

#No arguments set via setargs:

> monitor getargs

< No arguments.

#Arguments set via setargs:

> monitor getargs

< Arguments: test 0 1 2 arg0=4

 

3.3.3.8 go

Syntax

go

Description

Starts the target CPU.

Example

> monitor go

 

3.3.3.9 halt

Syntax

halt

Description

Halts the target CPU.

Example

> monitor halt

 

3.3.3.10 interface

Note: Deprecated. Use command line option -if instead. Syntax

interface <InterfaceIdentifier>

Description

Selects the target interface used by J-Link / J-Trace.

 

3.3.3.11 jtagconf

Syntax

jtagconf <IRPre> <DRPre>

Description

Configures a JTAG scan chain with multiple devices on it. <IRPre> is the sum of IRLens of all devices closer to TDI, where IRLen is the number of bits in the IR (Instruction Register) of one device. <DRPre> is the number of devices closer to TDI. For more detailed information of how to configure a scan chain with multiple devices please refer to See ìDetermining values for scan chain configurationî on page 145..

Note: To make sure the connection to the device can be established correctly, it is recommended to configure the JTAG scan chain via command line options at start of GDB Server.

Example

#Select the second device, where there is 1 device in front with IRLen 4

> monitor jtagconf 4 1

 

3.3.3.12 memU8

Syntax

MemU8 <address> [= <value>]

Description

Reads or writes a byte from/to a given address. If <value> is specified, this com- mand writes the value to the given address. Otherwise this command reads from the given address.

Example

#Read:

> monitor memU8 0x50000000

< Reading from address 0x50000000 (Data = 0x04)

#Write:

> monitor memU8 0x50000000 = 0xFF

< Writing 0xFF @ address 0x50000000

 

3.3.3.13 memU16

Syntax

memU16 <address> [= <value>]

Description

Reads or writes a halfword from/to a given address. If <value> is specified, this com- mand writes the value to the given address. Otherwise this command reads from the given address.

Example

#Read:

> monitor memU16 0x50000000

< Reading from address 0x50000000 (Data = 0x3004)

#Write:

> monitor memU16 0x50000000 = 0xFF00

< Writing 0xFF00 @ address 0x50000000

 

3.3.3.14 memU32

Syntax

MemU32 <address> [= <value>]

Description

Reads or writes a word from/to a given address. If <value> is specified, this com- mand writes the value to the given address. Otherwise this command reads from the given address. This command is similar to the long command.

Example

#Read:

> monitor memU32 0x50000000

< Reading from address 0x50000000 (Data = 0x10023004)

#Write:

> monitor memU32 0x50000000 = 0x10023004

< Writing 0x10023004 @ address 0x50000000

3.3.3.15 reg

Syntax

reg <RegName> [= <value>]

or

reg <RegName> [= (<address>)]

Description

Reads or writes from/to given register. If <value> is specified, this command writes the value into the given register. If <address> is specified, this command writes the memory content at address <address> to register <RegName>. Otherwise this com- mand reads the given register.

Example

#Write value to register:

> monitor reg pc   = 0x00100230

< Writing register (PC = 0x00100230)

#Write value from address to register:

> monitor reg r0   = (0x00000040)

< Writing register (R0 = 0x14813004)

#Read register value:

> monitor reg PC

< Reading register (PC = 0x00100230)

 

3.3.3.16 regs

Syntax

regs

Description

Reads all CPU registers.

Example

> monitor regs

< PC = 00100230, CPSR = 20000013 (SVC mode, ARM)

R0 = 14813004, R1 = 00000001, R2 = 00000001, R3 = 000003B5

R4 = 00000000, R5 = 00000000, R6 = 00000000, R7 = 00000000

USR: R8 =00000000, R9 =00000000, R10=00000000, R11 =00000000, R12 =00000000

R13=00000000, R14=00000000

FIQ: R8 =00000000, R9 =00000000, R10=00000000, R11 =00000000, R12 =00000000

R13=00200000, R14=00000000, SPSR=00000010

SVC: R13=002004E8, R14=0010025C, SPSR=00000010

ABT: R13=00200100, R14=00000000, SPSR=00000010

IRQ: R13=00200100, R14=00000000, SPSR=00000010

UND: R13=00200100, R14=00000000, SPSR=00000010

 

3.3.3.17 reset

Syntax

reset

Description

Resets and halts the target CPU. Make sure the device is selected prior to using this command to make use of the correct reset strategy.

Add. information

There are different reset strategies for different CPUs. Moreover, the reset strategies which are available differ from CPU core to CPU core. J-Link can perform various reset strategies and always selects the best fitting strategy for the selected device.

Example

> monitor reset

< Resetting target

 

3.3.3.18 semihosting breakOnError

Syntax

semihosting breakOnerror <Value>

Description

Enables or disables halting the target at the semihosting breakpoint / in SVC handler if an error occurred during a semihosting command, for example a bad file handle for SYS_WRITE. The GDB Server log window always shows a warning in these cases. breakOnError is disabled by default.

Example

#Enable breakOnError:

> monitor semihosting breakOnError 1

 

3.3.3.19 semihosting enable

Syntax

semihosting enable [<VectorAddr>]

Description

Enables semihosting with the specified vector address. If no vector address is speci- fied, the SWI vector (at address 0x8) will be used. GDBServer will output semihost- ing terminal data from the target via a separate connection on port 2333. Some IDEs already establish a connection automatically on this port and show terminal data in a specific window in the IDE.

For IDEs which do not support semihosting terminal output directly, the easiest way to view semihosting output is to open a telnet connection to the GDBServer on port 2333. The connection on this port can be opened all the time as soon as GDBServer is started, even before this remote command is executed.

Example

> monitor semihosting enable

< Semihosting enabled (VectorAddr = 0x08)

 

3.3.3.20 semihosting IOClient

Syntax

semihosting IOClient <ClientMask>

Description

GDB itself can handle (file) I/O operations, too. With this command it is selected wheter to print output via TELNET port (2333), GDB, or both.

<ClientMask> is

ï 1 for TELNET Client (Standard port 2333) (Default)

ï 2 for GDB Client

ï or 3 for both (Input via GDB Client)

Example

#Select TELNET port as output source

> monitor semihosting ioclient 1

< Semihosting I/O set to TELNET Client

#Select GDB as output source

> monitor semihosting ioclient 2

< Semihosting I/O set to GDB Client

#Select TELNET port and GDB as output source

> monitor semihosting ioclient 3

< Semihosting I/O set to TELNET and GDB Client

 

3.3.3.21 semihosting ARMSWI

Syntax

semihosting ARMSWI <Value>

Description

Sets the SWI number used for semihosting in ARM mode. The default value for the ARMSWI is 0x123456.

Example

> monitor semihosting ARMSWI 0x123456

< Semihosting ARM SWI number set to 0x123456

 

3.3.3.22 semihosting ThumbSWI

Syntax

semihosting ThumbSWI <Value>

Description

Sets the SWI number used for semihosting in thumb mode. The default value for the ThumbSWI is 0xAB

Example

> monitor semihosting ThumbSWI 0xAB

< Semihosting Thumb SWI number set to 0xAB

 

3.3.3.23 setargs

Syntax

setargs <ArgumentString>

Description

Set arguments for the application, where all arguments are in one <Argument- String> separated by whitespaces.

The argument string can be gotten by the application via semihosting command SYS_GET_CMDLINE (0x15).

Semihosting has to be enabled for getting the argumentstring (semihosting enable). "monitor setargs" can be used before enabeling semihosting.

The maximum length for <ArgumentString> is 512 characters.

Example

> monitor setargs test 0 1 2 arg0=4

< Arguments: test 0 1 2 arg0=4

 

3.3.3.24 setbp

Syntax

setbp <Addr> [<Mask>]

Description

Sets an instruction breakpoint at the given address, where <Mask> can be 0x03 for ARM instruction breakpoints (Instruction width 4 Byte, mask out lower 2 bits) or 0x01 for THUMB instruction breakpoints (Instruction width 2 Byte, mask out lower bit). If no mask is given, an ARM instruction breakpoint will be set.

Example

#Set a breakpoint (implicit for ARM instructions)

> monitor setbp 0x00000000

#Set a breakpoint on a THUMB instruction

> monitor setbp 0x00000100 0x01

 

3.3.3.25 sleep

Syntax

sleep <Delay>

Description

Sleeps for a given time, where <Delay> is the time period in milliseconds to delay. While sleeping any communication is blocked until the command returns after the given period.

Example

> monitor sleep 1000

< Sleep 1000ms

 

3.3.3.26 speed

Note: Deprecated. For setting the initial connection speed, use command line option -speed instead.

Syntax

speed <kHz>|auto|adaptive

Description

Sets the JTAG speed of J-Link / J-Trace. Speed can be either fixed (in kHz), automatic recognition or adaptive. In general, Adaptive is recommended if the target has an RTCK signal which is connected to the corresponding RTCK pin of the device (S-cores only). For detailed information about the different modes, refer to JTAG Speed on page 146.

The speed has to be set after selecting the interface, to change it from its default value.

Example

> monitor speed auto

< Select auto target interface speed (8000 kHz)

> monitor speed 4000

< Target interface speed set to 4000 kHz

> monitor speed adaptive

< Select adaptive clocking instead of fixed JTAG speed

 

3.3.3.27 step

Syntax

step [<NumSteps>]

or

si [<NumSteps>]

Description

Performs one or more single instruction steps, where <NumSteps> is the number of instruction steps to perform. If <NumSteps> is not specified only one instruction step will be performed.

Example

> monitor step 3

注:SWO命令暂不使用,因为我的板子时JTAG接口。

jLink(v8)GDB 命令总结的更多相关文章

  1. 使用eclipse与jLink V8调试exynos 4412 u-boot

    /** ****************************************************************************** * @author    Maox ...

  2. jLink V8调试exynos 4412 u-boot的几点补充

    /** ****************************************************************************** * @author    Maox ...

  3. JLink v8克隆版破解向导

    JLink v8克隆版破解向导 摘要 Jlink 4.5版本之后驱动会识别老的克隆版的JlinkV8,Jlink软件在启动时会提示为克隆版本后退出. 目前主流的破解方式主要有两种: 方法一,继续使用老 ...

  4. Jlink V8固件恢复

    使用附件中的PDF文档步骤即可,但是千万千万记得两点,更新系统很关键,很关键 1.WINXP系统 2.32Bit系统 切记切记,其他的win7,winxp 64就不用试着更新了,全部是坑 大概步骤 J ...

  5. 解决:j-link V8下载器灯不亮,无法正常烧写固件

    昨天j-link V8下载仿真F4正常,下午下载仿真F1后吃了个饭,然后它的灯就不亮了...按照这个例程弄了好几遍都不行,http://www.cr173.com/soft/98542.html,卡在 ...

  6. J-LINK V8固件烧录指导

    1 J-LINK V8固件烧录指导 J-LINK 是使用过程中,如果内部固件意外损坏或丢失,请参考下面操作步骤说明,重新烧录JLINK固件. 1.1 安装固件烧录软件 请ATMEL官方网址下载AT91 ...

  7. IOS开发--常用的基本GDB命令

    gdb不是万能的,可是没有gdb却是万万不能的.这里给大家简单介绍下iOS开发中最基本的gdb命令. po po是print-object的简写,可用来打印所有NSObject对象.使用举例如下: ( ...

  8. JLink V8初始化exynos4412脚本

    /** ****************************************************************************** * @author    Maox ...

  9. JLINK V8 Keil MDK4.10 STM32

    新买的JLINK v8仿真器,第一次使用,编译环境是Keil MDK4.10,目前芯片是STM32F103x. 按照光盘的说明先安装了驱动,USB接上JLINK v8,显示驱动成功.但是在debug或 ...

随机推荐

  1. git 提交远程

    一.从远程克隆项目,修改后提交 1.先切换要放项目的本地目录 C:\Users\chendd>cd E:\web C:\Users\chendd>e: 2.根据服务器的git地址克隆到本地 ...

  2. 使用Jquery+EasyUI进行框架项目开发案例解说之中的一个---员工管理源代码分享

    使用Jquery+EasyUI 进行框架项目开发案例解说之中的一个 员工管理源代码分享 在開始解说之前,我们先来看一下什么是Jquery EasyUI?jQuery EasyUI是一组基于jQuery ...

  3. SAP SOAMANAGER 配置WEBSERVICE 提示:Service cannot be reached解决方法

    TM中有些服务没有被激活,以UI界面个性化设置化设置为例: 如果服务没有被激活,打开界面就会显示: 这时候右键点击属性,获取服务ID: 通过事务代码SICF,输入服务ID:wd_analyze_con ...

  4. cocos2dx-3.2 环境配置

    一.软件 1)VS2012(C++11特性在VS2012以上可以使用) 2)Cocos2d-x官网源码 3)JDK 4)NDK(3.2要用r9d版本,用了android-ndk-r8e报错了) 5)A ...

  5. Java中的DeskTop类

        在Jdk1.6以后新增加了一个类--DeskTop,在JDK中它的解释是这样的: The Desktop class allows a Java application to launch a ...

  6. Android 高级UI设计笔记08:Android开发者常用的7款Android UI组件(转载)

    Android开发是目前最热门的移动开发技术之一,随着开发者的不断努力和Android社区的进步,Android开发技术已经日趋成熟,当然,在Android开源社区中也涌现了很多不错的开源UI项目,它 ...

  7. HUST 1017 Exact cover (Dancing links)

    1017 - Exact cover 时间限制:15秒 内存限制:128兆 自定评测 6110 次提交 3226 次通过 题目描述 There is an N*M matrix with only 0 ...

  8. [改善Java代码]警惕自增的陷阱

    建议7: 警惕自增的陷阱 老师就说:自增有两种形式,分别是i++和++i,i++表示的是先赋值后加1,++i是先加1后赋值,这样理解了很多年也没出现问题,直到遇到如下代码,我才怀疑我的理解是不是错了: ...

  9. asp.net下的b/s架构

    最近一直在做asp.net下的b/s架构的程序.整理一下可以采用的架构. 简单三层架构 基于接口和工厂模式的三层 前台用jquery调用http请求(ashx),ashx再调用逻辑接口 虽然很早就知道 ...

  10. less-3-混合

    混合特性类似于编程语言中的继承.设计好一个样式类,然后再其他样式中直接混合这个样式类,实现样式的继承重用.就像函数一样调用,并且可以传递参数,功能非常强大,实用. less代码: 生成的css代码: ...