40
This material exempt per Department of Commerce license exception TSU Debugging

This material exempt per Department of Commerce license exception TSU Debugging

Embed Size (px)

Citation preview

Page 1: This material exempt per Department of Commerce license exception TSU Debugging

This material exempt per Department of Commerce license exception TSU

Debugging

Page 2: This material exempt per Department of Commerce license exception TSU Debugging

Debugging 2

Objectives

After completing this module, you will be able to:• Understand the basic concepts of the Eclipse IDE • List Xilinx Software Development Kit (SDK) features• Describe GNU Debugger (GDB) functionality• Describe Xilinx Microprocessor Debugger (XMD) functionality• Describe the integration of XMD and GDB with SDK

Page 3: This material exempt per Department of Commerce license exception TSU Debugging

Debugging 3

Outline

• Software Development Kit• Debugging Tools• Debugging Using XPS • Debugging Using SDK

Page 4: This material exempt per Department of Commerce license exception TSU Debugging

Debugging 4

• Java-based application development environment• Based on the open-source effort by the Eclipse Consortium\• Feature-rich C/C++ code editor and compilation environment• Project management• Application build configuration and automatic Makefile generation• Error Navigation• Well-integrated environment for seamless debugging of embedded

targets• Source code version control

Xilinx Platform Studio Software Development Kit (SDK)

Page 5: This material exempt per Department of Commerce license exception TSU Debugging

Debugging 5

Xilinx Extensions to Eclipse• SDK leverage on Eclipse + CDT

– Project Management– Makefile builder– Code editor, Error Navigation– Debug – Search

• SDK value add to CDT– Debug integration using XMD– Xilinx Custom Compiler settings for

PowerPC, MicroBlaze– Profiling Flow and Visualization– Productization

Java Virtual Machine

Platform Studio SDK Extensions

C/C++ Development Perspective

Eclipse platform

Page 6: This material exempt per Department of Commerce license exception TSU Debugging

Debugging 6

Eclipse/CDT Frameworks

• Builder framework– Compiles and Links Source files– Default Build options are specified when application is created: Choice of Debug, Release,

Profile configurations– User can custom build options later when developing application– Build types: Standard Make, Managed Make

• Launch framework– Specifies what action needs to be taken: Run (+ Profile) application or Debug application– In SDK, this is akin to the Target Connection settings

• Debug framework– Launches debugger (gdb), loads application and begins debug session– Debug views show information about state of debug session– Hides ugliness of debug details

• Search framework– Helps development of application

• Help System– Online help system; context-sensitive

Page 7: This material exempt per Department of Commerce license exception TSU Debugging

Debugging 7

SDK Application Development Flow

Create softwareApp Project

Add sources + Edit

Compile + Link

Generate HardwarePlatform

Done?Import ELF file,

Download to board

Debug / Profile

Platform Studio SDK

Yes

Generate SoftwarePlatform

libraries, drivers

Platform Studio

Page 8: This material exempt per Department of Commerce license exception TSU Debugging

Debugging 8

Workspaces and Perspectives

• Workspace– Location to store preferences & internal info about Projects– Transparent to SDK users– In SDK, source files not stored under Workspace

• Views, Editors– Basic User interface element

• Perspectives– Collection of functionally related views– Layout of views in a perspective can be customized according

to user preference

Page 9: This material exempt per Department of Commerce license exception TSU Debugging

Debugging 9

Perspectives

Page 10: This material exempt per Department of Commerce license exception TSU Debugging

Debugging 10

CVS Perspective

Page 11: This material exempt per Department of Commerce license exception TSU Debugging

Debugging 11

Views• Eclipse Platform views: Navigator view, Tasks view, Problems

view• Debug views: Stack view, Variables view• C/C++ views: Projects view, Outline view

Page 12: This material exempt per Department of Commerce license exception TSU Debugging

Debugging 12

Opening Perspectives and Views

