Anda di halaman 1dari 82

TRACE32 Basic Course

About it.
Revision history
Aug.09, 2010 Sangcheol Lee First edition

About it.
This document contains intellectual property and educational information for TRACE32 Basic Course and it only be used in allowed companies. It is not allowed to disclose, transmit or use this document to the third parties without the prior written consent of MDS technology, by any form or means. If you are not the intended reader or company, please notify the MDS technology immediately and do not disclose the contents and destroy all copies of the original message.
3

Contents
Introduction TRACE32 Installation TRACE32 Beginning Debug Image Download Menu & Features Practice Language
4

Introduction

In this chapter,
Understand
Basic concept of Debugger & Emulator Basic principle of JTAG

About Emulator / Debugger JTAG / IEEE1149.1 JTAG Pin Description

Emulator & Debugger


What is the emulator?
Tool or software which emulates operation of core virtually instead of real target CPU CPU emulator, Memory emulator

Emulator & Debugger


CPU Emulator TRACE32 ICE / FIRE
Embedding CPU same as target CPU or higher. Memory emulation, trace and trigger, code coverage, performance feature. Being in high price and difficult to make if target operates over 100Mhz. Not easy to connect all pins between emulator and target.
8

Emulator & Debugger


Debugger based on JTAG TRACE32 ICD
Using JTAG port Easy to make interface by using JTAG port pins Possible to debug without any affection becauswe it doesnt use target resource such as memory or CPU

Emulator & Debugger


ETM PowerTrace
It stands for Embedded Trace Macrocell Instruction & data trace in real-time
Non-intrusive trace in full clock speed.

Code coverage & performance analyzing

10

JTAG / IEEE1149.1
Background
Test Access Port TAP Boundary Scan Cell in CPU

11

JTAG / IEEE1149.1
JTAG features
Use on-chip debug features like on-chip breakpoint. Memory access, logic debice programming like flash memory. Five signal line is used.
nTRST TMS TDI / TDO TCK
12

JTAG / IEEE1149.1
JTAG Architecture
Core logic and JTAG block TAP controller and registers in JTAG block JTAG operation is controlled by TAP Controller Data transferring through TDI and TDO

Internal Core Logic


Bypass Instruction Identification TMS TCK TRST TAP Controller

TDI

TDO

13

JTAG / IEEE1149.1
D2 D1 D0 0 1 0 1 0 1 0 1 0 1 0 1 TDI Bypass Instruction Identification TMS TCK TRST TAP Controller TDO Memory 0 1 0 1 0 1 0 1 0 1 0 1 A2 A1 A0

Internal Core Logic

0 1 0 0

0x7

0x4

ex) static int a;


read out variable a in address 0x4

IEEE 1149.1 Device Architecture 14

JTAG / IEEE1149.1
D2 D1 D0 1 1 1 1 1 A2 A1 A0

Internal Core Logic


Bypass Instruction Identification TMS TCK TRST TAP Controller

1 1 1 1

0x7

0x4

TDI

TDO

Memory

0x7

IEEE 1149.1 Device Architecture 15

JTAG / IEEE1149.1
Daisy-chain

16

JTAG Pin description


ARM processor
VTref nTRST TDI TMS TCK RTCK TDO nSRST EDBGRQ DBGACK

1 3 5 7 9

2 4 6 8 10

NC GND GND GND GND GND GND GND GND GND VCCS nTRST TDI TMS TCK TDO VCCS

1 3 5 7

2 4 6 8

GND GND GND GND GND nRESET GND

TMS TDI VTREF TDO RTCK TCK EMU0

1 3 5 7

2 4 6 8

nTRST GND GND GND GND GND EMU1

11 12 13 14 15 16 17 18 19 20

9 10 11 12 13 14

9 10 11 12 13 14

20 pin connector

14 pin connector

Texas Instruments 14 pin connector


17

TRACE32 Installation

In this chapter,
Understand
Installation TRACE32 Software PowerView How to check problem of TRACE32 How to update firmware of TRACE32 USB module How to check PowerView version
TRACE32 S/W installation TRACE32 H/W connection with target Firmware update and version check

19

S/W installation
Installation guide
TRACE32 installation DVD MDS technology homepage : www.mdstec.com
Registration is needed [] -> [Edu text / Sample] -> Article number 21
This document is based in Korean, But you can understand easily what it mean. Just follow images in that guide.

Article number 28 is English version Installation guide, which included in Dec 2009 version of Installation DVD.

