0% found this document useful (0 votes)
30 views103 pages

H8S, H8/300 Series Simulator/Debugger For Windows: Hitachi Microcomputer Development Environment System

Uploaded by

Thanh Trụ
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views103 pages

H8S, H8/300 Series Simulator/Debugger For Windows: Hitachi Microcomputer Development Environment System

Uploaded by

Thanh Trụ
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 103

Hitachi Microcomputer Development Environment System

H8S, H8/300 Series


Simulator/Debugger for Windows®

User’s Manual

ADE-702-037D

Rev. 1.0
6/22/99
Hitachi, Ltd.

HSS008SDIW3SE
Cautions

1. Hitachi neither warrants nor grants licenses of any rights of Hitachi’s or any third party’s
patent, copyright, trademark, or other intellectual property rights for information contained in
this document. Hitachi bears no responsibility for problems that may arise with third party’s
rights, including intellectual property rights, in connection with use of the information
contained in this document.
2. Products and product specifications may be subject to change without notice. Confirm that you
have received the latest product standards or specifications before final design, purchase or
use.
3. Hitachi makes every attempt to ensure that its products are of high quality and reliability.
However, contact Hitachi’s sales office before using the product in an application that
demands especially high quality and reliability or where its failure or malfunction may directly
threaten human life or cause risk of bodily injury, such as aerospace, aeronautics, nuclear
power, combustion control, transportation, traffic, safety equipment or medical equipment for
life support.
4. Design your application so that the product is used within the ranges guaranteed by Hitachi
particularly for maximum rating, operating supply voltage range, heat radiation characteristics,
installation conditions and other characteristics. Hitachi bears no responsibility for failure or
damage when used beyond the guaranteed ranges. Even within the guaranteed ranges,
consider normally foreseeable failure rates or failure modes in semiconductor devices and
employ systemic measures such as fail-safes, so that the equipment incorporating Hitachi
product does not cause bodily injury, fire or other consequential damage due to operation of
the Hitachi product.
5. This product is not designed to be radiation resistant.
6. No one is permitted to reproduce or duplicate, in any form, the whole or part of this document
without written approval from Hitachi.
7. Contact Hitachi’s sales office for any questions regarding this document or Hitachi
semiconductor products.
Preface
The H8S, H8/300 Series Simulator/Debugger (referred to in this manual as the
simulator/debugger) is a software tool that simulates programs for the H8S, H8/300 series of
microprocessors to support program development and debugging on a host computer.

This user's manual describes the simulator/debugger functions and its usage. Read this manual
and the following manuals, and understand their contents before using the simulator/debugger.

• Hitachi Embedded Workshop User's Manual


• Hitachi Debugging Interface User’s Manual
• H8S, H8/300 Series C/C++ Compiler User’s Manual
• H8S, H8/300 Series Cross Assembler User’s Manual
• H Series Linkage Editor, Librarian, Object Converter User’s Manual

For details on each H8S, H8/300 series microprocessor, refer to the appropriate hardware and
programming manuals.

Notes: 1. This manual assumes the operating environment to be the English version of
® ®
Microsoft Windows 95 operating system.
® ® ®
2. Microsoft , Windows , and WindowsNT are registered trademarks of Microsoft
Corporation in the United States and/or in other countries.
3. IBM PC is a personal computer administered by International Business Machines
Corporation.
4. ELF/DWARF is the name of an object format developed by the Tool Interface
Standard Committee.
5. All other products or brand names are trademarks or registered trademarks of their
respective holders.

Rev. 1.0, 06/99, page i of viii


Contents

Section 1 Overview ......................................................................................... 1


1.1 Features ............................................................................................................................ 1
1.2 User Program.................................................................................................................... 2
1.3 Simulation Range ............................................................................................................. 4

Section 2 Simulator/Debugger Functions........................................................ 5


2.1 Simulator/Debugger Platforms and CPU Types ............................................................... 5
2.2 Simulator/Debugger Memory Management ..................................................................... 5
2.2.1 Memory Map Specification ................................................................................. 5
2.2.2 Memory Resource Allocation.............................................................................. 6
2.3 Instruction Execution Reset Processing............................................................................ 6
2.4 Exception Processing........................................................................................................ 7
2.5 Features Specific to H8S/2600 CPU................................................................................. 7
2.6 Control Registers .............................................................................................................. 8
2.7 Trace................................................................................................................................. 8
2.8 Standard I/O and File I/O Processing ............................................................................... 9
2.9 Calculation of Instruction Execution Cycles .................................................................... 22
2.10 Break Conditions .............................................................................................................. 23
2.10.1 Break Due to the Satisfaction of a Break Command Condition .......................... 23
2.10.2 Break Due to the Detection of an Error During Execution of the User Program 24
2.10.3 Break Due to a Trace Buffer Full ........................................................................ 25
2.10.4 Break Due to Execution of the SLEEP Instruction.............................................. 25
2.10.5 Break Due to the [STOP] Button......................................................................... 26
2.11 Floating-Point Data .......................................................................................................... 26
2.12 Display of Function Call History...................................................................................... 27

Section 3 Installation ....................................................................................... 29

Section 4 Tutorial ............................................................................................ 31


4.1 Introduction ...................................................................................................................... 31
4.2 Running HDI .................................................................................................................... 31
4.3 Selecting the Target Platform ........................................................................................... 32
4.4 Mapping the Memory Resource ....................................................................................... 34
4.5 Downloading the Tutorial Program .................................................................................. 36
4.6 Displaying the Source Program ........................................................................................ 38
4.7 Setting a PC Breakpoint ................................................................................................... 40
4.8 Setting Trace Information Acquisition Conditions........................................................... 41
4.9 Setting Performance Analysis........................................................................................... 42
4.10 Setting the Stack Pointer................................................................................................... 43

Rev. 1.0, 06/99, page iii of viii


4.11 Executing the Program ..................................................................................................... 44
4.12 Using the Trace Buffer ..................................................................................................... 47
4.13 Searching the Trace Buffer............................................................................................... 48
4.14 Reviewing Breakpoints..................................................................................................... 49
4.15 Viewing Memory.............................................................................................................. 50
4.16 Watching Variables .......................................................................................................... 51
4.17 Stepping Through a Program............................................................................................ 54
4.17.1 Executing [Step In].............................................................................................. 55
4.17.2 Executing [Step Out] ........................................................................................... 56
4.17.3 Executing [Step Over] ......................................................................................... 58
4.18 Displaying Local Variables .............................................................................................. 60
4.19 Reviewing the Performance Analysis............................................................................... 61
4.20 Saving the Session ............................................................................................................ 61

Section 5 Windows and Dialog Boxes............................................................ 63


5.1 Breakpoints Window ........................................................................................................ 65
5.2 Set Break Dialog Box ....................................................................................................... 67
5.3 Break Sequence Dialog Box............................................................................................. 69
5.4 System Configuration Dialog Box.................................................................................... 70
5.5 Memory Map Modify Dialog Box.................................................................................... 72
5.6 Memory Map Dialog Box................................................................................................. 73
5.7 System Memory Resource Modify Dialog Box ............................................................... 74
5.8 Performance Analysis Window ........................................................................................ 75
5.9 Performance Option Dialog Box ...................................................................................... 76
5.10 Trace Window .................................................................................................................. 77
5.11 Trace Acquisition Dialog Box .......................................................................................... 79
5.12 Trace Search Dialog Box.................................................................................................. 80
5.13 Control Registers Window ............................................................................................... 81
5.14 SYSCR Dialog Box .......................................................................................................... 82
5.15 Simulated I/O Window..................................................................................................... 83
5.16 Stack Trace Window ........................................................................................................ 84

Section 6 Simulator/Debugger Commands ..................................................... 85


6.1 BREAKPOINT [BP] Sets a breakpoint at an instruction address .................................... 87
6.2 BREAK_ACCESS [BA] Specifies a memory range access as a break condition ............ 87
6.3 BREAK_CLEAR [BC] Cancels breakpoints ................................................................... 88
6.4 BREAK_DATA [BD] Specifies a memory data value as a break condition.................... 88
6.5 BREAK_DISPLAY [BI] Displays a list of breakpoints................................................... 89
6.6 BREAK_ENABLE [BE] Enables or disables a breakpoint.............................................. 89
6.7 BREAK_REGISTER [BR] Specifies register data as a break condition.......................... 90
6.8 BREAK_SEQUENCE [BS] Sets sequential breakpoints ................................................. 90
6.9 MAP_SET [MS] Allocates a memory area ...................................................................... 91
6.10 TRACE_ACQUISITION [TA] Enables or disables trace information acquisition .......... 91
Rev. 1.0, 06/99, page iv of viii
6.11 ANALYSIS_RANGE [AR] Specifies or displays functions for performance analysis ... 91

Section 7 Messages.......................................................................................... 92
7.1 Information Messages....................................................................................................... 92
7.2 Error Messages ................................................................................................................. 93

Rev. 1.0, 06/99, page v of viii