• To open a Perspective, use Window Open Perspective

• To open a view, useWindow Show View

If the view is already present in the current perspective, the view is highlighted

Page 13: This material exempt per Department of Commerce license exception TSU Debugging

Debugging 13

Editors• bracket matching• syntax coloring• content assist• refactoring • keyboard shortcuts

Page 14: This material exempt per Department of Commerce license exception TSU Debugging

Debugging 14

SDK Workbench

C/C++ project outline displays the elements of a project with file decorators (icons) for easy identification

C/C++ editor for integrated software creation

Code outline displays elements of the software file under development with file decorators (icons) for easy identification

Problems, Console, Properties view lists output information associated with the software development flow

1

2

3

4

1 2 3

4

Page 15: This material exempt per Department of Commerce license exception TSU Debugging

Debugging 15

Outline

• Software Development Kit • Debugging Tools• Debugging Using XPS• Debugging Using SDK

Page 16: This material exempt per Department of Commerce license exception TSU Debugging

Debugging 16

Introduction

• Debugging is an integral part of embedded systems development• The debugging process is defined as testing, stabilizing, localizing,

and correcting errors• Two methods of debugging

– Hardware debugging • via a logic probe, logic analyzer, in-circuit emulator, or background debugger

– Software debugging via a debugging instrument• A software debugging instrument is source code that is added to the program

for the purpose of debugging

• Debugging types– Functional debugging– Performance debugging

Page 17: This material exempt per Department of Commerce license exception TSU Debugging

Debugging 17

Hardware Debugging Support

• ChipScope™ Pro tool cores are now included for adding to a Xilinx Platform Studio design– PLB IBA (Integrated Bus Analyzer)– OPB IBA– VIO (Virtual I/O)

• ChipScope Pro tool available thru donation

• Enables co-debug of software with GNU gdb and hardware with ChipScope Analyzer

Page 18: This material exempt per Department of Commerce license exception TSU Debugging

Debugging 18

Software Debugging Support

• EDK supports software debugging via:– GNU Debugger (GDB) tools

• Unified interface for debugging and verifying MicroBlaze and PowerPC systems

– Xilinx Microprocessor Debugger (XMD)• Runs all of the hardware debugging tools and

communicates with the hardware– GNU tools communicate with the hardware through

XMD

Page 19: This material exempt per Department of Commerce license exception TSU Debugging

GDB Functionality

Target Hardware

PowerPC System

PPC405 Debug Port

User Interface

(TCP/IP)

GDB Remote Protocol

Host Software

PowerPC-eabi-gdb

Host Software

Tcl/Terminal Interface

XMD PPC Cycle-Accurate Instruction Set Simulator

Host

(TCP Socket

Interface)

JTAG

Page 20: This material exempt per Department of Commerce license exception TSU Debugging

GDB Functionality

• GDB is a source-level debugger that helps you debug your program:– Start your program– Set breakpoints (make your program stop on specified conditions)– Examine what has happened, when your program encounters breakpoints

• Registers• Memory• Stack• Variables • Expressions

– Change things in your program, so you can experiment with correcting the effects of one bug and go on to learn about another

• You can use GDB to debug programs written in C and C++

Page 21: This material exempt per Department of Commerce license exception TSU Debugging

GDB

MemoryLocation

AssemblyInstructions

C Code

Page 22: This material exempt per Department of Commerce license exception TSU Debugging

GDB Functionality

• Breakpoints can be enabled or disabled• To change any memory value, simply double-click in a memory field

Page 23: This material exempt per Department of Commerce license exception TSU Debugging

GDB Functionality

• Blue represents registers that have changed• To change any value, double-click in a field

Page 24: This material exempt per Department of Commerce license exception TSU Debugging

XMD Functionality

User Interface

Target Hardware

(TCP/IP)

GDB Remote Protocol

JTAG

PowerPC System

PPC405 Debug Port

Host Software