20

S/W installation

21

H/W connection .w target


To prevent TRACE32 H/W damage
1. Connect TRACE32 to PC then powered on 2. Connect TRACE32 with target board 3. Execute TRACE32 PowerView S/W on your PC 4. Target powered on Dis-connection is vice-versa

22

H/W connection .w target


Meaning of LED on TRACE32
POWER
Indicate if power is supplied or not

SELECT
Indicate current status of PowerDebug. It is blinking before executing PowerView. After that, LED is turns on

23

Firmware update and version check


About TRACE32 to version check
Firmware means S/W on USB module Recommand to use newly updated version About a year of S/W expiration date

About 1 year of S/W license expiration date is provided

24

Firmware update and version check


How to update your TRACE32 firmware

TRACE32 Beginning

25

In this chapter,
Understand
Three initialization files of PowerView Meaning of SYStem window
Run a TRACE32 PowerView config.t32 / T32.men / T32.cmm SYStem window Practice
diag 0x3400 Making simple target initialzation cmm script

26

Run a TRACE32 PowerView


Run T32marm.exe
START -> Program -> TRACE32 -> TRACE32 ICD ARM USB OR C:\T32\T32marm.exe

27

Run a TRACE32 PowerView


Three initialization files
config.t32
Define interface between host PC and TRACE32 ICD Using TRACE32 Start recently.

T32.men
PowerView basic menu configuration User menu configuration

T32.cmm
Define extended menu and window configuration of user.

28

SYStem window
Establishing target interface with TRACE32

29

SYStem window
Mode
Down
PowerView cannot detect target status whether physically connection is made or not.

Attach
Basically, drive nTRST to make connection with target. It doesnt drive nSRST signal to maintain target operation.

Up
Drive both nTRST and nSRST to make target interface from earlier stage.
30

SYStem window
JtagClock
Set up TCK frequency which delivering JTAG commands and datas from / to TRACE32
ARM core uses 10.mhz basically but RTCK must be set if ARMxxx-S is used. E.g ARM1176jzf-s, AR926/946ej-s

CONFIG
Must be set if target CPU is Multi-core Specify which core is connected with TRACE32
31

Practice
Check commuication with TAP controller
Not with ARM core. Just testing communication between TRACE32 and JTAG TAP controller
Run TRACE32 PowerView. Make SYStem.Down status. Open AREA window Just typing area in command line Try diag 0x3400 in command line
B:: diag 0x3400

32

Practice
Simple initialization cmm script
Make cmm script, naming as you want.
pedit system.cmm

Setting the options of SYStem window. Grammar is same as contents of SYStem window

33

Firmware update and version check


How to update your TRACE32 firmware

Debug Image Download

34

In this chapter,
Understand
How to download the image file to to target. What is binary, what is ELF format? The meaning of download command Making improved cmm script to download ELF image.
Download File format Binary and ELF Download using TRACE32 Download command Make improved system.cmm file
35

Download
Download is
Copy the image (BIN / HEX / S3 / ELF / EXE ..) files that is compiled and linked in host PC to the target memory.

Source Files Build (*.s , *.c)

Image file (BIN, ELF)

download

HOST PC
36

File format Binary and ELF


Binary format
Pure codes to execute in target. No information such as address, symbol, checksum

Binary Code

Disassembly B 0x49C B 0x180 B 0x198 B 0x1C8 .. .. .. -- -- -37

EA000125 EA00005D EA000062 EA00006D .. .. .. .. .. ..

File format Binary and ELF


ELF format
Executable and Linkable Format Easy to relocate binary part & dynamic loading. Debugging information used by TRACE32 is stored in the symbol part. Header Part

Binary Part

Symbol Part
Logical structure of ELF Format
38

Download using TRACE32


Characteristic
Support various file formats
ELF / COFF / BIN / EXE / S3record ..

Downloading binary / ELF image file is possible even if UART / USB / Ethernet port is not implemented on target. Supporting NOR, NAND, mDOC, OneNAND and so on. Fast download speed
RAM : 2Mbyte/sec Flash : 2Mbyte/min depends on CPU or Flash type
39

Download using TRACE32


B:: Data.LOAD.ELF phone.elf
B::Data.LOAD.Elf phone.elf

ICD
Binary part of phone.elf

Symbol Part of phone.elf TRACE32 SW

ARM 7,9,10
ARM CORE CORE

FLASH FLASH

Sym bol

RAM
Binary

Phone.elf
HOST PC