Figures
Figure 1.1 Creation of SYSROF and S-Type-Format User Programs .................................... 2
Figure 1.2 Creation of ELF/DWARF-Format User Programs ................................................ 3
Figure 4.1 Icon of HDI for Simulator ..................................................................................... 31
Figure 4.2 Select Session Dialog Box ..................................................................................... 32
Figure 4.3 Hitachi Debugging Interface Window ................................................................... 33
Figure 4.4 Memory Map Dialog Box...................................................................................... 34
Figure 4.5 System Memory Resource Modify Dialog Box..................................................... 34
Figure 4.6 Load Program Dialog Box ..................................................................................... 36
Figure 4.7 Open Dialog Box ([Load Program...]) ................................................................... 36
Figure 4.8 HDI Dialog Box..................................................................................................... 37
Figure 4.9 Open Dialog Box ([Source...])............................................................................... 38
Figure 4.10 Source Window (Displaying the Source Program) ................................................ 39
Figure 4.11 Source Window (Setting the Breakpoint) .............................................................. 40
Figure 4.12 Trace Acquisition Dialog Box ............................................................................... 41
Figure 4.13 Performance Option Dialog Box ........................................................................... 42
Figure 4.14 Performance Analysis Window (Setting) .............................................................. 42
Figure 4.15 Registers Window.................................................................................................. 43
Figure 4.16 Go Button............................................................................................................... 44
Figure 4.17 Source Window (Break Status).............................................................................. 44
Figure 4.18 System Status Window .......................................................................................... 45
Figure 4.19 Registers Window.................................................................................................. 46
Figure 4.20 Trace Window (Displaying Trace Information) .................................................... 47
Figure 4.21 Trace Search Dialog Box ....................................................................................... 48
Figure 4.22 Trace Window (Search Results) ............................................................................ 48
Figure 4.23 Breakpoints Window ............................................................................................. 49
Figure 4.24 Open Memory Window Dialog Box...................................................................... 50
Figure 4.25 Word Memory Window......................................................................................... 50
Figure 4.26 Instant Watch Dialog Box...................................................................................... 51
Figure 4.27 Watch Window (Displaying the Array) ................................................................. 51
Figure 4.28 Add Watch Dialog Box.......................................................................................... 52
Figure 4.29 Watch Window (Displaying the Variable)............................................................. 52
Figure 4.30 Watch Window (Displaying Array Elements) ....................................................... 53
Figure 4.31 Source Window (Stepping).................................................................................... 54
Figure 4.32 Step In Button ........................................................................................................ 55
Figure 4.33 Source Window (Step In) ...................................................................................... 55
Figure 4.34 Step Out Button ..................................................................................................... 56
Figure 4.35 Source Window (Step Out).................................................................................... 56
Figure 4.36 Source Window (Step Out −> Step In) .................................................................. 57
Figure 4.37 Source Window (Before Step Over Execution) ..................................................... 58
Figure 4.38 Step Over Button ................................................................................................... 58
Figure 4.39 Source Window (Step Over).................................................................................. 59
Rev. 1.0, 06/99, page vi of viii
Figure 4.40 Locals Window ...................................................................................................... 60
Figure 4.41 Performance Analysis Window (Reviewing)......................................................... 61
Figure 5.1 Breakpoints Window ............................................................................................. 65
Figure 5.2 Set Break Dialog Box ............................................................................................ 67
Figure 5.3 Break Sequence Dialog Box .................................................................................. 69
Figure 5.4 System Configuration Dialog Box......................................................................... 70
Figure 5.5 Memory Map Modify Dialog Box ......................................................................... 72
Figure 5.6 Memory Map Dialog Box...................................................................................... 73
Figure 5.7 System Memory Resource Modify Dialog Box..................................................... 74
Figure 5.8 Performance Analysis Window ............................................................................. 75
Figure 5.9 Performance Option Dialog Box ........................................................................... 76
Figure 5.10 Trace Window ....................................................................................................... 77
Figure 5.11 Trace Acquisition Dialog Box ............................................................................... 79
Figure 5.12 Trace Search Dialog Box ....................................................................................... 80
Figure 5.13 Control Registers Window..................................................................................... 81
Figure 5.14 SYSCR Dialog Box ............................................................................................... 82
Figure 5.15 Simulated I/O Window .......................................................................................... 83
Figure 5.16 Stack Trace Window.............................................................................................. 84
Figure 6.1 Command Description Format............................................................................... 85

Rev. 1.0, 06/99, page vii of viii


Tables
Table 2.1 Simulator/Debugger Platforms and CPU Types .................................................... 5
Table 2.2 Memory Types....................................................................................................... 5
Table 2.3 I/O Functions ......................................................................................................... 9
Table 2.4 Processing When a Break Condition is Satisfied ................................................... 23
Table 2.5 Simulation Errors................................................................................................... 24
Table 2.6 Register States When Simulation Stops due to an Error........................................ 25
Table 4.1 Step Menu Commands........................................................................................... 54
Table 5.1 HDI Window Menus and Corresponding Manuals................................................ 63
Table 6.1 Simulator/Debugger Commands............................................................................ 85
Table 7.1 Information Messages............................................................................................ 92
Table 7.2 Error Messages ...................................................................................................... 93

Rev. 1.0, 06/99, page viii of viii


Section 1 Overview
The simulator/debugger V. 3 provides simulation functions for the H8S and H8/300 series
microprocessors (H8/300, H8/300L, H8/300H, H8S/2600, and H8S/2000 series) and debugging
functions for programs written in C, C++, or assembly language. Therefore, the
simulator/debugger promotes efficient debugging of programs for the H8S and H8/300 series. This
®
simulator/debugger operates with the Hitachi Debugging Interface (HDI), a Windows -based
interface program.

When used with the following software, the simulator/debugger reduces the time required for
software development.

• Hitachi Embedded Workshop


• H8S and H8/300 series C/C++ compiler
• H8S and H8/300 series cross assembler
• H series inter-module optimizer
• H series librarian
• H series object converter

1.1 Features
The simulator/debugger has the following features:

• Since the simulator/debugger runs on a host computer, software debugging can start without
using an actual user system, thus reducing overall system development time.
• The simulator/debugger performs a simulation to calculate the number of instruction execution
cycles for a program, thus enabling performance evaluation without using an actual H8S or
H8/300 series user system.
• The simulator/debugger offers the following features and functions that enable efficient
program testing and debugging.
 Handling all of the H8S and H8/300 series CPUs
 Tracing instructions or subroutines
 Stopping or continuing execution when an error occurs during user program execution
 Measuring function-unit performance
 A comprehensive set of break functions
 Setting or editing memory maps
 Displaying function call history
• The breakpoint, memory map, performance measurement, and trace can be set in the dialog
®
box under Windows . Environments corresponding to each memory map of the H8S and
H8/300 microprocessors can also be set in the dialog box.

Rev. 1.0, 06/99, page 1 of 93


1.2 User Program
Load modules in SYSROF format, S-type format, and ELF/DWARF format can be debugged with
the simulator/debugger. These load modules are called user programs in this manual.

Figure 1.1 shows the creation of SYSROF and S-type-format user program. Figure 1.2 shows the
creation of ELF/DWARF-format user program.

Assembly source C source C++ source


program program program

H8S, H8/300 series H8S, H8/300 series


cross assembler C/C++ compiler

Librarian Object Browser


load module information file

Library file

Inter-module
optimizer

S-type object
converter Load module
(SYSROF)

S-type
load module

H8S, H8/300 series


simulator/debugger

Figure 1.1 Creation of SYSROF and S-Type-Format User Programs

Rev. 1.0, 06/99, page 2 of 93


Assembly source C source C++ source
program program program

H8S, H8/300 series H8S, H8/300 series


cross assembler C/C++ compiler

Object DWARF Browser


load module object converter information file

Librarian

Library file

Inter-module
optimizer

Management Load module Debugging


information file information file
(ELF) (DWARF)

H8S, H8/300 series


simulator/debugger

Figure 1.2 Creation of ELF/DWARF-Format User Programs

Rev. 1.0, 06/99, page 3 of 93


1.3 Simulation Range
The simulator/debugger supports the following H8S and H8/300 series MCU functions:

• All CPU instructions


• Exception processing
• Registers
• All address areas

The simulator/debugger does not support the following H8S and H8/300 series MCU functions.
Programs that use these functions must be debugged with the H8S and H8/300 series emulator.

• Dual port RAM


• Timers
• Pulse width modulator (PWM)
• Serial communication interface (SCI)
• A/D converter
• I/O ports
• Interrupt controller

Rev. 1.0, 06/99, page 4 of 93


Section 2 Simulator/Debugger Functions
This section describes the H8S and H8/300 series simulator/debugger functions.

2.1 Simulator/Debugger Platforms and CPU Types


Each simulator/debugger platform corresponds to a specific type of CPU as listed in table 2.1.

A platform can be selected from the Select Session dialog box. For details, refer to section 4.3,
Selecting the Target Platform.

Table 2.1 Simulator/Debugger Platforms and CPU Types

Simulator/Debugger Platform CPU Type


H8/300 simulator H8/300
H8/300L simulator H8/300L
H8/300HA simulator H8/300H advanced mode
H8/300HN simulator H8/300H normal mode
H8/2600A simulator H8S/2600 advanced mode
H8/2600N simulator H8S/2600 normal mode
H8/2000A simulator H8S/2000 advanced mode
H8/2000N simulator H8S/2000 normal mode

2.2 Simulator/Debugger Memory Management

2.2.1 Memory Map Specification

A memory map is specified to calculate the number of memory access cycles during simulation.
The simulator/debugger supports the memory types shown in table 2.2.

Table 2.2 Memory Types

Memory Type User Program Execution


Internal ROM Enabled
Internal RAM Enabled
External memory Enabled
Internal I/O Disabled
EEPROM Enabled

Rev. 1.0, 06/99, page 5 of 93


A memory map, including the following items, can be specified in the System Configuration
dialog box.

• Memory type
• Start and end addresses of the memory area
• Number of memory access cycles
• Memory data bus width

2.2.2 Memory Resource Allocation

A memory resource must be allocated to load and execute a user program.

The memory resource, including the following items, can be specified in the System Memory
Resource Modify dialog box.

• Start address
• End address
• Access type

The access type can be read/write, read-only, or write-only. Since an error occurs if the user
program attempts an illegal access (for example, trying to write to a read-only memory), such an
illegal access in the user program can be easily detected. However, unlike the other memory areas,
a read-only EEPROM can be written to with the EEPMOV instruction and a writable EEPROM
can be written to only with the EEPMOV instruction.

2.3 Instruction Execution Reset Processing


The simulator/debugger resets the instruction execution count and instruction execution cycles
when:

• The program counter (PC) is modified after the instruction simulation stops and before it
restarts.
• The RUN command to which the execution start address has been specified is executed.
• Initialization is performed, or a program is loaded.

Rev. 1.0, 06/99, page 6 of 93


2.4 Exception Processing
The simulator/debugger detects the exceptions corresponding to TRAPA instructions (only for the
H8/300H and H8S series) and traces (only for the H8S series) and then simulates exception
processing.

The simulator/debugger simulates exception processing with the following procedures.

1. Detects an exception during instruction execution.


2. Saves the PC and CCR register in the stack area. If the validity bit in EXR is set to 1, the
simulator/debugger also saves the EXR register. If an error occurs while saving registers, the
simulator/debugger stops exception processing, displays that an exception processing error has
occurred, and enters the command input wait state.
3. Sets the I bit in the CCR register as 1.
4. Reads the start address from the vector address corresponding to the vector number. If an error
occurs while reading the address, the simulator/debugger stops exception processing, displays
that an exception processing error has occurred, and enters the command input wait state. T
5. Starts instruction execution from the start address. If the start address is 0, the
simulator/debugger stops exception processing, displays that an exception processing error has
occurred, and enters the command input wait state.

2.5 Features Specific to H8S/2600 CPU


The H8S/2600 CPU offers the following specific features.

• Execution of a multiply and accumulate (MAC) instruction


Either saturation or non-saturation multiply and accumulate operation can be executed
depending on the state of bit 7 (the MACS bit) in the SYSCR register in the internal I/O:
MACS bit = 0: Non-saturation operation
MACS bit = 1: Saturation operation
• Enabling or disabling the EXR register
The EXR register can be enabled or disabled depending on the state of bit 5 (the EXR bit) in
the SYSCR register in the internal I/O:
EXR bit = 0: EXR disabled
EXR bit = 1: EXR enabled

The SYSCR register address can be specified using [SYSCR Address] in the System
Configuration dialog box.

