• 検索結果がありません。

Introduction Purpose This training module provides an overview of debugging features in H8S Simulator. Objectives Understand how to use the Simulator.

N/A
N/A
Protected

Academic year: 2021

シェア "Introduction Purpose This training module provides an overview of debugging features in H8S Simulator. Objectives Understand how to use the Simulator."

Copied!
26
0
0

読み込み中.... (全文を見る)

全文

(1)

Introduction

Purpose

 This training module provides an overview of debugging

features in H8S Simulator.

Objectives

 Understand how to use the Simulator.

 Explore various debugging features: CPU status, registers,

memory, breakpoints, and stepping.

Content

 21 pages  3 questions

Learning Time

(2)

2

© 2008, Renesas Technology America, Inc., All Rights Reserved

H8S Simulator

What is a simulator?

 A software development tool that runs on a PC and substitutes for the MCU

 Represents the MCU architecture and operating instructions

Advantages of a simulator

 Enables debugging when target hardware is not available  Helps reduce overall embedded system development time

H8S Simulator functions

 CPU instructions  Memory access  Register access

Complementary HEW features

 Help make the H8S Simulator more “hardware-like”

 Include simulated I/O, Trigger, and TCL toolkit

(3)

Before Debugging Session Begins

1.Begin Project Generation 2.Select the Target CPU

3.Set the Target System for Debugging

Selecting this option

automatically generates a simulator session

(4)

4

© 2008, Renesas Technology America, Inc., All Rights Reserved

/********************************************************/ /* TUTORIAL PROGRAM */ /********************************************************/ #include <machine.h>

#include "string.h" #define NAME (short)0 #define AGE (short)1 #define ID (short)2 #define LENGTH 8

const char LED[]={0x12, 0x12, 0x11}; struct namelist {

char name[LENGTH]; short age;

long idcode; };

struct namelist section1[] = {

"Naoko", 17, 1234, "Midori", 22, 8888, "Rie", 19, 7777, "Eri", 20, 9999, "Kyoko", 26, 3333, "", 0, 0 }; int count; void sort(); void main(void) { count = 0; for ( ; ; ){ sort(section1, NAME); count++; sort(section1, AGE); count++; sort(section1, ID); count++; } }

void sort(list, key) struct namelist list[]; short key;

{

short i,j,k; long min; char *name;

struct namelist worklist;

switch(key){

case NAME :

for (i = 0 ; *list[i].name != 0 ; i++){ name = list[i].name; k = i;

for (j = i+1 ; *list[j].name != 0 ; j++){

if (strcmp(list[j].name , name) < 0){ name = list[j].name; k = j; } } worklist = list[i]; list[i] = list[k]; list[k] = worklist; } break; case AGE :

for (i = 0 ; list[i].age != 0 ; i++){ min = list[i].age; k = i;

for (j = i+1 ; list[j].age != 0 ; j++){

if (list[j].age < min){ min = list[j].age; k = j; } } worklist = list[i]; list[i] = list[k]; list[k] = worklist; } break; case ID :

for (i = 0 ; list[i].idcode != 0 ; i++){ min = list[i].idcode; k = i;

for (j = i+1 ; list[j].idcode != 0 ; j++){

if (list[j].idcode < min){ min = list[j].idcode; k = j; } } worklist = list[i]; list[i] = list[k]; list[k] = worklist; } break; } }

Example: Tutorial program with sorting routine is used for simulation

Enter Code

In it ia li z a ti o n M a in S o rt

(5)

Basic Debugging

(6)

6

© 2008, Renesas Technology America, Inc., All Rights Reserved

Basic Debugging: View Menu

View

Debug

Display assembly code

View CPU registers View memory

View peripheral registers View CPU status

View simulated I/O

View/configure simulated interrupts View/configure labels View/modify variables View/modify local variables

(7)

Basic Debugging: Debug Menu

View

Debug

Execute code

Reset CPU and execute code

Execute until PC reaches the cursor position Set PC value and execute

Display PC value Step into deeper level Step to the next line

Step out to the higher level

(8)

PROPERTIES

On passing, 'Finish' button: Goes to Next Slide

On failing, 'Finish' button: Goes to Slide

Allow user to leave quiz: After user has completed quiz

User may view slides after quiz: After passing quiz

(9)

Download Module

1. Right click and select

“Download module” to load module into simulator target

2. After downloading, the Simulator displays starting address for each line of C code

(10)

10

© 2008, Renesas Technology America, Inc., All Rights Reserved

View Status

1. Select to view CPU status

2. Status window shows memory and downloaded module information

(11)

Disassembly