SRAM
TARGET PHONE
40

Download using TRACE32


Is it possible to download like below?
Target Flash Size : 8Mbyte Image(phone.elf) size : 12Mbyte

?
FLASH
8Mbyte FLASH

ICD

phone.elf
12Mbyte

ARM ARM 7,9,1 CORE 0


TARGET CORE PHONE

RAM
SRAM
41

HOST PC

Download command
Data.LOAD.ELF <filename> [/option] Data.LOAD.Binary <filename> <address> [/option]
Options
Compare
Data is compared with the downloading file, memory is not changed. The load stops when difference is found.

NOCODE
Suppress the code download. Only symbol information is loaded.

NosYmbol
No symbol information is loaded.

NoClear
Preserve existing symbol information. It should be used if several symbol information is needed.
42

Practice
Make improved system.cmm

43

Practice
Meaning of each line
RESet
Reset the interface between TRACE32 and target

SYStem.CPU s3c2410x
Select the CPU of target. If CPU is not listed, select the CORE.

SYStem.JtagClock 10.mhz
Select the clock frequency of TCK signal

SYStem.Up
Reset the system with debug mode enabled and halt the target.

44

Practice
Meaning of each line
Data.LOAD.ELF c:\T32\edu\... /nocode
Select corresponding file formant and download to target.

sYmbol.SPATH + c:\t32\...
Specify the loacation of ther source files In case of the source files are moved to other directory after build, TRACE32 cannot getting and displaying source code in Data.List window. With this command, you could match the source path with downloaded binary. If you still couldnt see anything, it means there are no source filess or wrong path information is given.
45

Practice
Meaning of each line
do c:\t32\window.cmm
cmm script files could call other cmm script file. In this case, window configuration is called.

map.bonchip 0x0--0x3FFFFF
Specify area where only onchip breakpoint is used. For instance, flash device area is used.

SYStem.Option EnReset / ResBreak / WaitReset


Adjust reset signal timing drived by TRACE32

46

TRACE32 Menu Customization

In this chapter,
Understand
Customizing the menu of TRACE32 How to modify and create menu bar or main toolbar Practice how to run system.cmm file by user made menu.
Customizing the GUI Customizing the menu bar Customizing the main toolbar

48

TRACE32 menu
Main menubar Main toolbar

Local buttons

Local popup

49

Customizing the GUI


Use T32.men file Recommend
B::MENU c:\t32\t32.men

Use *.cmm file like t32.cmm


B::MENU.ReProgram
Use this command in *.cmm file and the grammar is same as *.men file

Make new *.men file user can create own *.men file
B::MENU.Program <file>

50

Customizing the GUI


Use T32.men file Recommend Use *.cmm file like t32.cmm

Make new *.men file user can create own *.men file

51

Customizing the Main toolbar