Note: The SYSCR register address must be within the internal I/O; otherwise the
simulator/debugger assumes the MACS bit as 0 (non-saturation operation) and EXR
bit as 0 (EXR disabled).
Rev. 1.0, 06/99, page 7 of 93
2.6 Control Registers
In the H8S/2600 series, the simulator/debugger supports the system control register (SYSCR) as a
memory-mapped control register. Therefore, a user program using multiply and accumulate
operation and EXR access can be simulated and debugged.

The SYSCR address can be specified using [SYSCR Address] in the System Configuration
dialog box. To modify or display a SYSCR value, use the Control Registers window and the
SYSCR dialog box.

For details, refer to section 5.4, System Configuration Dialog Box, section 5.13, Control Registers
Window, and section 5.14, SYSCR Dialog Box.

2.7 Trace
The simulator/debugger writes the results of each instruction execution into the trace buffer. The
trace buffer can hold the results for up to 1024 instruction executions. The conditions for the trace
information acquisition can be specified in the Trace Acquisition dialog box. Click the right
mouse button and choose [Acquisition] from the pop-up menu to display the Trace Acquisition
dialog box. The acquired trace information is displayed in the Trace window.

The trace information displayed in the Trace window is as follows.

• Total number of instruction execution cycles


• Instruction address
• CCR
• Multiplier internal flag (only for the H8S/2600 series)
• Instruction mnemonic
• Data access information (destination and accessed data)
• C/C++ or assembly-language source program

The trace information can be searched for. The search conditions can be specified in the Trace
Search dialog box. Click the right mouse button and choose [Find] from the pop-up menu to
display the Trace Search dialog box.

For details, refer to section 5.10, Trace Window through section 5.12, Trace Search Dialog Box.

Rev. 1.0, 06/99, page 8 of 93


2.8 Standard I/O and File I/O Processing
The simulator/debugger provides the Simulated I/O window to enable the standard I/O and file I/O
processing to be executed by the user program. When the I/O processing is executed, the
Simulated I/O window must be open.

Table 2.3 lists the I/O processing functions supported by the simulator/debugger. Each function
has three types of function codes: those for the16-bit address, for the 24-bit address, and for the
32-bit address. Select one according to the target CPU.

Table 2.3 I/O Functions

Function Code
16-Bit 24-Bit 32-Bit Function
No. Address Address Address Name Description
1 H'01 H'11 H'21 GETC Inputs one byte from the standard input device
2 H'02 H'12 H'22 PUTC Outputs one byte to the standard output device
3 H'03 H'13 H'23 GETS Inputs one line from the standard input device
4 H'04 H'14 H'24 PUTS Outputs one line to the standard output device
5 H'05 H'15 H'25 FOPEN Opens a file
6 H'06 H'06 H'06 FCLOSE Closes a file
7 H'07 H'17 H'27 FGETC Inputs one byte from a file
8 H'08 H'18 H'28 FPUTC Outputs one byte to a file
9 H'09 H'19 H'29 FGETS Inputs a line from a file
10 H'0A H'1A H'2A FPUTS Outputs a line to a file
11 H'0B H'0B H'0B FEOF Checks for end of file
12 H'0C H'0C H'0C FSEEK Moves the file pointer
13 H'0D H'0D H'0D FTELL Returns the current position of the file pointer

To perform I/O processing, use the [System Call Address] in the System Configuration dialog
box in the following procedure.

1. Set the address specialized for I/O processing in the [System Call Address], select [Enable]
and execute the program.
2. When detecting a subroutine call instruction (BSR or JSR) jumping to the specialized address
during user program execution, the simulator/debugger performs I/O processing with the R0
and R1 values (H8/300 and H8/300L series) or the ER1 value (H8/300H and H8S series) as
parameters.

Rev. 1.0, 06/99, page 9 of 93


Therefore, before issuing a system call, set as follows in the user program:

• Set the function code (table 2.3) to the R0 register.


MSB 1 byte 1 byte LSB
H'01 Function code

• Set the parameter block address to the R1 register (H8/300 and H8/300L series) or ER1
register (H8/300H and H8S series). For the parameter block, refer to each function description.
MSB LSB
Parameter block address

• Reserve the parameter block and input/output buffer areas

Each parameter of the parameter block must be accessed in the parameter size.

After the I/O processing, the simulator/debugger resumes simulation from the instruction that
follows the system call instruction.

Each I/O function is described in the following format:

(1) (2) (4)


(3)

Parameter Block
(5)

Parameters
(6)

(1) Number corresponding to table 2.3


(2) Function name
(3) Function code
(4) I/O overview
(5) I/O parameter block
(6) I/O parameters

Rev. 1.0, 06/99, page 10 of 93


1 GETC Inputs one byte from the standard input device
H'01, H'11, H'21

Parameter Block

• Function code: H'01 (for the 16-bit address)


One byte One byte
+0 Input buffer start address

• Function code: H'11 (for the 24-bit address) or H'21 (for the 32-bit address)
One byte One byte
+0
Input buffer start address
+2

Parameters

• Input buffer start address (input)


Start address of the buffer to which the input data is written to.

2 PUTC Outputs one byte to the standard output device


H'02, H'12, H'22

Parameter Block

• • Function code: H'02 (for the 16-bit address)


One byte One byte
+0 Output buffer start address

• • Function code: H'12 (for the 24-bit address) or H'22 (for the 32-bit address)
One byte One byte
+0
Output buffer start address
+2

Parameters

• Output buffer start address (input)


Start address of the buffer in which the output data is stored.

Rev. 1.0, 06/99, page 11 of 93


3 GETS Inputs one line from the standard input device
H'03, H'13, H'23

• Function code: H'03 (for the 16-bit address)


One byte One byte
+0 Input buffer start address

• Function code: H'13 (for the 24-bit address) or H'23 (for the 32-bit address)
One byte One byte
+0
Input buffer start address
+2

Parameters

• Input buffer start address (input)


Start address of the buffer to which the input data is written to.

4 PUTS Outputs one line to the standard output device


H'04, H'14, H'24

Parameter Block

• Function code: H'04 (for the 16-bit address)


One byte One byte
+0 Output buffer start address

• Function code: H'14 (for the 24-bit address) or H'24 (for the 32-bit address)
One byte One byte
+0
Output buffer start address
+2
Parameters

• Output buffer start address (input)


Start address of the buffer in which the output data is stored.

Rev. 1.0, 06/99, page 12 of 93


5 FOPEN Opens a file
H'05, H'15, H'25

The FOPEN opens a file and returns the file number. After this processing, the returned file
number must be used to input, output, or close files. A maximum of 256 files can be open at the
same time.

Parameter Block

• Function code: H'05 (for the 16-bit address)


One byte One byte
+0 Return value File number
+2 Open mode Unused
+4 Start address of file name

• Function code: H'15 (for the 24-bit address) or H'25 (for the 32-bit address)
One byte One byte
+0 Return value File number
+2 Open mode Unused
+4
Start address of file name
+6

Parameters

• Return value (output)


0: Normal completion
–1: Error
• File number (output)
The number to be used in all processing after opening.
• Open mode (input)
H'00: "r"
H'01: "w"
H'02: "a"
H'03: "r+"
H'04: "w+"
H'05: "a+"
H'10: "rb"
H'11: "wb"
H'12: "ab"
Rev. 1.0, 06/99, page 13 of 93
H'13: "r+b"
H'14: "w+b"
H'15: "a+b"
These modes are interpreted as follows.
"r": Open for reading.
"w": Open an empty file for writing.
"a": Open for appending (write starting at the end of the file).
"r+": Open for reading and writing.
"w+": Open an empty file for reading and writing.
"a+" : Open for reading and appending.
"b" : Open in binary mode.
• Start address of file name (input)
The start address of the area for storing the file name.

6 FCLOSE Closes a file


H'06

Parameter Block

One byte One byte


+0 Return value File number

Parameters

• Return value (output)


0: Normal completion
–1: Error
• File number (input)
The number returned when the file was opened.

Rev. 1.0, 06/99, page 14 of 93


7 FGETC Inputs one byte from a file
H'07, H'17, H'27

Parameter Block

• Function code: H'07 (for the 16-bit address)


One byte One byte
+0 Return value File number
+2 Input buffer start address

• Function code: H'17 (for the 24-bit address) or H'27 (for the 32-bit address)
One byte One byte
+0 Return value File number
+2
Input buffer start address
+4

Parameters

• Return value (output)


0: Normal completion
–1: EOF detected or error
• File number (input)
The number returned when the file was opened.
• Input buffer start address (input)
The start address of the buffer for storing input data.

Rev. 1.0, 06/99, page 15 of 93


8 FPUTC Outputs one byte to a file
H'08, H'18, H'28

Parameter Block

• Function code: H'08 (for the 16-bit address)


One byte One byte
+0 Return value File number
+2 Output buffer start address

• Function code: H'18 (for the 24-bit address) or H'28 (for the 32-bit address)
One byte One byte
+0 Return value File number
+2
Output buffer start address
+4

Parameters

• Return value (output)


0: Normal completion
–1: Error
• File number (input)
The number returned when the file was opened.
• Output buffer start address (input)
The start address of the buffer used for storing the output data.

Rev. 1.0, 06/99, page 16 of 93


9 FGETS Reads character string data from a file
H'09, H'19, H'29

Reads character string data from a file. Data is read until either a new line code or a NULL code is
read, or until the buffer is full.

Parameter Block

• Function code: H'09 (for the 16-bit address)


One byte One byte
+0 Return value File number

+2 Buffer size

+4 Input buffer start address

• Function code: H'19 (for the 24-bit address) or H'29 (for the 32-bit address)
One byte One byte
+0 Return value File number

+2 Buffer size

+4
Input buffer start address
+6

Parameters

• Return value (output)


0: Normal completion
–1: EOF detected or error
• File number (input)
The number returned when the file was opened.
• Buffer size (input)
The size of the area for storing the read data. A maximum of 256 bytes can be stored.
• Input buffer start address (input)
The start address of the buffer for storing input data.

Rev. 1.0, 06/99, page 17 of 93


10 FPUTS Writes character string data to a file
H'0A, H'1A, H'2A

Writes character string data to a file. The NULL code that terminates the character string is not
written to the file.

Parameter Block

• Function code: H'0A (for the 16-bit address)


One byte One byte
+0 Return value File number
+2 Output buffer start address

• Function code: H'1A (for the 24-bit address) or H'2A (for the 32-bit address)
One byte One byte
+0 Return value File number
+2
Output buffer start address
+4

Parameters

• Return value (output)


0: Normal completion
–1: Error
• File number (input)
The number returned when the file was opened.
• Output buffer start address (input)
The start address of the buffer used for storing the output data.

Rev. 1.0, 06/99, page 18 of 93


11 FEOF Checks for end of file
H'0B

Parameter Block

One byte One byte


+0 Return value File number

Parameters

• Return value (output)


0: File pointer is not at EOF
–1: EOF detected
• File number (input)
The number returned when the file was opened.

Rev. 1.0, 06/99, page 19 of 93