1. Select “Disassembly” to view corresponding assembly code 2. Right-click on “Disassembly” and select “Set Address” to set the starting address 3. Enter “000800” and click OK

(12)

12

© 2008, Renesas Technology America, Inc., All Rights Reserved

View Assembly Instructions

4. Disassembly window shows assembly code, starting from

(13)

Registers Window

2. Register values can be edited directly in the Registers window

1. Select to open Registers window

(14)

14

© 2008, Renesas Technology America, Inc., All Rights Reserved

Watch Window

2. Right-click in Watch window and select “Add Watch”

3. Enter “section1”

and click OK 4. View values of “section1” array in Watch window 1. Select to open

(15)

Examine Memory Content

1. Select to view memory content

3. Memory window appears. (Values of “section1” won’t be updated until “Reset Go” is executed)

2. Enter address of “section1” (from Watch window)

(16)

16

© 2008, Renesas Technology America, Inc., All Rights Reserved

Set and View Breakpoints

1. Right-click on line, then select “Toggle Breakpoint”

3. Select to open Eventpoint

window

4. See all breakpoints in program

(17)

PROPERTIES

On passing, 'Finish' button: Goes to Next Slide

(18)

18

© 2008, Renesas Technology America, Inc., All Rights Reserved

Execute Program

1. Select “Reset Go” to begin executing

program 2. Execution stops at breakpoint. (Yellow arrow indicates current position of program counter.)

3. Register values are

updated in Registers window. (Program counter value

corresponds to

position marked by yellow arrow in Edit menu.)

(19)

Content of Memory Window

(20)

20

© 2008, Renesas Technology America, Inc., All Rights Reserved

Stepping Through the Code

HEW also supports flexible stepping, which is accessible from the “Step . . .” menu option.

Three basic levels of stepping:

Step In

- Takes you deeper into function call - Moves PC to start of sub-function

Step Over

- Executes current line of source code, including all instructions in sub-function - Moves PC to next line

Step Out

- Lets you go back to next-higher level of code; i.e., return from the function call

(21)

Step In

2. Arrow in Edit window shows program counter position at the beginning of the called function after stepping Example: 3. Registers window updates program counter value

If source line does not call a function, a Step-In operation is the same as a Step-Over operation.

1. Select “Step In” to go deeper into function call

(22)

22

© 2008, Renesas Technology America, Inc., All Rights Reserved

Step Over

2. Arrow in Edit window shows program counter position after stepping

3. Registers window updates program counter value

1. Select “Step Over” to step to the next line

Example:

If source line does not call a function, a Step-In operation is the same as a Step-Over operation.

(23)

Step Out

2. Arrow in Edit window shows program counter position at the next line of the calling function after stepping

1. Select “Step Out” to go back to next higher level of code

Example:

3. Registers window updates program counter value

Before Step Out

(24)

24

© 2008, Renesas Technology America, Inc., All Rights Reserved

Track Variable in Watch Window

2. “Step Over” to next line

1. Add the variable “count” to Watch window

3. Value of “count” is updated in Watch window

Breakpoint

(25)

PROPERTIES

On passing, 'Finish' button: Goes to Next Slide

(26)

26

© 2008, Renesas Technology America, Inc., All Rights Reserved

Definition of a simulator

Key features of H8S Simulator

Using H8S features for debugging

Course Summary

Download a free evaluation copy of HEW at:

参照

関連したドキュメント

[Tetali 1991], and characterises the weights (and therefore the Dirichlet form) uniquely [Kigami 1995]... RESISTANCE METRIC, e.g. equipped with conductances) graph with vertex set V

Then it follows immediately from a suitable version of “Hensel’s Lemma” [cf., e.g., the argument of [4], Lemma 2.1] that S may be obtained, as the notation suggests, as the m A

Applications of msets in Logic Programming languages is found to over- come “computational inefficiency” inherent in otherwise situation, especially in solving a sweep of

Section 3 is first devoted to the study of a-priori bounds for positive solutions to problem (D) and then to prove our main theorem by using Leray Schauder degree arguments.. To show

This paper presents an investigation into the mechanics of this specific problem and develops an analytical approach that accounts for the effects of geometrical and material data on

We use the monotonicity formula to show that blow up limits of the energy minimizing configurations must be cones, and thus that they are determined completely by their values on

While conducting an experiment regarding fetal move- ments as a result of Pulsed Wave Doppler (PWD) ultrasound, [8] we encountered the severe artifacts in the acquired image2.

For X-valued vector functions the Dinculeanu integral with respect to a σ-additive scalar measure on P (see Note 1) is the same as the Bochner integral and hence the Dinculeanu