PowerPC-eabi-gdb

Host Software

Tcl/Terminal Interface

XMD PPC Cycle-Accurate Instruction Set Simulator

Host

(TCP Socket

Interface)

Page 25: This material exempt per Department of Commerce license exception TSU Debugging

XMD Functionality

• Xilinx Microprocessor Debug (XMD) engine – A program that facilitates a unified GDB interface– A Tool command language(TCL) interface

• XMD supports debugging user programs on different targets– Cycle-accurate PowerPC processor instruction set simulator– PowerPC system on a hardware board

• GDB communicates with xmd by using the Remote TCP protocol and control the corresponding targets

• GDB can connect to xmd on the same computer or on a remote computer on the Internet

Page 26: This material exempt per Department of Commerce license exception TSU Debugging

Debugging 26

Simultaneous HW/SW Debug

• ChipScope™ Pro PLB & IBA cores in target

• ChipScope Pro Analyzer on host• GDB debugger on host• XMD supports simultaneous

access over Xilinx parallel cables• PLB/OPB IBA instantiation in XPS

– Are treated like the peripheral cores

UART GPIOOn-Chip

PeripheralHi-Speed

PeripheralGB

E-Net

e.g.Memory

Controller

ArbiterOn-Chip Peripheral Bus

Arb

iter

Processor Local Bus

PowerPC405 Core

DSOCMBRAM

ISOCMBRAM

BusBridge

UART GPIOOn-Chip

PeripheralUARTUART GPIOGPIO

On-ChipPeripheralOn-Chip

PeripheralHi-Speed

PeripheralGB

E-Net

e.g.Memory

Controller

Hi-SpeedPeripheralHi-Speed

PeripheralGB

E-NetGB

E-Net

e.g.Memory

Controller

e.g.Memory

Controller

ArbiterOn-Chip Peripheral Bus

Arb

iter

Processor Local Bus

PowerPC405 Core

DSOCMBRAM

ISOCMBRAM

DSOCMBRAM

DSOCMBRAM

DSOCMBRAM

ISOCMBRAMISOCMBRAMISOCMBRAM

BusBridge

BusBridge

IBAIBA

MicroBlaze32-Bit RISC CoreMicroBlaze

32-Bit RISC CoreMDM

Set breakpoint in GDB – when hit → triggers ChipScope

Set trigger in ChipScope – when hit → halts CPU and debugger stops

Minimal “skid-by” as cross triggering is done on chip between IBA cores and PPC & MicroBlaze debug interfaces

Page 27: This material exempt per Department of Commerce license exception TSU Debugging

Debugging 27

Simultaneous HW/SW Debug

Flexible Soft IPFlexible Soft IPMicroBlaze

32-Bit RISC CoreMicroBlaze

32-Bit RISC Core

Arb

iter OPB

On-Chip Peripheral Bus

Arb

iter

Arb

iter OPB

On-Chip Peripheral BusOn-Chip Peripheral Bus

MDMMDM

IBAIBA

JTAGJTAG Flexible Soft IPFlexible Soft IPMicroBlaze

32-Bit RISC CoreMicroBlaze

32-Bit RISC Core

Arb

iter OPB

On-Chip Peripheral Bus

Arb

iter

Arb

iter OPB

On-Chip Peripheral BusOn-Chip Peripheral Bus

MDMMDM

IBAIBA

JTAGJTAG

XMDXMD

Xilinx Parallel Cable

Active trigger when addr bus = 0xC200

Trigger out signal from IBA to CPU debug halt signal in

Page 28: This material exempt per Department of Commerce license exception TSU Debugging

Debugging 28

Outline

• Software Development Kit • Debugging Tools• Debugging Using XPS• Debugging Using SDK

Page 29: This material exempt per Department of Commerce license exception TSU Debugging

Debugging 29

A Debugging Sample

This will go through the necessary steps, generate a bitstream file, and download the file