12 FSEEK Moves the file pointer to the specified position
H'0C

Parameter Block

One byte One byte


+0 Return value File number
+2 Direction Unused
+4 Offset (high-order word)
+6 Offset (low-order word)

Parameters

• Return value (output)


0: Normal completion
–1: Error
• File number (input)
The number returned when the file was opened.
• Direction (input)
0: The offset specifies the position as a byte count from the start of the file.
1: The offset specifies the position as a byte count from the current file pointer.
2: The offset specifies the position as a byte count from the end of the file.
• Offset (input)
The byte count from the location specified by the direction parameter.

Rev. 1.0, 06/99, page 20 of 93


13 FTELL Returns the current position of the file pointer
H'0D

Parameter Block

One byte One byte


+0 Return value File number

+2 Offset (high-order word)


+4 Offset (low-order word)

Parameters

• Return value (output)


0: Normal completion
–1: Error
• File number (input)
The number returned when the file was opened.
• Offset (output)
The current position of the file pointer, as a byte count from the start of the file.

The following shows an example for inputting one character as a standard input (from a keyboard)
for the 16-bit address.

MOV.W #H'0101,R0
MOV.W #PARM, R1
JSR @SYS_CALL
STOP NOP
SYS_CALL NOP
PARM .DATA.W INBUF
INBUF .RES.B 2
.END

Rev. 1.0, 06/99, page 21 of 93


2.9 Calculation of Instruction Execution Cycles
The simulator/debugger calculates the number of instruction execution cycles using the expression
H8/300 series programming manual and the data bus width and the number of access cycles
specified in the System Configuration dialog box. However, the defined in the H8S and resulting
number of execution cycles may differ from that for the actual user system because the number of
instruction execution cycles for some instructions and processing are treated as follows.

• MOVFPE and MOVTPE instructions


The number of data transfer cycles of an E-clock-synchronous instruction ranges from 9 to 16.
The simulator/debugger calculates the total number of instruction execution cycles by
assuming the number of data transfer cycles as 11, and adding the number of operand access
cycles to it. The number of operand access cycles is determined by the memory data bus width
and the number of memory access cycles.
• EEPMOV instruction
The number of execution cycles for an EEPROM write instruction is the sum of the instruction
read cycles and data transfer cycles.
• SLEEP instruction
The simulator/debugger does not count the number of execution cycles of the SLEEP
instruction because the instruction is usually used to stop program execution.
• Standard I/O and file I/O processing
The simulator/debugger does not count the number of execution cycles of standard I/O and file
I/O processing because the processing is specific to the simulator/debugger. Here, standard I/O
and file I/O processing begins when execution has jumped, due to the BSR or JSR instruction,
to an address specified in [System Call Address] and ends when execution has returned to the
subroutine call address.

Rev. 1.0, 06/99, page 22 of 93


2.10 Break Conditions
The simulator/debugger provides the following conditions for interrupting the simulation of a user
program during execution.

• Break due to the satisfaction of a break command condition


• Break due to the detection of an error during execution of the user program
• Break due to a trace buffer overflow
• Break due to execution of the SLEEP instruction
• Break due to clicking the [STOP] button

2.10.1 Break Due to the Satisfaction of a Break Command Condition

There are five break commands as follows:

• BREAKPOINT: Break based on the address of the instruction executed


• BREAK_ACCESS: Break based on access to a range of memory
• BREAK_DATA: Break based on the value of data written to memory
• BREAK_REGISTER: Break based on the value of data written to a register
• BREAK_SEQUENCE: Break based on a specified execution sequence

When a break condition is satisfied during user program execution, the instruction at the
breakpoint may or may not be executed before a break depending on the type of break, as listed in
table 2.4.

Table 2.4 Processing When a Break Condition is Satisfied

Command Instruction When a Break Condition is Satisfied


BREAKPOINT Not executed
BREAK_ACCESS Executed
BREAK_DATA Executed
BREAK_REGISTER Executed
BREAK_SEQUENCE Not executed

In BREAKPOINT and BREAK_SEQUENCE commands, if a breakpoint is specified at an address


other than the start address of the instruction, the break condition will not be detected.

When a break condition is satisfied during user program execution, a break condition satisfaction
message is displayed and execution stops.

Rev. 1.0, 06/99, page 23 of 93


2.10.2 Break Due to the Detection of an Error During Execution of the User Program

The simulator/debugger detects simulation errors, that is, program errors that cannot be detected
by the CPU exception generation functions. The System Configuration dialog box specifies
whether to stop or continue the simulation when such an error occurs. Table 2.5 shows the error
messages and causes of simulation errors, and the operation of the simulator/debugger when
simulation is to be continued.

Table 2.5 Simulation Errors

Processing in Continue
Error Message Error Cause Mode
Address Error A PC value was an odd number. Operates in the same way
An instruction was fetched from the internal I/O as the actual device.
area.
Word data was accessed to an odd-numbered
address.
Longword data was accessed to an odd-
numbered address.
Memory Access Error A memory area that had not been allocated Write access: Nothing is
was accessed. written to memory.
Data was written to a memory area having the Read access: All bits are
write protect attribute. read as 1.
Data was read from a memory area having the
read disable attribute.
A memory area in which memory does not exist
was accessed.
Data was written to EEPROM with an
instruction other than EEPMOV.
Illegal Instruction A code other than an instruction was executed. Always stops.
MOV.B Rn, @-SP or MOV.B @SP+, Rn was Continues operation; the
executed. result is not guaranteed.
Illegal Operation In the DAA or DAS instruction, relationship Continues operation; the
between the C and H flags of CCR, and their result is not guaranteed.
relation to the value before compensation were
incorrect.
Zero-division or overflow was caused by the
DIVXU or DIVXS instruction.

Rev. 1.0, 06/99, page 24 of 93


When a simulation error occurs in the stop mode, the simulator/debugger re-enters the command
input wait state after stopping instruction execution and displaying the error message. Table 2.6
lists the states of PC when simulation stops due to an error.

Table 2.6 Register States When Simulation Stops due to an Error

Error Message PC Value


Address Error or • When an instruction is read:
Memory Access The start address of the instruction that caused the error.
Error
• When an instruction is executed:
The instruction address following the instruction that caused the error.
Illegal Instruction The start address of the instruction that caused the error.
Illegal Operation The instruction address following the instruction that caused the error.

Use the following procedure when debugging programs which include instructions that generate
simulation errors.

1. Execute the program in the stop mode and confirm that there are no errors except those in the
intended locations.
2. After confirming the above, execute the program in the continue mode.

Note: If an error occurs and causes simulation to stop while in the stop mode, and
simulation is restarted after changing the simulator mode to the continue mode,
simulation may not be performed correctly. When restarting simulation, always
restore the register contents and the memory contents to the state prior to the
occurrence of the error.

2.10.3 Break Due to a Trace Buffer Full

After the [Break] mode is specified by [Trace buffer full handling] in the Trace Acquisition
dialog box, the simulator/debugger stops execution when the trace buffer becomes full. The
following message is displayed when execution is stopped.

Trace Buffer Full

2.10.4 Break Due to Execution of the SLEEP Instruction

When the SLEEP instruction is executed during instruction execution, the simulator/debugger
stops execution. The following message is displayed when execution is stopped.

Sleep

Rev. 1.0, 06/99, page 25 of 93


2.10.5 Break Due to the [STOP] Button

The user can forcibly terminate execution by pressing the [STOP] button during instruction
execution. The following message is displayed when execution is terminated.

Stop

Execution can be resumed with the GO or STEP command.

2.11 Floating-Point Data


Floating-point numbers can be displayed and input for the following real-number data, which
makes floating-point data processing easy.

• Data in the Set Break dialog box when [Break Data] or [Break Register] is selected as the
break type
• Data in the Memory window
• Data in the Fill Memory dialog box
• Data in the Search Memory dialog box
• Input data in the Register dialog box

The floating-point data format conforms to the ANSI C standard.

In the simulator/debugger, the rounding mode for floating-point decimal-to-binary conversion can
be selected in the System Configuration dialog box. One of the following two modes can be
selected:

• Round to nearest (RN)


• Round to zero (RZ)

If a denormalized number is specified for binary-to-decimal or decimal-to-binary conversion, it is


converted to zero in RZ mode, and it is left as a denormalized number in RN mode. If an overflow
occurs during decimal-to-binary conversion, the maximum floating-point value is returned in RZ
mode, and the infinity is returned in RN mode.

Rev. 1.0, 06/99, page 26 of 93


2.12 Display of Function Call History
The simulator/debugger displays the function call history in the Stack Trace window when
simulation stops, which makes program execution flow checking easy. Selecting a function name
from the Stack Trace window displays the corresponding source program in the Source window;
the function that has called the current function can also be checked.

The displayed function call history is updated in the following cases:

• When simulation stops under the break conditions described in section 2.10, Break Conditions.
• When register values are modified while simulation is halted due to the above break
conditions.
• While single-step execution is performed.

Note that the functions called after an interrupt are not displayed.

For details, refer to section 5.16, Stack Trace Window.

Rev. 1.0, 06/99, page 27 of 93


Rev. 1.0, 06/99, page 28 of 93
Section 3 Installation
For the simulator/debugger installation, refer to the supplied Hitachi Embedded Workshop
Installation Guide.

Rev. 1.0, 06/99, page 29 of 93


Rev. 1.0, 06/99, page 30 of 93
Section 4 Tutorial
The following describes a sample program debugging session, designed to introduce the main
features of the simulator/debugger used in conjunction with the Hitachi Debugging Interface
software.

4.1 Introduction
This sample program is based on a C program that first sorts ten random data items in ascending
order, then in descending order.

The sample program performs the following actions:

• With the main function, random data to be sorted is generated.


• With the sort function, an array is input, within which array the random data generated by
the main function is stored, and the data is sorted in ascending order.
• With the change function, the array generated by the sort function is input, and the data is
sorted in descending order.

The sample program is file Sort.c in the installation disk. A compiled version of the tutorial is
provided in the SYSROF format in file Sort.abs.

4.2 Running HDI


• To run the HDI Interface program, double-click the [HDI for Simulator] icon (figure 4.1).

Figure 4.1 Icon of HDI for Simulator

Rev. 1.0, 06/99, page 31 of 93


4.3 Selecting the Target Platform
The HDI can be extended to support multiple target platforms. If your system has more than one
platform installed, you will be prompted to choose a platform for the current session from the
Select Session dialog box (figure 4.2).

Figure 4.2 Select Session Dialog Box

• For this tutorial, select H8S/2600A Simulator and click the [OK] button to continue the
procedure.

Note that you can change the target platform at any time by choosing [New Session…] from the
[File] menu. If you have only one platform installed, this menu option will not be available.

When the simulator/debugger has been successfully set up, the Hitachi Debugging Interface
window will be displayed, with the message Link up in the status bar. Figure 4.3 shows the key
functions of the window:

