Introduction Purpose This training course covers debugging an application on an SH target in the Renesas HEW (High-performance Embedded Workshop) development.

Post on 24-Dec-2015

214 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

Transcript

Introduction

Purpose • This training course covers debugging an application on an SH

target in the Renesas HEW (High-performance Embedded Workshop) development environment using the KPIT GNU toolchain and the Renesas E10A-USB emulator.

Objectives • Learn how to create a new project and make linker settings.

• Understand how to configure the debug platform and connect to the target system.

• Learn the process of debugging a typical application with the E10A-USB emulator.

Content• 38 pages • 3 questions

Learning Time• 50 minutes

Prerequisites for Debugging

*HEW must be closed and the target disconnected

from the host when the emulator software is installed.

Click each oval for more information .

Renesas E10A-USB emulator software is installed*

KPIT GNU toolchainfor SH target (integrated with HEW 4) is installed

Renesas HEW 4 IDE is installedhttp://www.kpitgnutools.com/showFileDesc.php?hidTcId=295&hidCatName=sc_KPIT_GNU_Tools

http://www.kpitgnutools.com/showFileDesc.php?hidTcId=299&hidCatName=sc_KPIT_GNU_Tools

About the HEW IDE

• A powerful, yet easy-to-use software development solution that shortens system development time - Offers a familiar Graphical User Interface (GUI) that simplifies operations

- Eliminates the need to switch environments between coding and debugging operations, or between target devices

- Allows users to select right tool for each process and fully exploit the tool’s capabilities

- Provides many essential functions, including:• Project manager

• Setup “Wizard”

• Compiler interface

• Configurable build engine

• Editor

• Debugger

• and more

Free HEW courses are available at Renesas Interactive

E10A-USB Emulator

KPIT GNU toolchain

HEW

Click each oval for more information

About the GNU Toolchain

• Proven, pre-built, binary tools that allow more time for application development

- Compiler source code, Binutils, Newlib, and a GDB source-level debugger that shows what is happening inside program as it executes

• Tested and optimized for Renesas targets

• Free and easy to use

• Available for Windows and Linux platforms

• Easy download and installation

• Integrated with Renesas’ proprietary tools

• Free technical support at dedicated web portal - GDB stubs, monitor programs, tutorials, documentation,

FAQs, and discussion forum

E10A-USB Emulator

KPIT GNU toolchain

HEW

Click each oval for more information

About the E10A-USB Emulator

• Low-cost system develop-ment tool that connects to host PC via a USB port, and to SuperH device in target system via an on-chip JTAG interface

- Controlled from PC using HEW GUI

- Provides real-time debugging using dedicated circuitry in target microcontroller

- Offers debugging capabilities such as real-time trace, hardware breakpoints on data and address, 255 PC breakpoints, and saved record of last four branches

Connects to PC’s USB port

Emulator

Software is included on CD

Target board with target MCU

E10A-USB Emulator

KPIT GNU toolchain

HEW

Click each oval for more information

Getting Started

Click to launch HEW

1

34

5

2

HEW Features:• Configurable build engine

- Set up compiler, assembler and linker options

• Integrated text editor- Customize syntax coloring for improved legibility

• Build capabilities- Run tools directly within environment

• Integrated debugger- Build and debug in same application

• Version control

To launch HEW: • Click on HEW icon on desktop • Navigate from Start menu

Creating a WorkspaceClick OKCreate a new project workspace

Creating a New Project (1/13)

Enter Workspace name1

3 4 5Select CPU family Select KPIT GNUSH(ELF) toolchain Click OK

Enter Project name2Select application type

Creating a New Project (2/13)

Click Next

Creating a New Project (3/13)

Select CPU type

Select CPU Click Next

Creating a New Project (4/13)

Click Next

Select Endian type Select options

Is the following statement true or false? Make your selection and then click Done.

“Files generated by the KPIT GNUSH toolchain must be modified before they can be linked to object files created with the Renesas compiler.”

True

False

Question

Done

Creating a New Project (5/13)

Click Finish to complete workspace creation

Project Generator adds these files to your project

Creating a New Project (6/13)