Compile with the debugging option

Compile with the debugging option

1Download the bitstreamDownload the bitstream

2

Page 30: This material exempt per Department of Commerce license exception TSU Debugging

Debugging 30

Start XMD

Set XMD Debug OptionsSet XMD Debug Options3

This opens a connection with the hardware, indicating whether the connecting port, caches, DCR, and TLB are enabled or not

Start the XMD shellStart the XMD shell4

Set connection type and JTAG properties

Page 31: This material exempt per Department of Commerce license exception TSU Debugging

Debugging 31

Start Software Debugger

Start Software DebuggerStart Software Debugger5

A source code window displays

A source code window displays

6

Change the code window display from SOURCE to MIXED to show C and assembly code

If there are more than one application in the project then the tools will provide choice to select an application

Page 32: This material exempt per Department of Commerce license exception TSU Debugging

Debugging 32

Software Debugger Connect

A window displayingC and assembly code

A window displayingC and assembly code

7

Select the target as Remote/TCP: XMD

Select the target as Remote/TCP: XMD

8

Enter that port number that was displayed during ppc-connect

Page 33: This material exempt per Department of Commerce license exception TSU Debugging

Debugging 33

Debug Program

Set any breakpoints as necessarySet any breakpoints as necessary9

Click the Run buttonClick the Run button10

When a breakpoint is encountered, the debugger will stop

When a breakpoint is encountered, the debugger will stop

11

View the necessary windowsView the necessary windows12

Exit debugger by typing quit in the console window

Page 34: This material exempt per Department of Commerce license exception TSU Debugging

Debugging 34

Outline

• Software Development Kit

• Debugging Tools• Debugging Using XPS• Debugging Using SDK

Page 35: This material exempt per Department of Commerce license exception TSU Debugging

Debugging 35

Debugging Using SDK

Eclipse CDT

XMD

powerpc-eabi-gdb (or)

mb-gdb

JTAG / XMD protocolXilinx custom graphical debug interface

auto-launched

auto-launched

gdb remote protocol

Page 36: This material exempt per Department of Commerce license exception TSU Debugging

Debugging 36

SDK Debug Perspective

The stack frame for target threads that you are debugging. Each thread in your program is represented as a node in the tree

Variables, Breakpoints, and Registers views allow for viewing and real-time interaction with the view contents for more powerful debugging potential

C/C++ editor highlights the location of the execution pointer, along with allowing the setting of breakpoints

Code outline and disassembly view provide compiler level insight to what is occurring in the running source

Console view lists output information

1

2

3

4 5

5

43

2

1

Page 37: This material exempt per Department of Commerce license exception TSU Debugging

Debugging 37

Debugging in XPS vs SDKDebugging in XPS

- Download bitstream from XPS

- Launch XMD- Provide Target Connection

Options- Launch GDB (Insight GUI)- Set GDB Server connection

port in GDB- Download program - Begin Debugging

Debugging in SDK

- Download bitstream from XPS

- Launch XMD- Provide Target Connection

Options- Launch GDB (Insight GUI)- Set GDB Server connection

port in GDB- Download program - Begin Debugging

Page 38: This material exempt per Department of Commerce license exception TSU Debugging

Debugging 39

Review Questions

• Into what parts of the design do debuggers provide visibility?

Page 39: This material exempt per Department of Commerce license exception TSU Debugging

Debugging 40

Answers

• Into what parts of the design do debuggers provide visibility?– Registers– Memory– Stack– Variables – Expressions

Page 40: This material exempt per Department of Commerce license exception TSU Debugging

Where Can I Learn More?

• Tool documentation– Embedded System Tools Guide GNU Compiler

Tools– Embedded System Tools Guide GNU Debugger– Embedded System Tools Guide Xilinx

Microprocessor Debugger– Xilinx Platform Studio SDK Online Documentation

• Support website– EDK Home Page: support.xilinx.com/edk