Rev. 1.0, 06/99, page 32 of 93


Figure 4.3 Hitachi Debugging Interface Window

The following key functions of Hitachi Debugging Interface are described in detail in section 5.

Menu bar: Give you access to the HDI commands for using the HDI debugger.

Toolbar: Provides convenient buttons as shortcuts for the most frequently used menu
commands. Tool buttons from the same menu are displayed in the same block.
The tool buttons can be moved within the toolbar by clicking dragging them.
Whether to display the tool buttons can be selected by using the [Toolbar]
option in the [Customize] submenu in the [Setup] menu.

Source window: Displays the source of the program being debugged.

Status bar: Displays the status of the simulator/debugger, and progress information about
downloading.

Help button: Activates context sensitive help about any feature of the HDI user interface.

Rev. 1.0, 06/99, page 33 of 93


4.4 Mapping the Memory Resource
The next step is to map the memory resource used to operate an application being developed.

• Choose [Configure Map...] from the [Memory] menu to display the current memory mapping
(figure 4.4).

Figure 4.4 Memory Map Dialog Box

• Click the [Add] button to display the System Memory Resource Modify dialog box (figure
4.5).

Figure 4.5 System Memory Resource Modify Dialog Box

Rev. 1.0, 06/99, page 34 of 93


In the [Access type] box, you can specify one of the following three access types:
 Read: Read-only
 Write: Write-only
 Read/Write: Read and write
For this tutorial, map the memory area of addresses ranging from H'00000000 to H'00003FFF
as a read/write enabled area using the following procedure.
• Enter H'00000000 and H'00003FFF in the [Start address] and [End address] fields,
respectively, set the [Access type] as [Read/Write], and click the [OK] button.
The Memory Map dialog box will now show the modified ranges.
• Click the [Close] button to close the dialog box.

Rev. 1.0, 06/99, page 35 of 93


4.5 Downloading the Tutorial Program
• Choose [Load Program...] from the [File] menu to open the Load Program dialog box
(figure 4.6).
• Select file Sort.abs and click the [Open] button.

Figure 4.6 Load Program Dialog Box

• In [File name], enter the path for the directory where file Sort.abs is stored, or click the
[Browse...] button to open the Open dialog box and select the file Sort.abs and click the
[Open] button.

Figure 4.7 Open Dialog Box ([Load Program...])

• Click the [Open] button in the Load Program dialog box.


When the file has been loaded, the HDI dialog box displays information about the memory
areas that have been filled with the program code as shown in figure 4.8.

Rev. 1.0, 06/99, page 36 of 93


Figure 4.8 HDI Dialog Box

• Click the [OK] button to continue.

Rev. 1.0, 06/99, page 37 of 93


4.6 Displaying the Source Program
The HDI allows you to debug a program at the source level, so that you can see a listing of the C
program alongside the machine code as you debug. To do this, you need to read the C source file
that corresponds to the object file.

• Choose [Source...] from the [View] menu to open the Open dialog box (figure 4.9).

Figure 4.9 Open Dialog Box ([Source...])

• Select the C source file that corresponds to the object file you have loaded. Specifically, select
Sort.c and click the [Open] button to display the Source window (figure 4.10).

Rev. 1.0, 06/99, page 38 of 93


Figure 4.10 Source Window (Displaying the Source Program)

• If necessary, choose the [Font] option from the [Customise] submenu in the [Setup] menu to
choose a font and a font size suitable for your computer.

Initially, the Source window displays the beginning of the main program, but you can use the
scroll bar to scroll through the program to see the other statements.

Rev. 1.0, 06/99, page 39 of 93


4.7 Setting a PC Breakpoint
The Source window makes it easy to set a breakpoint anywhere in a program. For example, to set
a breakpoint at the sort function call:

• Double-click in the [BP] column on the line containing the sort function call (figure 4.11).

Figure 4.11 Source Window (Setting the Breakpoint)

The word • will be displayed on the line containing the sort function to show that a PC
breakpoint is set at that address.

Rev. 1.0, 06/99, page 40 of 93


4.8 Setting Trace Information Acquisition Conditions
• Choose [Trace] from the [View] menu to open the Trace window. Click the right mouse
button on the Trace window and choose [Acquisition] from the pop-up menu.
The following Trace Acquisition dialog box will be displayed.

Figure 4.12 Trace Acquisition Dialog Box

• Select [Enable] in [Trace start/Stop] in the Trace Acquisition dialog box and click the [OK]
button to enable the trace information acquisition.

Rev. 1.0, 06/99, page 41 of 93


4.9 Setting Performance Analysis
• Choose [Performance Analysis] from the [View] menu to open the Performance Analysis
window. Click the right mouse button on the Performance Analysis window and choose
[Add Range...] from the pop-up menu.
• The following Performance Option dialog box will be displayed.

Figure 4.13 Performance Option Dialog Box

• Set [Function Name] as sort in the Performance Option dialog box, and click the [OK]
button.
In the Performance Analysis window, sort is then set in [Function].

Figure 4.14 Performance Analysis Window (Setting)

• Click the right mouse button on the Performance Analysis window and choose [Analysis
Enabled] from the pop-up menu to activate the performance analysis information acquisition.
• Click [X] in the title bar to close the window.

Rev. 1.0, 06/99, page 42 of 93


4.10 Setting the Stack Pointer
Set the stack pointer to run the program using the following procedure.

• Choose [Registers] from the [View] menu to open the Registers window.
• Double-click the [Value] column of [ER7] in the Registers window (figure 4.15) to modify
the value of the stack pointer ER7.

Figure 4.15 Registers Window

• Enter H'4000 for the stack pointer value in this sample program and click the [OK] button.

Rev. 1.0, 06/99, page 43 of 93


4.11 Executing the Program
• Choose [Go] from the [Run] menu, or click the [Go] button (figure 4.16) on the toolbar to run
the program.

Figure 4.16 Go Button

The program will be executed up to the breakpoint you inserted. Then a statement will be
highlighted in the Source window to show that the program has halted at the statement, with
the message Break=PC Breakpoint in the status bar (figure 4.17).

Figure 4.17 Source Window (Break Status)

Rev. 1.0, 06/99, page 44 of 93


You can see the cause of termination in the System Status window (figure 4.18) using the
following procedure.

• Choose the [Status] button from the [View] menu to open the System Status window. Then
choose the [Platform] sheet in the System Status window.

Figure 4.18 System Status Window

This shows the following execution results:


(1) The cause of the break was a PC Break Pointpoint.
(2) Execution started from the instruction execution reset.
(3) The number of instructions executed from the instruction execution reset was 709.
(4) The number of cycles executed from the instruction execution reset was 7395.

Rev. 1.0, 06/99, page 45 of 93


You can also see the value of each register in the Registers window (figure 4.19) using the
following procedure.

• Choose [Registers] from the [View] menu.

Figure 4.19 Registers Window

Rev. 1.0, 06/99, page 46 of 93


4.12 Using the Trace Buffer
The trace buffer allows you to look back over previous execution cycles to see what accesses took
place.

• Choose [Trace] from the [View] menu to open the Trace window (figure 4.20). Scroll up the
window so that you can see the first few cycles.
• If necessary, choose the [Font] option from the [Customise] submenu in the [Setup] menu to
choose a font and a font size suitable for your computer.

Figure 4.20 Trace Window (Displaying Trace Information)

You can see that execution started at address 0, the start of the main function.

Rev. 1.0, 06/99, page 47 of 93


4.13 Searching the Trace Buffer
• Click the right mouse button on the Trace window and choose [Find...] from the pop-up menu
to open the Trace Search dialog box (figure 4.21).

Figure 4.21 Trace Search Dialog Box

• Select the search item in [Item], enter the search contents in [Value], and click the [OK]
button to execute a trace search. When the corresponding trace information is found, the first
line of the information is highlighted (figure 4.22). When continuing trace search with the
same contents, click the right mouse button on the Trace window and choose [Find Next]
from the pop-up menu. The next corresponding line is highlighted.

Figure 4.22 Trace Window (Search Results)

Rev. 1.0, 06/99, page 48 of 93


4.14 Reviewing Breakpoints
You can see a list of all the breakpoints set in the program in the Breakpoints window (figure
4.23) using the following procedure.

• Choose [Breakpoints] from the [View] menu.

Figure 4.23 Breakpoints Window

The Breakpoints window also allows you to enable or disable breakpoints, define new
breakpoints, and delete breakpoints.

• Close the Breakpoints window.

Rev. 1.0, 06/99, page 49 of 93


4.15 Viewing Memory
You can view the contents of a memory block in the Memory window. For example, to view the
memory corresponding to array main in word size:

• Choose [Memory…] from the [View] menu to display the Open Memory Window dialog
box (figure 4.24), enter main in the [Address] field, and select Word for [Format].

Figure 4.24 Open Memory Window Dialog Box

• Click the [OK] button to open the Word Memory window showing the specified area of
memory (figure 4.25).

Figure 4.25 Word Memory Window

Rev. 1.0, 06/99, page 50 of 93


4.16 Watching Variables
As you step through a program, it is possible to watch the values of variables used in your
program and to verify that they change in the way that you expected. For example, you can watch
long-type array a, which is declared at the beginning of the program, by using the following
procedure:

• Click to position the cursor to the left of a in the Source window.


• Click in the Source window with the right mouse button to display a pop-up menu and choose
[Instant Watch...].
The Instant Watch dialog box will be displayed (figure 4.26).

Figure 4.26 Instant Watch Dialog Box

• Click [Add Watch] to add a variable to the Watch window (figure 4.27).

Figure 4.27 Watch Window (Displaying the Array)

Rev. 1.0, 06/99, page 51 of 93


You can also add a variable to the Watch window by specifying its name as follows.

• Click the right mouse button on the Watch window to display a pop-up menu and choose
[Add Watch...].
The Add Watch dialog box appears (figure 4.28).

Figure 4.28 Add Watch Dialog Box

• Enter variable max and click the [OK] button.


The Watch window will display long-type variable max (figure 4.29).

Figure 4.29 Watch Window (Displaying the Variable)

• You can double-click the + symbol to the left of array “a” in the Watch window to expand the
variable and show the individual elements in the array.

Rev. 1.0, 06/99, page 52 of 93


Figure 4.30 Watch Window (Displaying Array Elements)

Rev. 1.0, 06/99, page 53 of 93


4.17 Stepping Through a Program
The simulator/debugger provides a range of step menu commands that allow efficient program
debugging.

Table 4.1 Step Menu Commands

Menu Command Description


Step In Executes every statement, including statements within functions.
Step Over Executes a function call in a single step.
Step Out Exits a function and stops at the statement following the statement that
called the function in the program.
Step… Steps the specified number of times at a specified rate.

• To demonstrate program stepping, confirm that the sort function statement at address
H’00000066 has been executed (figure 4.31).