ADD TOOLBAR ( SEPARATOR TOOLITEM "List Hll Source )

DL "Data.ListHll"

ADD TOOLBAR ( SEPARATOR TOOLITEM "List Hll Source" "Data.ListHll" [ <space for toolimage> ] ; (use bitmapedit refer next page) )

52

Customizing the Main toolbar


BITMAPEDIT toolbar.men
Men files name could be anything as you want

Push the save button to save the bitmap to the menu file Define bitmap for the TOOLITEM

choose the color

53

Customizing the Main toolbar


After clicking the save button in front page, you can see the <name>.men file as you see below

B:: Menu.ReProgram <name>.men


54

TRACE32 Features

In this chapter,
Understand
The basic features for debugging Breakpoint and practice how to use it
Data.List window sYmbol.Browse window Data.dump window Register window Var.Watch window Var.Frame window Breakpoint
56

Data.List ( View -> List Source )


Main window for debugging Display address, code, assembly code.
Also C source code, if debug symbol image is downloaded

57

Data.List ( View -> List Source )


Step Over Next Return Up Execute one line of HLL or ASM Execute the function To leave a loop Run till last instruction of function Return to the function that called the current function Go Break Mode Find Main.c Start program execution Stop program execution HLL or MIX mode change Find the string in HLL Open the symbol browser of this source code

58

Data.List ( View -> List Source )


Go Till Here Set PC Here Display Memory Breakpoint... Breakpoint Edit Source View Info To run program till the location of the current cursor. To set PC to the location of the current curser. To open Data.List / View Detailed / Dump window with current address or code as a new address. Dialog box of the breakpoint Breakpoint configuration To edit the source file To see the symbol information of the current source
59

sYmbol.Browse ( View->Symbols )
Displays all loaded symbols User can see the source code and set the breakpoint Content of the sYmbol.Browse
Application (*.elf, *.axf, *.exe..) C source Function & variables

60

Data.dump ( View->Dump )
Find Modify Long E Track Hex / ascii Find the value user want in the memory Modify the value of the memory Support byte, word, long, quad.. formats To see the changes of the memory during the target running. SYStem.CpuAccess.Enable is needed Tracking source location in Data.List window Display the data in two kinds of formats

61

Register ( View->Registers )
Display register value of CPU Possible to modify or set the value Register Up/Down Register Copy Register Swap Register Undo Change register values to the end of prior function. Copy the value of the current register Return to the state of the time that user did Register.Copy Return the value of the register at the last target break.

62

Var.Watch ( View->Watch )
Variable tracking Possible to modify or set the value Replace printf style debugging Variable input window i Watch View

Add the variable to watch window directly Show the symbol browser Add a variable to watch window Display the information of the variable

63

Var.Watch ( View->Watch )
User can change the display format

64

Var.Frame (Var->Stackframe...)
Display the information of the function call stack with nesting structure
Up Down Args Locals Caller Return to the last condition of the prior function Vice versa of Up Display the value of the arguments Show the local variables of the function Show caller instruction / function or not
Local variables of function

Last instruction or function name of caller function

65

Breakpoint
Core providing Breakpoint type
Onchip Breakpoint
Breakpoint set address is stored into ICE breaker register ARM7/9 has two and ARM11 and Cortex has 6 (Average) Everywhere if there is address

Software Breakpoint
Using trap code 0xBEBEBEBE to halt the target Backup original code into inst cache Target halt Original code is restored Trap code inserting

66

Breakpoint
Breakpoint of TRACE32
Program Breakpoint
Set the BP at the program address. Double click in Data.List

Read / Write Breakpoint


Target halt when specific variable of memory is read or written.

Spot Brekapoint
To monitor the value of memory or variable

Alpha / Beta Breakpoint


Set the BP on specific path of function call

67

Breakpoint
Breakpoint set
Toggle as your double clicking on source line

68

Breakpoint
Read / Write Breakpoint
Target halt when specific variable of memory is read or written. Because of its definition, TRACE32 cannot sense the memory / variable access if it is not happened by CPU.

69

Breakpoint
Read / Write Breakpoint

70

Breakpoint
Spot Breakpoint
To see the continuous change of variable / regiater value Need a target halt. Not realtime Program execution is stopped shortly to update the screen. As soon as the screen is updated, target runs again.

71

Breakpoint
Spot Breakpoint

72

Practice Language - CMM script -

In this chapter,
Understand
Definition and role of cmm script How to make a cmm script How to make a debugging sequence simply with cmm
CMM script basic Window storing to cmm Command logging Basic practice commands

74

CMM script basic


Create / edit cmm script
B::pedit file_name.cmm

Execute the cmm script


B::do file_name.cmm
Practice stack display - Program nesting, local / global variable value

Debug cmm script

75

Window storing
SYStem window
B::STOre file_name.cmm system

76

Window storing to cmm


Current window storing
B:: STOre file_name.cmm win

77

Command logging
Command log
To save the commands that user did. B::log.open file_name.cmm
Then debug your target With log.close command, command logging is ended

78

Basic practice commands


Program elements
Commands : all commands used by PowerView
Target control : step, break, go... CMM script flow control : if, while, wait, repeat, goto... I/O commands : print, enter, inkey...

Function
To get the state information of the target like run() r(pc)

Comments
; or //

Label
Append : after nale like LABEL:
79

Basic practice commands


Program elements
Practice variable
Append & in front of the variable, like &variable Default is local if declared as global
B:: &i=100 ; local variable GLOBAL &k ; global variable &k=1 ; value assigning &float=1.4e13 ; float is available &address=address.offset(sunny) print &float print &address ENDDO

&true=(1==1) or &true=(0==0) True boolean expression &true=(1==0) False boolean expression


80

References
Technical support
Http://www.mdstec.com Support->FAQ, Q&A, Download, TRACE32 technical support E-mail: trace32@mdstec.com

website
company: http://www.mdstec.com

manual
Refer Help of TRACE32 PowerView Refer *.pdf files in PDF forder which is created in T32 folder automatically after TRACE32 PowerView installation
81

Q &A
82

Anda mungkin juga menyukai