Click OK

Enter application code here

Creating a New Project (7/13)

Output window

Editor windowWorkspace window

Creating a New Project (8/13)

Contains application program

(Code that controls eight LEDs on SH7780 target)

“main.c” file

Creating a New Project (9/13)

Startup code for project

Startup program in “start.asm”. . .

• Initializes the stack pointer

• Initializes the microprocessor

• Puts the data section into RAM at the VMA

• Sets uninitialized global variables to zero

• Initializes global constructors (if it is CPP)

• Calls main function

“start.asm” file

Creating a New Project (10/13)

Definitions of I/O registers

“iodefine.h” file

Creating a New Project (11/13)

Hardware initialization code

“hwinit.c” file

Creating a New Project (12/13)

Declarations of interrupt routines

“inthandler.h” file

Creating a New Project (13/13)

Definitions of interrupt routines

“inthandler.c” file

Question

Which of these statements correctly describe aspects of creating a new project in HEW using the KPIT GNU toolchain? Select all that apply and then click Done.

A. Because HEW is a configurable environment, you can select a GNU toolchain during new project creation and change your selection later in the project.

B. The Editor window lets you view code from project files listed in the Workspace Window.

C. A generated application’s main function resides in the “main.c” project file.

D. KPIT Cummins provides free technical support for HEW for KPIT GNU tools.

Done

Making Linker Settings

Click Build Click SectionsClick Linker to change the linker settings

Click OKModify addresses to match target memory map

SH7780 Hardware Manual

0x00000100 INTHandler0xA0000000 RSTHandler0xA8081100 .text0xA808FF00 .data0xA8081000 .vects0xE5011FE0 .stack

.init

.fini

.got

.rodataeh_frame_hdr

Configuring Debug Platform (1/3)

Ensure that there are no errors, no warnings

Select Debug sessionSelect Debug modeClick Build All

Configuring Debug Platform (2/3)Click Debug

Click Debug Settings Select Target as “SH-4A E10 USB SYSTEM (CPU SH-4A)”

Select Default Debug Format as “Elf/Dwarf2_KPIT”

Click Add

Select Format as ”Elf/Dwarf2_KPIT” Click Browse Select file and Click Open

Click OK

Configuring Debug Platform (3/3)

Click Options

Click AddBrowse to select the .hdc file

Select it and click Open

Click OK

Click OKClick Yes

Connecting to the Target (1/2)

Click Debug Click Connect

Select CPUClick OK Press the Reset button on the hardware and click OK

Connecting to the Target (2/2)

Downloading Module

Right-click on the .x file Click Download Module

Debugging the Application (1/10)

Double-click to insert breakpoint

Debugging the Application (2/10)

Click View Select CPU Select desired option

Debugging the Application (3/10)

Register window

Memory window

Debugging the Application (4/10)

Click View Click Symbol Select desired option

Debugging the Application (5/10)

Watch window

Debugging the Application (6/10)

Click Debug Click Run

Enter “_start”

Click Go

• Ensure that the runtime environment is initialized • Be aware of stack-frame status

Debugging the Application (7/10)

Program halts at Breakpoint

Debugging the Application (8/10)

Press F10 to step through your program

Debugging the Application (9/10)

Click Stop

You must halt program execution before the debugger can be disconnected.

Debugging the Application (10/10)

Click Disconnect

Match each debug feature to the most appropriate explanation by dragging the letters on the left to the correct locations on the right. Click Done when you are finished.

Debug object files

Linker settingsB C

Done ResetShow

Solution

AInclude options for changing the addresses of text and data sections applicable to the target.

B

C Register window

Displays the modified values of the CPU registers after an instruction has been executed.

AContain all the information needed by the GNU compiler for debugging your C/C++ code.

D F10 key command DAllows you to step over a function when you are stepping through and debugging a program.

Question

• Creating a new project

• Making linker settings

• Configuring the debug platform

• Connecting to the SH target system

• Debugging an application using HEW, the KPIT GNU toolchain, and the E10A-USB emulator

Course Summary

For more information, please visit our Web site:http://america.renesas.com

top related