Figure 4.31 Source Window (Stepping)

Clicking the [◊] button in the title bar of the Watch window automatically places the Watch
window next to the Source window as shown in figure 4.31.
Rev. 1.0, 06/99, page 54 of 93
4.17.1 Executing [Step In]

The [Step In] command steps into the called function and stops at the first statement of the called
function.

• To step into the sort function, choose [Step In] command from the [Run] menu, or click the
[Step In] button in the toolbar (figure 4.32).

Figure 4.32 Step In Button

The highlighted line moves to the first statement of the sort function in the Source window
(figure 4.33).

Figure 4.33 Source Window (Step In)

Rev. 1.0, 06/99, page 55 of 93


4.17.2 Executing [Step Out]

The [Step Out] command exits the called function and stops at the next statement in the calling
program.

• To step out of the sort function, choose [Step Out] command from the [Run] menu, or click
the [Step Out] button in the toolbar (figure 4.34).

Figure 4.34 Step Out Button

The data of variable a displayed in the Watch window is sorted in ascending order (figure
4.35).

Figure 4.35 Source Window (Step Out)

• The data of variable “a” displayed in the Watch window is sorted in ascending order. In the
Watch window, the values of the modified variables are shown in red.
• To execute two steps, use [Step In].

Rev. 1.0, 06/99, page 56 of 93


Figure 4.36 Source Window (Step Out •• Step In)

• The value of max displayed in the Watch window is modified to the maximum data value
(figure 4.36).

Rev. 1.0, 06/99, page 57 of 93


4.17.3 Executing [Step Over]

The [Step Over] command executes a function call as a single step and stops at the next statement
in the main program.

• To demonstrate [Step Over] command, execute two steps to reach the change function
statement (figure 4.37).

Figure 4.37 Source Window (Before Step Over Execution)

• To step through all statements in the change function at a single step, choose [Step Over]
command from the [Run] menu, or click the [Step Over] button in the toolbar (figure 4.38).

Figure 4.38 Step Over Button

When the last statement of the change function is executed, the data of variable a, which is
displayed in the Watch window, is sorted in descending order (figure 4.39).

Rev. 1.0, 06/99, page 58 of 93


Figure 4.39 Source Window (Step Over)

When the last statement of the change function is executed, the data of variable “a”, which is
displayed in the Watch window, is sorted in descending order.

Rev. 1.0, 06/99, page 59 of 93


4.18 Displaying Local Variables
You can display the local variables in a function using the Locals window. For example, we will
examine the local variables in the main function, which declares five local variables: a, j, i,
min, and max.

• Open the Locals window by choosing [Locals] from the [View] menu.
Initially, the Locals window displays nothing because local variables have not yet been
declared.
• Choose [Step In] from the [Run] menu to execute a single step.
The Locals window will display the local variables and their values (figure 4.40).

Figure 4.40 Locals Window

• Double-click the + symbol in front of array a in the Locals window to display the separate
elements of array a.
• Refer to the elements of array a before and after executing the sort function, and confirm
that random data is sorted in ascending or descending order.

Rev. 1.0, 06/99, page 60 of 93


4.19 Reviewing the Performance Analysis
You can review the results of the performance analysis for functions in the Performance Analysis
window (figure 4.41) using the following procedure.

• Choose [Performance Analysis] from the [View] menu.

Figure 4.41 Performance Analysis Window (Reviewing)

In this window, [Cycle] shows the total number of execution cycles required for the
sortfunction, and [%] shows the ratio of execution cycle count required for the function to the
execution cycle count required for the whole program.

The Performance Analysis window allows you to enable or disable the performance analysis,
define new functions for performance analysis, or delete functions.

• Close the Performance Analysis window.

4.20 Saving the Session


Before exiting, it is a good practice to save your session, so that you can resume with the same
conditions in your next debugging session.

• Choose [Save Session] from the [File] menu.


• Choose [Exit] from the [File] menu to exit from the HDI.

Rev. 1.0, 06/99, page 61 of 93


Rev. 1.0, 06/99, page 62 of 93
Section 5 Windows and Dialog Boxes
Table 5.1 lists the menu bars and pull-down menus of the Hitachi Debugging Interface window.
Note, however, that [Localized Dump] is supported only in the Japanese environment. Control
Register are supported only by the H8S/2600 series. In table 5.1, the O mark shows that the menu
is described in the Hitachi Debugging Interface User's Manual, and the number indicates the
corresponding section(s) in this manual.

Table 5.1 HDI Window Menus and Corresponding Manuals

Menu Bar Pull-Down Menu HDI Manual Sections in This Manual


File New Session... O 2.1, 4.3
Load Session... O —
Save Session O 4.20
Save Session As... O —
Load Program... O 4.5
Initialise O —
Exit O 4.20
Edit Cut O —
Copy O —
Paste O —
Find... O —
Evaluate... O —
View Breakpoints O 4.14, 5.1
Command Line O —
Disassembly... O —
I/O Area O —
Labels O —
Locals O 4.18
Memory... O 2.11, 4.15
Performance Analysis O 4.9, 4.19, 5.8
Registers O 2.11, 4.10, 4.11
Source... O 4.6, 4.7, 4.11, 4.16, 4.17
Status O 4.11
Trace O 2.7, 4.8, 4.12, 4.13, 5.10

Rev. 1.0, 06/99, page 63 of 93


Table 5.1 HDI Window Menus and Corresponding Manuals (cont)

Menu Bar Pull-Down Menu HDI Manual Sections in This Manual


View Watch O 4.16, 4.17
Localized Dump... — —
Simulated I/O — 2.8, 5.15
Control Register — 2.6, 5.13
Stack Trace — 2.12, 5.16
Run Reset CPU O —
Go O 4.11
Reset Go O —
Go to Cursor O —
Set PC to Cursor O —
Run... O —
Step In O 4.17
Step Over O 4.17
Step Out O 4.17
Step... O 4.17
Halt O —
Memory Refresh O —
Load... O —
Save... O —
Verify... O —
Test... O —
Fill... O 2.11
Copy... O —
Compare... O —
Configure Map... O 4.4, 5.6
Configure Overlay... O —

Rev. 1.0, 06/99, page 64 of 93


Table 5.1 HDI Window Menus and Corresponding Manuals (cont)

Menu Bar Pull-Down Menu HDI Manual Sections in This Manual


Setup Status bar O 4.3, 4.11
Options... O —
Radix (Input) O —
Customise O 4.3, 4.6, 4.12
Configure Platform... O 2.2, 2.5, 2.6, 2.8, 2.9, 2.10, 5.4
Window Cascade O —
Tile O —
Arrange Icons O —
Close All O —
Help Index O —
Using Help O —
Search for Help on O —
About HDI O —

This section describes windows and dialog boxes displayed by the simulator/debugger of H8S and
H8/300 series microprocessors.

5.1 Breakpoints Window

Figure 5.1 Breakpoints Window

Rev. 1.0, 06/99, page 65 of 93


This window displays all of the specified breakpoints. The following items are displayed.

[Enable] Displays whether the breakpoint is enabled or disabled. Breakpoints with • are
enabled.

[File/Line] Displays file names and line numbers where breakpoints are specified.

[Symbol] Displays symbols that correspond to breakpoint setting addresses. When no


symbol exists, nothing is displayed.

[Address] Displays addresses where breakpoints are specified.

[Type] Displays break types.


BP: PC break
BA: Break access
BD: Break data
BR: Break register (A register name is parenthesized.)
BS: Break sequence

Clicking anywhere in the Breakpoints window with the right mouse button displays the following
pop-up menu:

[Add...] Sets breakpoints. Clicking this button will open the Set Break dialog box and
break conditions can be specified.

[Edit...] Edits breakpoints. Select breakpoints to be edited and click this button. The Set
Break dialog box will open and break conditions can be changed.
Note that if a break sequence is selected for editing, the Break Sequence dialog
box will open.

[Disable] Reverses the enable/disable status of a breakpoint. Select breakpoints to be


([Enable]) modified and click this button.

[Delete] Deletes specified breakpoints. Select breakpoints to be deleted and click this
button.

[Delete All] Deletes all breakpoints.

[Go to Source] Displays source code. After selecting the breakpoint to display in the
Breakpoints window, click the menu to open the Source window or
Disassembly window.
The line with the selected breakpoint will then be indicated by the cursor.

[Help] Displays help information.

Rev. 1.0, 06/99, page 66 of 93


5.2 Set Break Dialog Box

Figure 5.2 Set Break Dialog Box

This dialog box specifies break conditions.

A break type is specified using the radio buttons in the [Type] box. Items that can be specified for
each break type are listed below.

[PC Breakpoint] [Start address] Start address where a break occurs


[Count] Number of times a specified instruction is fetched (Default is
1.)

[Break Access] [Start address] Start address of memory where a break occurs if the memory
is accessed
[End address] End address of memory where a break occurs if the memory is
accessed (If no data is input, only the start address is
specified.)
[Access type] Read, Write, or Read/Write (Default is Read/Write)

Rev. 1.0, 06/99, page 67 of 93


[Break Data] [Start address] Start address of memory where the simulator/debugger checks
if the data matches the condition
[Data] Data value that generates a break
[Size] Data size (Default is byte)
[Option] Match or unmatch of data (Default is match)

[Break Register] [Register] Register name where break conditions are specified
[Data] Data value that causes a break (If no data is input, a break
occurs whenever data is written to the register.)
[Size] Data size (Default is byte)
[Option] Match or unmatch of data (Default is match)

Note that when [Break Sequence] is selected under [Type], the Break Sequence dialog box
opens.

When [PC Breakpoint] is selected, if an overloaded function or class name including a member
function is specified in [Start Address], the Select Function dialog box opens. In the dialog box,
select a function. For details, refer to the Hitachi Debugging Interface User's Manual.

After specifying each item, click the [OK] button. Break conditions will be specified. Clicking the
[Cancel] button closes this dialog box.

Rev. 1.0, 06/99, page 68 of 93


5.3 Break Sequence Dialog Box

Figure 5.3 Break Sequence Dialog Box

This dialog box specifies pass addresses for break conditions.

Specify addresses in [Address1] to [Address8]. Not all eight addresses need to be specified.
When an overloaded function or a class name including a member function is specified as a pass
address, the Select Function dialog box will open; select the function name in the dialog box. For
details, refer to the HDI User's Manual.

Clicking the [OK] button sets the pass addresses. Clicking the [Cancel] button closes this dialog
box without adding a new pass address.

Rev. 1.0, 06/99, page 69 of 93


5.4 System Configuration Dialog Box

Figure 5.4 System Configuration Dialog Box

This dialog box specifies the address space bit size, program area bit size, SYSCR address, system
call start address, execution mode, floating-point rounding mode, and memory map of the
simulator/debugger.

[CPU] Displays the CPU name. The CPU must be specified in the Select Session dialog box.

[Address Space Bit Size]


Specifies the bit size of the address space. Available bit size depends on the CPU as
follows:
H8/300, H8/300L, H8/300HN, H8S/2600N, H8S/2000N: 16 bits
H8/300HA: 17 to 24 bits
H8S/2600A, H8S/2000A: 17 to 32 bits

[Program Area Bit Size]


Specifies the bit size of the program area. Available bit size depends on the CPU as
follows:
H8/300, H8/300L, H8/300HN, H8S/2600N, H8S/2000N: 16 bits
H8/300HA: 17 to 24 bits (same as the address space bit size)
H8S/2600A, H8S/2000A: 17 to 24 bits

Rev. 1.0, 06/99, page 70 of 93


[System Call Address]
Specifies the start address of a system call that inputs or outputs characters to the
standard input/output device from the user system.
[Enable] Specifies whether the system call is enabled or disabled.

[Execution Mode]
Specifies whether the simulator/debugger stops or continues operating when a
simulation error occurs.
[Stop] Stops the simulation when an error occurs.
[Continue] Continues the simulation when an error occurs.

[Round Mode]
Specifies the rounding mode for floating-point decimal-to-binary conversion.
[Round to nearest] Rounds to the nearest value.
[Round to zero] Rounds toward zero.

In the [Memory Map], the start address, end address, memory type, data bus width, and access
cycles are displayed. [Memory Map] can be specified, modified, or deleted by using the
following buttons:

[Add] Specifies [Memory Map] items. Clicking this button opens the Memory Map
Modify dialog box, and memory map items can be specified.

[Modify] Modifies [Memory Map] items. Select an item to be modified in the list box and
click this button. The Memory Map Modify dialog box will open and memory map
items can be modified.

[Delete] Deletes [Memory Map] items. Select an item to be deleted in the list box and click
this button.

For the H8S/2600 series, the address of the system control register (SYSCR) can be specified in
[SYSCR Address]. Specify an address within the internal I/O.

Clicking the [OK] button stores the modified settings. Clicking the [Cancel] button closes this
dialog box without modifying the settings.

Rev. 1.0, 06/99, page 71 of 93


5.5 Memory Map Modify Dialog Box

Figure 5.5 Memory Map Modify Dialog Box

This dialog box specifies the memory map of the target CPU of the simulator/debugger.

The contents displayed in this dialog box depend on the target CPU. The specified data is used to
calculate the number of cycles for memory access.

[Memory type] Memory type


[Start address] Start address of the memory
[End address] End address of the memory
[State count] Number of memory access cycles
[Data bus size] Memory data bus width

After specifying each item, click the [OK] button to make the setting effective. Clicking the
[Cancel] button closes this dialog box.

Rev. 1.0, 06/99, page 72 of 93


5.6 Memory Map Dialog Box

Figure 5.6 Memory Map Dialog Box

This dialog box displays a memory map and information on the target CPU.

[System Configuration] Displays the target CPU, address space bit size, program area bit
size, and execution mode of the simulator/debugger.

[System memory resource] Displays the access type, start address, and end address of the
current memory.

[Memory map] Displays the start address, end address, memory type, data bus
width, and access cycles.

[System memory resource] can be specified, modified, and deleted using the following buttons:

[Add] Specifies [System memory resource] items. Clicking this button opens the System
Memory Resource Modify dialog box, and [System memory resource] items can be
specified.

[Modify] Modifies [System memory resource] items. Select an item to be modified in the list
box and click the Modify button. The System Memory Resource Modify dialog box
opens and [System memory resource] items can be modified.

Rev. 1.0, 06/99, page 73 of 93


[Delete] Deletes [System memory resource] items. Select an item to be deleted in the list box
and click this button.

Note that the [Reset] button can reset the [Memory map] and [System memory resource] to the
default value. Clicking the [Close] button closes this dialog box.

5.7 System Memory Resource Modify Dialog Box

Figure 5.7 System Memory Resource Modify Dialog Box

This dialog box specifies or modifies system memory settings.

[Start address] Start address of the memory area to be allocated

[End address] End address of the memory area to be allocated

[Access type] Access type


Read: Read only
Write: Write only
Read/Write: Read and write

Click the [OK] button after specifying the [Start address], [End address], and [Access type].
Clicking the [Cancel] button closes this dialog box without modifying the setting.

Rev. 1.0, 06/99, page 74 of 93


5.8 Performance Analysis Window

Figure 5.8 Performance Analysis Window

This window displays the number of execution cycles required for the specified functions.

The number of execution cycles can be obtained from the difference between the total number of
execution cycles when the target function is called and that when execution returns from the
function.

The following items are displayed:

[Index] Index number of the condition that is set

[Function] Name or start address of the function to be evaluated

[Cycle] Total number of execution cycles required for the function

[Count] Total number of calls for the function

[%] Ratio of execution cycle count required for the function to the execution cycle count
required for the whole program

[Histogram] Histogram display of the above ratio

Click the right mouse button on the Performance Analysis window to display the pop-up menu.
Here, functions to be evaluated can be added, modified, deleted, or reset using the following
buttons. Up to 255 functions can be specified.

[Add Range...] Adds functions to be evaluated. Clicking this button opens the
Performance Option dialog box, and functions can be added.

Rev. 1.0, 06/99, page 75 of 93


[Edit Range...] Modifies functions to be evaluated. Select a function to be modified in the
list box and click this button. The Performance Option dialog box opens
and the function can be modified.

[Reset Counts/Times] Resets performance analysis information.

[Analysis Enabled] Reverses the stop/restart status of the performance analysis. When
evaluation starts, a check mark will appear to the left of this menu item.

[Delete Range] Deletes functions to be evaluated. Select a function to be deleted in the


list box and click this button.

[Del All Ranges] Deletes all functions to be evaluated.

Double-clicking a function to be evaluated displays the Performance Option dialog box. In this
dialog box, functions can be modified.

5.9 Performance Option Dialog Box

Figure 5.9 Performance Option Dialog Box

This dialog box specifies functions (including labels) to be evaluated. Evaluation results will be
displayed in the Performance Analysis window.

Note that when an overloaded function or a class name including a member function is specified,
the Select Function dialog box will open. In the dialog box, select a function. For details, refer to
the Hitachi Debugging Interface User's Manual.

Clicking the [OK] button stores the setting. Clicking the [Cancel] button closes this dialog box
without setting the function to be evaluated.

Rev. 1.0, 06/99, page 76 of 93


5.10 Trace Window
This window displays trace information. The displayed information items depend on the target
CPU. The trace acquisition conditions can be specified in the Trace Acquisition dialog box.

Figure 5.10 Trace Window

This window displays the following trace information items:

[PTR] Pointer in the trace buffer (The last executed instruction will be 0)

[CYCLE] Total number of instruction execution cycles (cleared when the PC value
changes)

[ADDR] Instruction address

[CCR] Contents of the condition code register (CCR) (mnemonic display)

[MULT] Flags of internal multiplier (mnemonic display, only for H8S/2600 series)

[INSTRUCTION] Instruction mnemonic and data access (displayed in the form of [Transfer
destination <− Transfer data])

[Source] C/C++ or assembly-language source programs

The pop-up menus can be displayed by clicking the Trace window with the right mouse button.
The window has the following pop-up menus.

[Find...] Searches trace information. Clicking this button opens the Trace Search dialog
box, and search conditions can be specified.

[Find Next] Searches trace information for the next occurrence of the item specified by
[Find...].

[Filter...] Not supported by this simulator/debugger.


Rev. 1.0, 06/99, page 77 of 93
[Acquisition...] Specifies the conditions of trace information acquisition. Clicking this button
opens the Trace Acquisition dialog box, and acquisition conditions can be
specified.

[Halt] Not supported by this simulator/debugger.

[Restart] Not supported by this simulator/debugger.

[Snapshot] Not supported by this simulator/debugger.

[Clear] Clears the contents in the trace buffer.

[Save...] Saves trace information into a file.

[View Source] Displays source code. After selecting the line to display in the Trace window,
click the menu to open the Source window or Disassembly window.
The line with the selected breakpoint will then be indicated by the cursor.

[Trim Source] Selects whether to left-justify the [Source] items. If the [Source] items are left-
justified, a check mark will appear to the left of this menu item.

Double-clicking a line in the Trace window opens the Source window or Disassembly window.
In the window, the source code is displayed and the selected line is indicated by the cursor.

Rev. 1.0, 06/99, page 78 of 93


5.11 Trace Acquisition Dialog Box

Figure 5.11 Trace Acquisition Dialog Box

This dialog box specifies the conditions for acquiring trace information.

[Trace start/Stop]
[Disable] Stops trace information acquisition.
[Enable] Starts trace information acquisition.

[Instruction type]
[Instruction] Acquires trace information for all instructions.
[Subroutine] Acquires trace information for the subroutine instructions only.

[Trace buffer full handling]


[Continue] Continues acquiring trace information even if the trace information
acquisition buffer becomes full.
[Break] Stops execution when the trace information acquisition buffer becomes full.

Clicking the [OK] button stores the settings. Clicking the [Cancel] button closes this dialog box
without modifying the settings.

Rev. 1.0, 06/99, page 79 of 93


5.12 Trace Search Dialog Box

Figure 5.12 Trace Search Dialog Box

This dialog box specifies the conditions for searching trace information. Specify a search item in
[Item], and the contents in [Value] will be searched for.

[PTR] Pointer in the trace buffer (The last executed instruction will be 0. Specify in the
form of -nnn.)

[Cycle] Total number of instruction execution cycles

[Address] Instruction address

[Instruction] Instruction mnemonic

Clicking the [OK] button stores the settings. Clicking the [Cancel] button closes this dialog box
without searching.

Rev. 1.0, 06/99, page 80 of 93


5.13 Control Registers Window

Figure 5.13 Control Registers Window

This window displays the following control register value. Note that this window is available only
for the H8S/2600 series.

[SYSCR] System control register

The control register value can be directly modified in the window. Double-clicking the register
opens the SYSCR dialog box. In this dialog box, the register value can be modified in bit units.

Rev. 1.0, 06/99, page 81 of 93


5.14 SYSCR Dialog Box

Figure 5.14 SYSCR Dialog Box

This dialog box sets the value of the SYSCR register (system control register). Note that this
dialog box is available only for the H8S/2600 series.

The following items are set:

[MACS bit] Selects saturation operation or non-saturation operation for the multiply and
accumulate operation (MAC instruction). Checking this item selects the saturation
operation.

[EXR bit] Enables or disables the EXR register. Checking this item enables the EXR register.

Clicking the [OK] button sets modified values in the memory. Clicking the [Cancel] button closes
this dialog box.

Rev. 1.0, 06/99, page 82 of 93


5.15 Simulated I/O Window

Figure 5.15 Simulated I/O Window

This window is for standard I/O and file I/O system calls from the user program.

Clicking the right mouse button on the Simulated I/O window displays the following pop-up
menus.
®
[Copy] Copies the highlighted text to the Windows clipboard so that the text can be
pasted to another application.
®
[Paste] Pastes the text from the Windows clipboard to the Simulated I/O window.

[Clear Window] Clears the contents of the Simulated I/O window.

For the I/O processing, refer to section 2.8, Standard I/O and File I/O Processing.

Rev. 1.0, 06/99, page 83 of 93


5.16 Stack Trace Window

Figure 5.16 Stack Trace Window

This window displays the function call history except the functions called after an interrupt.

Selecting a displayed function and clicking the [Go To] button, or double-clicking a displayed
function displays the corresponding source program in the Source window.

Rev. 1.0, 06/99, page 84 of 93


Section 6 Simulator/Debugger Commands
This section describes the commands specialized for the simulator/debugger. For other commands,
refer to the Hitachi Debugging Interface User's Manual.

Table 6.1 lists the simulator/debugger commands.

Table 6.1 Simulator/Debugger Commands

Command Name Abbreviation Function


BREAKPOINT BP Sets a breakpoint at an instruction address
BREAK_ACCESS BA Specifies a memory range access for a break condition
BREAK_CLEAR BC Deletes breakpoints
BREAK_DATA BD Specifies a memory data value for a break condition
BREAK_DISPLAY BI Displays a list of breakpoints
BREAK_ENABLE BE Enables or disables a breakpoint
BREAK_REGISTER BR Specifies register data for a break condition
BREAK_SEQUENCE BS Sets sequential breakpoints at instruction addresses
MAP_SET MS Allocates a memory area
TRACE_ACQUISITION TA Enables or disables trace information acquisition
ANALYSIS_RANGE AR Specifies or displays functions for performance analysis

Details of each command are provided in the format shown in figure 6.1.

6.1 BREAKPOINT [BP] Sets a breakpoint at an instruction address


(1) (2) (3)

Syntax: (4)

Parameters: (5)

Examples: (6)

Figure 6.1 Command Description Format

(1) Command name


(2) Abbreviated command name
(3) Command function
(4) Command input syntax
∆: Indicates one or more spaces or tabs
[A]: Indicates that A can be omitted.

Rev. 1.0, 06/99, page 85 of 93


(5) Command parameters
(6) Command usage examples

Rev. 1.0, 06/99, page 86 of 93


6.1 BREAKPOINT [BP] Sets a breakpoint at an instruction address

Syntax: BREAKPOINT∆address[∆count]

Parameters: address The address of a breakpoint

count The number of times the instruction at the specified address is to


be fetched. Default is 1.

Examples: BREAKPOINT 0 2 A break occurs when an attempt is made to


execute the instruction at address H’0 for the
second time.

BP C0 A break occurs when an attempt is made to


execute the instruction at address H’C0.

6.2 BREAK_ACCESS [BA] Specifies a memory range access as a break


condition

Syntax: BREAK_ACCESS∆start address[∆end address] [∆access type]

Parameters: start address The start address of the break memory range, to which access stops
program execution

end address The end address of the break memory range, to which access stops
program execution. If omitted, the end address is assumed to be the
same as the start address.

access type Access type


R: A break occurs when the range is read.
W: A break occurs when the range is written to.
RW: A break occurs when the range is read or written to
(default).

Examples: BREAK_ACCESS 0 1000 W A break occurs when data is written to a memory


range from address H’0 to address H’1000.

BA FFFF A break occurs when address H’FFFF is


accessed.

Rev. 1.0, 06/99, page 87 of 93


6.3 BREAK_CLEAR [BC] Cancels breakpoints

Syntax: BREAK_CLEAR [∆index]

Parameters: index Index of the breakpoint to be canceled. If the index is omitted, all
breakpoints are canceled.

Examples: BREAK_CLEAR 0 The first breakpoint is canceled.

BC All breakpoints are canceled.

6.4 BREAK_DATA [BD] Specifies a memory data value as a break


condition

Syntax: BREAK_DATA∆address∆data [∆size] [∆option]

Parameters: address The address where the break condition is checked

data Access data

size Data size


B: Byte (default)
W: Word
L: Longword
S: Single-precision floating-point data
D: Double-precision floating-point data

option Match or unmatch of data


EQ: A break occurs when the data matches the specified
value (default).
NE: A break occurs when the data does not match the
specified value.

Examples: BREAK_DATA 0 100 L EQ A break occurs when 100 is written to memory


address H’0 in longword.

BD C0 FF B NE A break occurs when a value other than FF is


written to memory address H’C0 in byte.

BD 4000 10 A break occurs when 10 is written to memory


address H’4000 in byte.

Rev. 1.0, 06/99, page 88 of 93


6.5 BREAK_DISPLAY [BI] Displays a list of breakpoints

Syntax: BREAK_DISPLAY

Examples: BREAK_DISPLAY A list of breakpoints is displayed.

6.6 BREAK_ENABLE [BE] Enables or disables a breakpoint

Syntax: BREAK_ENABLE ∆enable/disable flag [∆index]

Parameters: enable/disable flag Enabling or disabling of a breakpoint


E: Enable
D: Disable

index Index of a breakpoint. If the index is omitted, all


breakpoints are enabled or disabled.

Examples: BREAK_ENABLE D 0 The first breakpoint is disabled.

BE E All breakpoints are enabled.

Rev. 1.0, 06/99, page 89 of 93


6.7 BREAK_REGISTER [BR] Specifies register data as a break condition

Syntax: BREAK_REGISTER ∆register name [∆data∆size] [∆access type]

Parameters: register name Register name

data Data for a break condition


If no data is specified, a break occurs when any value is written to
the specified register.

size Access size


B: Byte
W: Word
L: Longword
S: Single-precision floating-point data
If no size is specified, the size of the specified register is assumed.
Note that when data is specified, the size must not be omitted.

access type Match or unmatch of data


EQ: A break occurs when the data matches the specified
value (default).
NE: A break occurs when the data does not match the
specified value.

Examples: BREAK_REGISTER R0 FFFF W EQ A break occurs when the low-order two


bytes of the R0 register change to FFFF.

BR R10 A break occurs when data is written to


the R10 register.

6.8 BREAK_SEQUENCE [BS] Sets sequential breakpoints

Syntax: BREAK_SEQUENCE ∆address1 [∆address2 [∆address3 [...] ] ]

Parameters: address1–address8 Addresses of sequential breakpoints. Up to eight addresses


can be specified.

Examples: BREAK_SEQUENCE 1000 2000 A break occurs when addresses H’1000


and H’2000 are passed sequentially.

BS 1000 A break occurs when address H’1000 is


executed.

Rev. 1.0, 06/99, page 90 of 93


6.9 MAP_SET [MS] Allocates a memory area

Syntax: MAP_SET ∆start address [∆end address] [∆access type]

Parameters: start address Start address of a memory area

end address End address of a memory area. If omitted, the end address
is assumed to be the same as the start address.

access type Access type


R: Read
W: Write
RW: Read/write (default)

Examples: MAP_SET 0000 3FFF RW Addresses H’0000 to H’3FFF are allocated to a


read/write-enabled area.

MS 5000 Address H’5000 is allocated to a read/write-


enabled area.

6.10 TRACE_ACQUISITION [TA] Enables or disables trace information


acquisition

Syntax: TRACE_ACQUISITION ∆enable/disable flag

Parameters: enable/disable flag Enables or disables trace information acquisition


E: Trace information acquisition is enabled.
D: Trace information acquisition is disabled.

Examples: TRACE_ACQUISITION E Trace information acquisition is enabled.

TA D Trace information acquisition is disabled.

6.11 ANALYSIS_RANGE [AR] Specifies or displays functions for


performance analysis

Syntax: ANALYSIS_RANGE [∆function]

Parameters: function Function to be evaluated. If omitted, the function that is currently


specified is assumed.

Examples: ANALYSIS_RANGE sort The sort function is specified to be evaluated.

AR The function that is currently specified is


displayed.
Rev. 1.0, 06/99, page 91 of 93
Section 7 Messages

7.1 Information Messages


The simulator/debugger outputs information messages as listed in table 7.1 to notify users of
execution status.

Table 7.1 Information Messages

Message Contents
Break Access The break access condition was satisfied and execution has stopped.
Break Data The break data condition was satisfied and execution has stopped.
PC Breakpoint The breakpoint condition was satisfied and execution has stopped.
Break Register The break register condition was satisfied and execution has stopped.
Break Sequence The break sequence condition was satisfied and execution has stopped.
Stop Execution has been stopped by the [STOP] button.
Sleep Execution has been stopped by the SLEEP instruction.
Step Normal End The step execution was normally completed.
Trace Buffer Full The Break mode was selected by Trace buffer full handling in the Trace
Acquisition dialog box and the trace buffer became full. As a result,
execution has stopped.

Rev. 1.0, 06/99, page 92 of 93


7.2 Error Messages
The simulator/debugger outputs error messages to notify users of the errors of user programs or
operation. Table 7.2 lists the error messages.

Table 7.2 Error Messages

Message Contents and Solutions


Address Error One of the following states occurred:
• A PC value was an odd number.
• An instruction was fetched from the internal I/O area.
• Word data was accessed to an odd-numbered address.
• Longword data was accessed to an odd-numbered address.
Correct the user program to prevent the error from occurring.
Exception Error An error occurred in the exception processing. Correct the user program to
prevent the error from occurring.
Illegal Instruction One of the following states occurred:
• A code other than an instruction was executed.
• MOV.B Rn, @-SP or MOV.B @SP+, Rn was executed.
Correct the user program to prevent the error from occurring.
Illegal Operation One of the following states occurred:
• In the DAA or DAS instruction, relationship between the C and H flags of
CCR, and their relation to the value before compensation were incorrect.
• Zero-division or overflow was caused by the DIVXU or DIVXS instruction.
Correct the user program to prevent the error from occurring.
Memory Access One of the following states occurred:
Error
• A memory area that had not been allocated was accessed.
• Data was written to a memory area having the write protect attribute.
• Data was read from a memory area having the read disable attribute.
• A memory area in which memory does not exist was accessed.
• Data was written to EEPROM with an instruction other than EEPMOV.
Allocate memory, change the memory attribute, or correct the user program to
prevent the memory from being erroneously accessed.
System Call Error System call error occurred. Modify the incorrect contents of registers R0 and
R1 or register ER1, and parameter blocks.

Rev. 1.0, 06/99, page 93 of 93


H8S, H8/300 Series Simulator/Debugger
for Windows® User’s Manual
Publication Date: 1st Edition, June 1999
Published by: Electronic Devices Sales & Marketing Group
Semiconductor & Integrated Circuits
Hitachi, Ltd.
Edited by: Technical Documentation Group
UL Media Co., Ltd.
Copyright © Hitachi, Ltd., 1999. All rights reserved. Printed in Japan.

You might also like