NEW DATABASE - 350 MILLION DATASHEETS FROM 8500 MANUFACTURERS
HT-IDE3000 95/98/NT/2000/XP NT/2000/XP 0001H HT48E - Datasheet Archive
July 2006 Copyright Ó 2006 by HOLTEK SEMICONDUCTOR INC. All rights reserved. Printed in Taiwan. No part of this
HT-IDE3000 HT-IDE3000 User¢s Guide July 2006 Copyright Ó 2006 by HOLTEK SEMICONDUCTOR INC. All rights reserved. Printed in Taiwan. No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form by any means, electronic, mechanical photocopying, recording, or otherwise without the prior written permission of HOLTEK SEMICONDUCTOR INC. NOTICE The information appearing in this User¢s Guide is believed to be accurate at the time of publication. However, Holtek assumes no responsibility arising from the use of the specifications described. The applications mentioned herein are used solely for the purpose of illustration and Holtek makes no warranty or representation that such applications will be suitable without further modification, nor recommends the use of its products for application that may present a risk to human life due to malfunction or otherwise. Holtek¢s products are not authorized for use as critical components in life support devices or systems. Holtek reserves the right to alter its products without prior notification. For the most up-to-date information, please visit our web site at http://www.holtek.com.tw. Contents Contents Part I Integrated Development Environment .1 Chapter 1 Overview and Installation .3 HT-IDE Development Environment.3 Holtek In-Circuit Emulator - HT-ICE .4 HT-ICE Interface Card.4 OTP Programmer .5 OTPAdapter Card .5 System Configuration .5 Installation.6 System Requirement.6 Hardware Installation .6 Software Installation.6 Chapter 2 Quick Start .11 Step 1 - Create a New Project .11 Step 2 - Add Source Program Files to the Project.11 Step 3 - Build the Project .11 Step 4 - Programming the OTP Device .11 Step 5 - Transmit Code to Holtek .12 Chapter 3 Menu - File/Edit/View/Tools/Options .13 Start the HT-IDE3000 HT-IDE3000 System .13 File Menu .15 Edit Menu.16 View Menu .16 i HT-IDE3000 HT-IDE3000 User¢s Guide Tools Menu .17 Configuration Option .17 Diagnose .18 Writer.19 Library Manager .19 Voice/VROM Editor .20 Voice/Download .20 LCD Simulator.20 Virtual Peripheral Manager.21 Data EEPROM Editor.21 Options Menu .21 Project Command .21 Debug Command .23 Directories Command .24 Editor Command .24 Color Command .25 Font Command .25 Chapter 4 Menu - Project.27 Create a New Project.27 Open and Close a Project.28 Manage the Source Files of a Project.28 To Add a Source File to the Project.29 To Delete a Source File from the Project .29 To Move a Source File Up or Down .29 Build a Project¢s Task Files.30 To Build a Project Task File .30 To Rebuild a Project Task File .31 Assemble/Compile.31 To Assemble or Compile a Program .31 Print Option Table Command .31 Generate Demo File (.DMO) Command .31 Chapter 5 Menu - Debug.33 Reset the HT-IDE3000 HT-IDE3000 System.34 To Reset from the HT-IDE3000 HT-IDE3000 Commands.35 To Reset from the Target Board .35 Emulation of Application Programs.35 To Emulate the Application Program .36 To Stop Emulating the Application Program.36 To Run the Application Program to a Line.36 To Directly Jump to a Line of an Application Program .36 Single Step .36 Breakpoints.37 Breakpoint Features .38 Description of Breakpoint Items .38 How to Set Breakpoints.40 ii Contents Trace the Application Program .41 Initiating the Trace Mechanism .41 Stopping the Trace Mechanism.43 Trace Start/Stop Setup.43 Trace Record Format .45 Debugger Command Mode .47 Enter/Quit the Command Mode .47 Functions Supported by the Command Mode.47 Log File Format .53 HT-COMMAND Error Messages .54 Chapter 6 Menu - Window .55 Window Menu Commands.56 Chapter 7 Simulation .61 Start the Simulation .61 Chapter 8 OTP Programming.63 Introduction .63 Installation.64 Adapter Card .64 Programming an OTP Device with the HT-HandyWriter.65 System Messages .72 Part II Development Language and Tools.75 Chapter 9 Assembly Language and Cross Assembler .77 Notational Conventions.77 Statement Syntax .78 Name.78 Operation .78 Operand .78 Comment.79 Assembly Directives .79 Conditional Assembly Directives .79 File Control Directives .80 Program Directives.81 Data Definition Directives.84 Macro Directives .86 Assembly Instructions.88 Name.89 Mnemonic.89 Operand, Operator and Expression .89 iii HT-IDE3000 HT-IDE3000 User¢s Guide Miscellaneous .91 Forward References.91 Local Labels .91 Reserved Assembly Language Words .92 Cross Assembler Options .93 Assembly Listing File Format.93 Source Program Listing.93 Summary of Assembly .94 Miscellaneous .94 Chapter 10 Holtek C Language.97 Introduction .97 C Program Structure.98 Statements .98 Comments.98 Identifiers .99 Reserved Words.99 Data Types.99 Data Types and Sizes .99 Declaration .100 Constants.101 Integer Constants.101 Character Constants .101 String Constants.101 Enumeration Constants.102 Operators.102 Arithmetic Operators .102 Relational Operators .102 Equality Operators .103 Logical Operators.103 Bitwise Operators.103 Assignment Operators .103 Increment and Decrement Operators.104 Conditional Operators .104 Comma Operator .104 Precedence and Associativity of Operators .104 Type Conversions .105 Program Control Flow.106 Functions .109 Classic Form .109 Modern Form.109 Pointers and Arrays .110 Pointers .110 Arrays .111 Structures and Unions.111 Preprocessor Directives.112 iv Contents Holtek C Language Extensions and Restrictions.116 Keywords.116 Memory Bank .116 Bit Data Type .117 In Line Assembly .117 Interrupt .117 Variables.118 Static Variables.119 Constants .119 Functions .119 Arrays .119 Constant Variables .119 Pointer.120 Initial Value .120 Multiply/Divide/Modulus .120 Built-in Functions.120 Stack .122 Chapter 11 Mixed Language .123 Little Endian .123 Naming rule of Functions and Parameters .124 Global Variable .124 Local Variable.124 Function .125 Function Parameters.125 Parameter Passing .126 Return Value .126 Preserving Registers .126 Calling Assembly Function from C Program.126 Calling a C Function from an Assembly Program.127 Programming the ISR with Assembly Language .130 Chapter 12 Cross Linker .131 What the Cross Linker Does.131 Cross Linker Options .131 Libraries .131 Section Address .131 Generate Map File .132 Map File .132 Cross Linker Task File and Debug File .132 v HT-IDE3000 HT-IDE3000 User¢s Guide Part III Utilities .133 Chapter 13 Library Manager .135 What the Library Manager Does.135 To Setup the Library Files .135 Create a New Library File .136 Add a Program Module into a Library File.137 Delete a Program Module from a Library File .137 Extract a Program Module from Library and Create An Object File .137 Object Module Information .137 Chapter 14 LCD Simulator .139 Introduction .139 LCD Panel Configuration File .139 Relationship Between the Panel File and the Current Project .140 Selecting the HT-LCDS .140 LCD Panel Picture File .141 Setup the LCD Panel Configuration File.141 Setup the Panel Configurations .141 Select the Patterns and Their Positions .142 Add a New Pattern .142 Delete a Pattern .143 Change the Pattern .143 Change the Pattern Position .143 How to Add a User-define Matrix .144 Define the Pattern Using the Panel Editor .144 Add New Pattern Items Using a Batch File .145 Selecting Color for an LCD Panel .145 Setting Pattern Color for VFD Panel .146 Simulating the LCD.146 Stop the Simulation .146 Chapter 15 Virtual Peripheral Manager .147 Introduction .147 The VPM Window .147 VPM Menu.148 File Menu .148 Function Menu .149 The VPM Peripherals.151 LED .151 Button/Switch .152 Seven Segment Display.152 Quick Start Example .154 Scanning Light .154 vi Contents Part IV Appendix .157 Appendix A Reserved Words Used By Cross Assembler .159 Reserved Assembly Language Words .159 Instruction Sets .160 Appendix B Cross Assembler Error Messages .165 Appendix C Cross Linker Error Messages .169 Appendix D Cross Library Error Messages.175 Appendix E Holtek Cross C Compiler Error Messages.177 Error Code .177 Warning Code.180 Fatal Code .182 vii HT-IDE3000 HT-IDE3000 User¢s Guide viii Part I Integrated Development Environment Part I Integrated Development Environment 1 HT-IDE3000 HT-IDE3000 User¢s Guide 2 Chapter 1 Overview and Installation Chapter 1 Overview and Installation 1 To ease the process of application development, the importance and availability of supporting tools for microcontrollers cannot be underestimated. To support its range of MCUs, Holtek is fully committed to the development and release of easy to use and fully functional tools for its full range of devices. The overall development environment is known as the HT-IDE, while the operating software is known as the HT-IDE3000 HT-IDE3000. The software provides an extremely user friendly Windows based approach for program editing and debugging while the HT-ICE emulator hardware provides full real time emulation with multi functional trace, stepping and breakpoint functions. With a complete set of interface cards for its full device range and regular software Service Pack updates, the HT-IDE development environment ensures that designers have the best tools to maximize efficiency in the design and release of their microcontroller applications. HT-IDE Development Environment The Holtek Integrated Development Environment, otherwise known as the HT-IDE, is a high performance integrated development environment designed around Holtek¢s series of 8-bit MCU devices. Incorporated within the system is the hardware and software tools necessary for rapid and easy development of applications based on the Holtek range of 8-bit MCUs. The key component within the HT-IDE system is the HT-ICE In-Circuit Emulator, capable of emulating the Holtek 8-bit MCU in real time, in addition to providing powerful debugging and trace features. The latest version of the HT-ICE In-Circuit Emulator also incorporates a complete OTP writer which provides the user with all the tools required to design, debug and program their OTP devices. As for the software, the HT-IDE3000 HT-IDE3000 provides a friendly workbench to ease the process of application program development, by integrating all of the software tools, such as editor, Cross Assembler, Cross Linker, library and symbolic debugger into a user friendly Windows based environment. In addition, the HT-IDE3000 HT-IDE3000 provides a software simulator which is capable of simulating the behavior of Holtek¢s 8-bit MCU range without connection to the HT-ICE. All fundamental functions of the HT-ICE hardware are valid for the simulator. More detailed information on the HT-IDE3000 HT-IDE3000 development system is contained within the HT-IDE3000 HT-IDE3000 User¢s Guide. Installed in conjunction with the HT-IDE3000 HT-IDE3000 and to ensure that the development system contains information on new microcontrollers and the latest software updates, Holtek provides regular HT-IDE3000 HT-IDE3000 Service Packs. These Service Packs, which can be downloaded from the Holtek website, do not replace the HT-IDE3000 HT-IDE3000 but are installed after the HT-IDE3000 HT-IDE3000 system software has been installed. 3 HT-IDE3000 HT-IDE3000 User¢s Guide Some of the special features provided by the HT-IDE3000 HT-IDE3000 include: ® Emulation · Real-time program instruction emulation ® Hardware · Easy installation and usage · Either internal or external oscillator · Breakpoint mechanism · Trace functions and trigger qualification supported by trace emulation chip · Printer port for connecting the HT-ICE to a host computer · I/O interface card for connecting the user¢s application board to the HT-ICE · OTP writer hardware integrated within the HT-ICE ® Software · Windows based software utilities · Source program level debugger (symbolic debugger) · Workbench for multiple source program files (more than one source program file in one application project) · All tools are included for the development, debug, evaluation and generation of the final application program code (mask ROM file and OTP file) · Library for the setting up of common procedures which can be linked at a later date to other projects. · Simulator can simulate and debug programs without connection to the HT-ICE hardware · Virtual Peripheral Manager (VPM) simulates the behavior of the peripheral devices. · LCD simulator simulates the behavior of the LCD panel. Holtek In-Circuit Emulator - HT-ICE Developed alongside the Holtek 8-bit microcontroller device range, the Holtek ICE is a fully functional in-circuit emulator for Holtek¢s 8-bit microcontroller devices. Incorporated within the system are a comprehensive set of hardware and software tools for rapid and easy development of user applications. Central to the system is the in-circuit hardware emulator, capable of emulating all of Holtek¢s 8-bit devices in real-time, while also providing a range of powerful debugging and trace facilities. Regarding software functions, the system incorporates a user-friendly Windows based workbench which integrates together functions such as program editor, Cross Assembler, Cross Linker and library manager. In addition, the system is capable of running in software simulation mode without connection to the HT-ICE hardware. HT-ICE Interface Card The interface cards supplied with the HT-ICE can be used for most applications, however, it is possible for the user to omit the supplied interface card and design their own interface card. By including the necessary interface circuitry on their own interface card, the user has a means of directly connecting their target boards to the CN1 and CN2 connectors of the HT-ICE. Fig 1-1 4 Chapter 1 Overview and Installation OTP Programmer Holtek¢s OTP devices are fully supported by a range of programmers. For engineering level OTP device programming, Holtek supplies its stand alone programming tool which provides a quick and efficient means for low volume OTP programming. The HT-ICE In-Circuit Emulators has integrated a writer as part of the hardware package, facilitating complete design, debug and OTP device programming all within the HT-ICE. More programmers from other suppliers are available which provide more efficient and higher volume production capability. Refer to our website for further suppliers information. OTP Adapter Card The Holtek OTP programmers are supplied with a standard Textool chip socket. The OTP Adapter Card is used to connect the Holtek OTP programmers to the various sizes of available OTP chip packages that are unable to use this supplied socket. System Configuration The HT-IDE system configuration is shown below, in which the host computer is a Pentium compatible machine with Windows 95/98/NT/2000/XP 95/98/NT/2000/XP or later. Note that if Windows NT/2000/XP NT/2000/XP or later systems are used, then the HT-IDE3000 HT-IDE3000 software must be installed in the Supervisor Privilege mode. P o w e r A d a p te r E m u la to r F la t C a b le P r in te r C a b le E m u la to r B o x H T -IC E T a rg e t B o a rd In te rfa c e C a rd O T P W r ite r Fig 1-2 The HT-IDE system contains the following hardware components: · The HT-ICE box contains the emulator box with 1 printer port connector for connecting to the host machine, I/O signal connector and one power-on LED · I/O interface card for connecting the target board to the HT-ICE box · Power Adapter, output 16V · 25-pin D-type printer cable · Integrated OTP writer P r in te r P o r t R e s e t D C + 1 6 V H T -IC E R e a r V ie w C N 2 C N 1 H T -IC E F r o n t V ie w Fig 1-3 5 HT-IDE3000 HT-IDE3000 User¢s Guide Installation System Requirement The hardware and software requirements for installing HT-IDE3000 HT-IDE3000 system are as follows: · PC/AT compatible machine with Pentium or higher CPU · SVGA color monitor · At least 32M RAM for best performance · CD ROM drive (for CD installation) · At least 20M free disk space · Parallel port to connect PC and HT-ICE · Windows 95/98/NT/2000/XP 95/98/NT/2000/XP Windows 95/98/NT/2000/XP 95/98/NT/2000/XP are trademarks of Microsoft Corporation. Hardware Installation · Step 1 Plug the power adapter into the power connector of the HT-ICE · Step 2 Connect the target board to the HT-ICE by using the I/O interface card or flat cable · Step 3 Connect the HT-ICE to the host machine using the printer cable The LED on the HT-ICE should now be lit, if not, there is an error and your dealer should be contacted. Caution Exercise care when using the power adapter. Do not use a power adapter whose output voltage is not 16V, otherwise the HT-ICE may be damaged. It is strongly recommended that only the power adapter supplied by Holtek be used. First plug the power adapter to the power connector of the HT-ICE. Software Installation · Step1 Insert the HT-IDE3000 HT-IDE3000 CD into the CD ROM drive, the following dialog will be shown. Fig 1-4 6 Chapter 1 Overview and Installation Click button and the following dialog (Fig 1-5) will be shown. Fig 1-5 Click or as you want. Here¢s an Example of installing HT-IDE3000 HT-IDE3000 Click button. · Step 2 Press the button to continue setup or press button to abort. Fig 1-6 7 HT-IDE3000 HT-IDE3000 User¢s Guide · Step 3 The following dialog will be shown to ask the user to enter a directory name. Fig 1-7 Fig 1-8 8 Chapter 1 Overview and Installation Fig 1-9 · Step 4 Specify the path you want to install the HT-IDE3000 HT-IDE3000 and click button. · Step 5 SETUP will copy all files to the specified directory. Fig 1-10 9 HT-IDE3000 HT-IDE3000 User¢s Guide · Step 6 If the process is successful a dialog will be shown. Fig 1-11 · Step 7 Press the Finish button and restart the computer system. Then you can run HT-IDE3000 HT-IDE3000 now. SETUP will create four subdirectories, BIN, INCLUDE, LIB, SAMPLE, under the destination directory you specified in Step 4. The BIN subdirectory contains all the system executables (EXE), dynamic link libraries (DLL) and configuration files (CFG, FMT) for all supported MCU. The INCLUDE subdirectory contains all the include files (.H, .INC) provided by Holtek. The LIB subdirectory contains the library files (.LIB) provided by Holtek. The SAMPLE subdirectory contains some sample programs. Note that before running the HT-IDE3000 HT-IDE3000 for the first time, the system will ask for company information as shown in the figure below. Select appropriate area and fill in the company name and ID. The HT-IDE3000 HT-IDE3000 provider can be requested to supply an ID number. Fig 1-12 10 Chapter 2 Quick Start 2 Chapter 2 Quick Start This chapter gives a brief description of using HT-IDE3000 HT-IDE3000 to develop an application project. Step 1 - Create a New Project · · · · Click on Project menu and select New command Enter your project name and select an MCU from the combo box Click OK button and the system will ask you to setup the configuration options Setup all configuration options and click Save button Step 2 - Add Source Program Files to the Project · · · · · · Create your source files by using File/New command Write your program and save them with a file name, say TEST.ASM Click on Project menu and select Edit command An Edit Project dialog will ask you to add/delete files to/from the project Select a source file name, say TEST.ASM, and click Add button Click OK button after you setup all files in the project Step 3 - Build the Project · Click on Project menu and select Build command · The system will assemble/compile all source files in the project - If there are some errors in the programs, double click on the error message line and the system will prompt you the position where the error happened. - If all the program files are error free, the system will create a Task file and download to the HT-ICE for debug. · You may repeat this step before you finish debugging your programs Step 4 - Programming the OTP Device · Build the project for creating the .OTP file · Click on Tools menu and select the Writer command to program the OTP devices 11 HT-IDE3000 HT-IDE3000 User¢s Guide Step 5 - Transmit Code to Holtek · Click on Project menu and select Print Option Table command · Send the .COD file and the Option Approval Sheet to Holtek The Programming and data flow is illustrated by the following diagram: .IN C .A S M .H .C P r o je B u ild R e b u 1 . A s 2 . L in 3 . L o 4 . C o / .L S T .O B J c t// ild s e k e a d d e .F M T P r o je c t// A s s e m b le /C o m p ile A ll m b le /C o m p ile r e r G e n e ra to r T o o ls // L ib r a r y M a n a g e r L in k e r C r e a te T a s k F ile .M A P .D B G .L IB .C F G .T S K L o a d e r D o w n lo a d to IC E T o o ls // M a s k O p tio n .O P T C o d e G e n e ra to r T o o ls // P r in t O p tio n T a b le .C O D O p tio n A p p ro v a l S h e e t H o lte k Fig 2-1 12 .O T P M a s k IC s D e b u g // G o G o to C u rs o r J u m p to C u rs o r S to p /T ra c e S to p R e s e t P o w e r-o n R e s e t R e s e t T ra c e S te p In to /O v e r/O u t S te p p in g T o o ls // H a n d y W r ite r O T P IC s Chapter 3 Menu File/Edit/View/Tools/Options Chapter 3 Menu File/Edit/View/Tools/Options 3 This chapter describes some of the menus and commands of the HT-IDE3000 HT-IDE3000. Other menus are described in the Project, Debug and Window chapters. Start the HT-IDE3000 HT-IDE3000 System Fig 3-1 · Click Start Button, select Programs and select Holtek HT-IDE3000 HT-IDE3000 - Click the HT-IDE3000 HT-IDE3000 icon 13 HT-IDE3000 HT-IDE3000 User¢s Guide · If the last project you worked on HT-IDE3000 HT-IDE3000 is in emulation mode (using HT-ICE), then Fig 3-2 will be displayed if one of the following conditions occurs. - No connection between the HT-ICE and the host machine or connection fails. - The HT-ICE is powered off. Fig 3-2 If ²YES² is selected and the connection between the HT-ICE and the host machine has been made, then Fig 3-3 is displayed, the HT-IDE3000 HT-IDE3000 enters the emulation mode and the HT-ICE begins to function. Fig 3-3 · If the last project you work on HT-IDE3000 HT-IDE3000 is in simulation mode (using Simulator), then Fig 3-4 will be displayed to indicate that HT-IDE3000 HT-IDE3000 will enter the simulation mode. Fig 3-4 The HT-IDE3000 HT-IDE3000 program supports 9 menus - File, Edit, View, Project, Debug, Tools, Options, Window and Help. The following sections describe the functions and commands of each menu. A dockable toolbar, below the menu bar (Fig 3-5), contains icons that correspond to, and assist the user with more convenient execution of frequently used menu commands. When the cursor is placed on a toolbar icon, the corresponding command name will be displayed alongside. Clicking on the icon will cause the command to be executed. 14 Chapter 3 Menu File/Edit/View/Tools/Options A Status Bar, in the bottom line (Fig 3-5), displays the emulation or simulation present status and the result status of commands. In status bar, the field (PC=0001H 0001H) displays the Program Counter while in debugging process (Debug menu). Fig 3-5 The Status Bar contains information that may be useful during program debug. The Program Counter is used during program execution and indicates the actual present Program Counter value while the row and column indicators are used to show the present cursor position when using the program editor. File Menu The File menu provides file processing commands, the details behind which are shown in the following list along with the corresponding toolbar icons. · New Create a new file · Open Open an existing file · Close Close the current active file 15 HT-IDE3000 HT-IDE3000 User¢s Guide · Save Write the active windows data to the active file · Save As . Write the active windows data to the specified file · Save All Write all windows data to the corresponding opened files · Print Print active data to the printer · Print Setup Setup printer · Recent Files List the most recently opened and closed four files · Exit Exit from HT-IDE3000 HT-IDE3000 and return to Windows Edit Menu · Undo Cancel the previous editing operation · Redo Cancel the previous Undo operation · Cut Remove the selected lines from the file and place onto the clipboard · Copy Place a copy of the selected lines onto the clipboard · Paste Paste the clipboard information to the present insertion point · Delete Delete the selected information · Find Search the specified word from the editor active buffer · Replace Replace the specified source word with the destination word in the editor active buffer View Menu The View menu provides the following commands to control the window screen of the HT-IDE3000 HT-IDE3000. (Refer to Fig 3-6) · Line Move the cursor to the specified line (specified by line number) of the active file 16 Chapter 3 Menu File/Edit/View/Tools/Options · Cycle Count Count instruction cycles accumulatively. Press the reset button to clear the cycle count. The radio buttons Hex and Dec are used to change the radix of the count, hexadecimal or decimal. The maximum cycle count is 65535. · Toolbar Display the toolbar information on the window. The toolbar contains some groups of buttons whose function is the same as that of the command in each corresponding menu item. When the mouse cursor is placed on a toolbar button, the corresponding function name will be displayed next to the button. If the mouse is clicked, the command will be executed. Refer to the corresponding chapter for the functionality of each button. The Toggle Breakpoint button will set the line specified by the cursor as a breakpoint (highlighted). The toggle action of this button will clear the breakpoint function if previously set. · Status Bar Displays the status bar information on the window. Fig 3-6 Tools Menu The Tools menu provides the special commands to facilitate user application debug. These commands are Configuration Option, Diagnose, Writer, Library Manager, Voice tools and LCD Simulator and virtual peripheral manager. Fig 3-7 Configuration Option This command generates an option file used by the Build command in the Project menu. The contents of the option file depend upon the specified MCU. This command allows options to be modified after creation of the project. 17 HT-IDE3000 HT-IDE3000 User¢s Guide ® Choosing the Clock Source The clock source used by the HT-ICE has to be chosen when setting the MCU options, either when creating a new project or modifying the options. The HT-ICE provides two clock sources, namely internal and external. If an external clock source is chosen, the jumper JP1 must be placed in the correct position. · For crystal mode, add a crystal to location X1 and short positions 2 and 3 of jumper JP1 on the I/O interface card. · For RC mode, adjust the system frequency with VR1 and short positions 1 and 2 of jumper JP1 on the I/O interface card. ® Internal Clock Source If an internal clock source is used, the system application frequency has to be specified. The HT-IDE3000 HT-IDE3000 system will calculate a frequency which can be supported by the HT-ICE, one which will be the most approximate value to the specified system frequency. Whenever the calculated frequency is not equal to the specified frequency, a warning message and the specified frequency along with the calculated frequency will be displayed. Confirmation will then be required to confirm the use of the calculated frequency or to specify another system frequency. Otherwise an external clock source is the only option. No matter which kind of clock source is chosen, the system frequency must be specified. Diagnose This command (Fig 3-8) helps to check whether the HT-ICE is working correctly. There are a total of 9 items for diagnosis. Multiple items can be selected by clicking the check box and pressing the Test button, or press the Test All button to diagnose all items. These items are listed below. · MCU resource option space Diagnose the MCU options space of the HT-ICE. · Code space Diagnose the program code memory of the HT-ICE. · Trace space Diagnose the trace buffer memory of the HT-ICE. · Data space Diagnose the program Data Memory of the HT-ICE. · System space Diagnose the system Data Memory of the HT-ICE. · I/O EV 0 Diagnose the I/O EV-chip in socket 0 of the HT-ICE. · I/O EV 1 Diagnose the I/O EV-chip in socket 1 of the HT-ICE. · I/O EV 2 Diagnose the I/O EV-chip in socket 2 of the HT-ICE. · I/O EV 3 Diagnose the I/O EV-chip in socket 3 of the HT-ICE. 18 Chapter 3 Menu File/Edit/View/Tools/Options Fig 3-8 Writer The Writer command under the Tools menu controls the OTP/MTP programming functions of the HT-ICE built-in writer. Within this command, the sub-command Handywriter is used to program all Holtek¢s OTP type MCU and the HT-MTPWriter is to program all Holtek¢s MTP type MCU. However, this command is not applicable for the other external stand-alone writer which is known as the HT-Writer. Please visit our website for the relevant information. Library Manager The Library Manager command, in Fig 3-9, supports the library functions. Program codes used frequently can be compiled into library files and then included in the application program by using the Project command in the Options menu. (Refer to the Cross Linker options item in Options menu, Project command). The functions of Library Manager are: · Create a new library file or modify a library file · Add/Delete a program module into/from a library file · Extract a program module from a library file, and create an object file 19 HT-IDE3000 HT-IDE3000 User¢s Guide Part III gives more details on the library manager. Fig 3-9 Voice/VROM Editor Holtek provides a VROM Editor for the user to arrange the voice code for the specific MCU (eg. HT86 series) Voice/Download This command downloads the contents of a specified voice data file with extension name .VOC to the HT-ICE for emulation. It also uploads from the HT-ICE VROM saving the data to a specified .VOC file. Fig 3-10 displays the dialogue box which shows the name of the downloaded voice file .VOC, which was generated by the VROM Editor. The size box displays the voice ROM size in bytes for the current project¢ MCU. When uploading, a different file name from the project name s may be specified to save the contents of voice ROM from the HT-ICE. Ensure that the voice ROM file .VOC has been generated by the VROM Editor before downloading. Fig 3-10 LCD Simulator The LCD simulator HT-LCDS, provides a mechanism to simulate the output of the LCD driver. According to the designed patterns and the control programs, the HT-LCDS displays the patterns on the screen in real time. Part III gives more details on the LCD simulator. 20 Chapter 3 Menu File/Edit/View/Tools/Options Virtual Peripheral Manager The Virtual Peripheral Manager (VPM) provides a mechanism to simulate the peripheral device. It must be used while the HT-IDE3000 HT-IDE3000 is in simulation mode. Data EEPROM Editor Some Holtek¢s MCUs (eg. HT48E HT48E series) have internal EEPROM. The Data EEPROM Editor provides the interface for the user to arrange the data and download/upload the data to/from the HT-ICE. Fig 3-11 Options Menu The Options menu (Fig 3-12) provides the following commands which can set the working parameters for other menus and commands. Project Command The Project command sets the default parameters used by the Build command in the Project menu. During development, the project options may be changed according to the needs of the application. According to the options set, the HT-IDE3000 HT-IDE3000 will generate a proper task file for these options when the Build command of the Project menu is issued. The dialog box (Fig 3-13) is used for setting the options of the Project. Fig 3-12 Note Before issuing the Build command, ensure that the project options are set correctly. 21 HT-IDE3000 HT-IDE3000 User¢s Guide Fig 3-13 · Micro Controller The MCU name of this project. Use a scroll arrow to browse the available MCU names and select the appropriate one. · Enter Free Run Mode (Debug Options Disabled) After Build Check this box so that HT-IDE3000 HT-IDE3000 will enter free run mode after build. All the debug functions will be disabled while in free run mode. · Language Tool Option Holtek permits Third Party to provide C compiler for Holtek¢s MCU. Currently, you can select Hi-Tech language tool as another choice. · Assembler/Compiler Options The command line options of the Cross Assembler. Define symbol allows user to define value for the specified symbol which is used in the assembly program. The syntax is as follows: symbol1[=value1] [,symbol2 [=value2] [,.]] For example: debugflag=1, newver=3 The check box of the Generate listing file is used to check if the source program listing file has been generated. 22 Chapter 3 Menu File/Edit/View/Tools/Options · Cross Linker Options To specify the options of the Cross Linker. Libraries are used to specify the library files refered by Cross Linker. For example: libfile1, libfile2 Library files can be selected by clicking the Browse button. Section address is used to set the ROM/RAM addresses of the specified sections, for example: codesec=100, datasec=40 The check box of the Generate map file is used to check if the map file of Cross Linker is generated. Debug Command This command sets the options used by the Debug menu (Chapter 5 HT-IDE3000 HT-IDE3000 menu - Debug ). The dialog box (Fig 3-14) lists all the debug options with check boxes. By selecting the options and pressing the OK button, the Debug menu can then obtain these options during the debugging process. Fig 3-14 · Trace Record Fields This location specifies the information to be displayed when issuing the Trace List command, contained within the Window menu. For each source file instruction, the information will be displayed in the same order as that of the items in the dialog box, from top to the bottom. If no item has been selected, the next selected item will be moved forward. The default trace list will display the file name and line number only. The de-assembled instruction is obtained from the machine code, and the source line is obtained from the source file. The execution data is the read data if the execution is a read operation only, and it is the written data if the execution is a write only or read and write operation. The external signal status has no effect if the simulation mode is selected. 23 HT-IDE3000 HT-IDE3000 User¢s Guide · Auto Stepping Command Selects the automatic call procedure step option, namely Step Into or Step Over. Only one option can be selected. · Connection Port Selects the PC connection port for the HT-ICE. One PC parallel port, LPT1, LPT2 or LPT3 can be selected for connection to the HT-ICE. The connection port has no effect if the simulation mode is selected. · Mode Selects the HT-IDE3000 HT-IDE3000 working mode as either simulation or emulation mode. If the HT-ICE is connected to the host machine and powered on, the HT-IDE3000 HT-IDE3000 can be selected to be either in emulation or simulation mode. · Detect Stack Overflow Uncheck this box if you don¢t want the system to show a message while detecting stack overflow. Directories Command The command sets the default search path and directories for saving files. (Fig 3-15) Fig 3-15 · Executable files path The search path referred to by the HT-IDE3000 HT-IDE3000 when the executable files are called. · Include files path The search path referred to by the Cross Assembler to search for the included files. · Library files path The search path referred to by the Cross Linker to search for the library files. · Output files path The directory for saving the output files of the Cross Assembler (.obj, .lst) and Cross Linker (.tsk, .map, .dbg) Editor Command This command sets the editor options such as tab size and Undo command count. The Save Before Assemble option will save the file before assembly. The Maximum Undo Count is the maximum allowable counts of consecutive undo operations. 24 Chapter 3 Menu File/Edit/View/Tools/Options Fig 3-16 Color Command This command sets the foreground and background colors for the specified line. From the available options (Fig 3-17), Text Selection is used for the Edit menu, Current line, Breakpoint Line, Trace Line and Stack Line are for the Debug menu and Error line is for the Assembler output. Fig 3-17 Font Command This command will change the displayed fonts. 25 HT-IDE3000 HT-IDE3000 User¢s Guide 26 Chapter 4 Menu - Project 4 Chapter 4 Menu - Project The HT-IDE3000 HT-IDE3000 provides an example Project, which will assist first time users in quickly familiarizing themselves with project development. It should be noted that from the standpoint of the HT-IDE3000 HT-IDE3000 system, a working unit is a project with each user application described by a unique project. When developing an HT-IDE3000 HT-IDE3000 application for the first time, the development steps, as described earlier, are recommended. Fig 4-1 Create a New Project In the Project menu (Fig 4-1), select the New command to create a new project. In this command, the user needs to key in or select two pieces of information for the new project, namely the Project Name and the Micro Controller (Fig 4-2). The user may browse all directories and all existing projects and select one of them (to overwrite the old project) and to choose one of the available MCU. Note The project name is a file name with the extension .PRJ. 27 HT-IDE3000 HT-IDE3000 User¢s Guide Fig 4-2 Open and Close a Project The HT-IDE3000 HT-IDE3000 can work with only one project at a time, which is the opening project, at any time. If a project is to be worked upon, the project should first be opened, by using the Open command of the Project menu (Fig 4-1). Then, insert the project name directly or browse the directories and select a project name. Use the Close command to close the project. Note When opening a project, the current project is closed automatically. Within the development period, i.e. during editing, setting options and debugging etc., ensure that the project is in the open state. This is shown by the displaying of the project name of the opening project on the title of the HT-IDE3000 HT-IDE3000 window. Otherwise, the results are unpredictable. The HT-IDE3000 HT-IDE3000 will retain the opening project information if the system exits from the HT-IDE3000 HT-IDE3000 without closing the opening project. This project will be opened automatically the next time the HT-IDE3000 HT-IDE3000 is run. Manage the Source Files of a Project Use the Edit command to add or remove source program files from the opened project. The order, from top to bottom, of each source file in the list box, is the order of the input files to the Cross Linker. The Cross Linker processes the input files according to the order of these files in the box. Two buttons, namely [Move Up] and [Move Down], can be used to adjust the order of a source file in the project. Fig 4-3 is the dialog box of the Project menu¢ Edit command. s 28 Chapter 4 Menu - Project Fig 4-3 To Add a Source File to the Project · Type the source file name into the text box of the File Name in the Edit dialog box · Alternatively, choose the source file type and browse the List Files. - Choose the drive and directory where the source files are located by using the browse Drives and Directories items - Choose a source file name from the list box below the File name item - Double-click the selected file name or choose the Add button to add the source files to the project When the selected source file has been added, this file name is displayed on the list box of the Files in project. To Delete a Source File from the Project · Choose the file to be deleted from the project · Click the Delete button Note Deleting the source files from the project does not actually delete the file but refers to the removal of the file information from the project. To Move a Source File Up or Down · Choose the file to be moved in the list box (Files in project), by moving the cursor to this file and clicking the mouse button · Click the [Move Up] button or the [Move Down] button 29 HT-IDE3000 HT-IDE3000 User¢s Guide Build a Project¢s Task Files Be sure that the following tasks have been completed before building a new project: · The project has been opened · The project options have all been set · The project source files have been added · The MCU options have been set (refer to the Tools menu chapter) There are two commands related to the building of a project file, the Build command and the Rebuild All command. The Project menu¢s Build command performs the following operations: · Assemble or compile all the source files of the current project, by calling the Cross Assembler or C compiler depends on the file extension .asm or .C · Link all the object files generated by the Cross Assembler or C compiler, and generate a task file and a debugging file. · Load the task file into the HT-ICE if it is powered-on · Display the source program of the execution entry point on the active window (the HT-IDE3000 HT-IDE3000 refers to the source files, the task file and the debugging file for emulation) Note The Build command may or may not execute the above tasks as the execution is dependent on the creation date/time of all corresponding files. The rules are: · If the creation date/time of a source file is later than that of its object file, then the Cross Assembler or C compiler is called to assemble, compile this source file and to generate a new object file. · If one of the task¢s object files has a later creation date/time than that of the task file, then the Cross Linker is called to link all object files of this task and to generate a new task file. The Build command downloads the task file into the HT-ICE automatically whether there is an action or not. The Rebuild All command carries out the same task as the Build command. The difference is that the Rebuild All command will execute the task immediately without first checking the creation date/time of the project files. The result message of executing a Build or Rebuild All command are displayed on the Output window. If an error occurs in the processing procedure, the actions following it are skipped, and no task file is generated, and no download is performed. To Build a Project Task File · Click the Open command of the Project menu to open the project · Click either the Build command of the Project menu or the Build button on the toolbar (Fig 4-1) to start building a project 30 Chapter 4 Menu - Project To Rebuild a Project Task File · Click the Open command of the Project menu to open the project · Click either the Rebuild All command of the Project menu or the Rebuild all button on the toolbar (Fig 4-1) to start building a project Once the project task has been built successfully, emulation and debugging of the application program can begin (refer to the HT-IDE3000 HT-IDE3000 menu - Debug chapter). Assemble/Compile To verify the integrity of application programs, this command can be used to assemble or compile the source code and display the result message in the Output window. To Assemble or Compile a Program · Use the File menu to open the source program file to be assembled or compiled · Either select the Assemble/Compile command of the Project menu or click the Assemble button on the toolbar to assemble/compile this program file If the opened file has an .asm file extension name, the Cross Assembler will execute the assembly process. If the file has a .C extension then the Holtek C compiler will compile the program. If no errors are detected, an object file with extension .OBJ is generated and stored in the directory which is specified in the Output Files Path (refer to Options menu, Directories command). If an error occurs and a corresponding message displayed on the Output window, one of the following commands can be used to move the cursor to the error line: · Double-click the left button of the mouse or · Select the error message line on the Output window, and press the key Print Option Table Command This command will print the current active option file to the specified printer. A printer may be selected where the options file is to be printed out. It is recommended to use a different printer port from the port which is connected to the HT-ICE. If both the printer and the HT-ICE are using the same printer port, issuing this command will cause the loss of all debug information and corresponding data. After the printing job has finished, the user should proceed to the very beginning of the development procedure and use the Build command of the Project menu if further emulation/debugging of the application program is required. Generate Demo File (.DMO) Command This command will generate a file (.dmo) for HT-DEMO. User can carry HT-DEMO with the .dmo file and demonstrate his project on a PC without the installation of HT-IDE3000 HT-IDE3000. 31 HT-IDE3000 HT-IDE3000 User¢s Guide 32 Chapter 5 Menu - Debug 5 Chapter 5 Menu - Debug In the development process, the repeated modification and testing of source programs is an inevitable procedure. The HT-IDE3000 HT-IDE3000 provides many tools not only to facilitate the debugging work, but also to reduce the development time. Included are functions such as single stepping, symbolic breakpoints, automatic single stepping, trace trigger conditions, etc. After the application program has been successfully constructed, (refer to the chapter on Build a project¢s task files) the first execution line of the source program is displayed and highlighted in the active window (Fig 5-1). The HT-IDE3000 HT-IDE3000 is now ready to accept and execute the debug commands. Fig 5-1 33 HT-IDE3000 HT-IDE3000 User¢s Guide Reset the HT-IDE3000 HT-IDE3000 System There are 4 kinds of reset methods in the HT-IDE3000 HT-IDE3000 system: · Power-on reset (POR) by plugging in the power adapter or pressing the reset button on the HT-ICE · Reset from the target board · Software reset command in the HT-IDE3000 HT-IDE3000 Debug menu (Fig 5-2) · Software power-on reset command in the HT-IDE3000 HT-IDE3000 Debug menu (Fig 5-2) Fig 5-2 34 Chapter 5 Menu - Debug The effects of the above 4 types of reset are listed in table 5-1. Power-On Reset Target Board Reset Software Reset Command Software Power-On Reset Command (*) (*) (*) (*) Clear Options Yes No No No Clear PDF, TO Yes No No Yes PC Value (*) 0 0 0 Emulation Stop (*) No(*) Yes Yes Check Stand-Alone Yes No No No Reset Item Clear Registers Table 5-1 Note (*) : Refer to the Data Book of the corresponding MCU for the effects of registers under the different resets. (*) : The PC value is 0 and the emulation stops. (*) : If the reset is from the target board, the MCU will start emulating the application after the reset is completed. PC - Program Counter PDF - Power Down Flag TO - Time-out Flag To Reset from the HT-IDE3000 HT-IDE3000 Commands · Either choose the Reset command from Debug menu or click the Reset button on the toolbar to execute a software reset · Either choose the Power-on Reset command from the Debug menu or click the Power-on Reset button to execute a software power on reset To Reset from the Target Board The target board circuit can take advantage of the m_RES pin (pin 03-C) on the DIN connector to design a MCU reset button. The effect of this reset is listed in table 5-1. Emulation of Application Programs After the application program has been successfully written and assembled, the Build or Rebuild command should be executed. If successful, the first executable line of the source program will be displayed and highlighted on the active window (Fig 5-1). At this point, emulation of the application program can begin by using the HT-IDE3000 HT-IDE3000 debug commands. Note During emulation of an application program, the corresponding project has to be open. 35 HT-IDE3000 HT-IDE3000 User¢s Guide To Emulate the Application Program · Choose the Go command from the Debug menu or press the hot key F5 or press the Go button on the toolbar Other windows can be activated during emulation. The HT-IDE3000 HT-IDE3000 system will automatically stop the emulation if a break condition is met. Otherwise, it will continue emulating until the end of the application program. The Stop button on the toolbar is illuminated with a red color while the HT-ICE is in emulation. Pressing this button will stop the emulation process. To Stop Emulating the Application Program There are three methods to stop the emulation, shown as follows: · Set the breakpoints before starting the emulation · Choose the Stop command of the Debug menu or press the hot key Alt+F5 · Press the Stop button on the toolbar To Run the Application Program to a Line The emulation may be stopped at a specified line when debugging a program. The following methods provide this function. All instructions between the current point and the specified line will be executed except the conditional skips. Note however that the program may not stop at the specified line due to conditional jumps or other situations. · Move the cursor to the stopped line (or highlight this line) · Choose the Go to Cursor command of the Debug menu or press the hot key F7 or press the Go to Cursor button on the toolbar To Directly Jump to a Line of an Application Program It is possible to jump directly to a line, if the result of executed instructions between the current point and the specified line are not important. This command will not change the contents of Data Memory, registers and status except for the Program Counter. The specified line is the next line to be executed. · Move the cursor to the appropriate line or highlight this line · Choose Jump to Cursor command of the Debug menu Single Step The execution results of some instructions in the above section may be viewed and checked. It is also possible to view the execution results one instruction at a time, i.e., in a step-by-step manner. The HT-IDE3000 HT-IDE3000 provides two step modes, namely manual mode and automatic mode. In the manual mode, the HT-IDE3000 HT-IDE3000 executes exactly one step command each time the single-step command is executed. In the automatic mode, the HT-IDE3000 HT-IDE3000 executes single step commands continuously until the emulation stop command is issued, using the Stop command of the Debug menu. In the automatic mode, all user specified breakpoints are discarded and the step rate can be set from FAST, 0.5, 1, 2, 3, 4 to 5 seconds. There are 3 step commands, namely Step Into, Step Over and Step Out. 36 Chapter 5 Menu - Debug · The Step Into command executes exactly one instruction at a time, however, it will enter the procedure and stop at the first instruction of the procedure when it encounters a CALL procedure instruction. · The Step Over command executes exactly one instruction at a time, however upon encountering a CALL procedure, will stop at the next instruction after the CALL instruction instead of entering the procedure. All instructions of this procedure will have been executed and the register contents and status may have changed. · The Step Out command is only used when inside a procedure. It executes all instructions between the current point and the RET instruction (including RET), and stops at the next instruction after the CALL instruction. Note The Step Out command should only be used when the current pointer is within a procedure or otherwise unpredictable results may happen. The two step commands, Step Into and Step Over, in the automatic mode are set using the Debug sub-menu of the Options menu · To start automatic single step mode Choose the Stepping command from the Debug menu also choose the stepping speed (the step command is set in the Debug command from the Options menu) · To end automatic single step mode Choose the Stop command from the Debug menu · To change automatic single step command for the automatic mode - Choose the Debug command from the Options menu - Choose the Step Into or the Step Over command in the Stepping command box · To start Step Into Choose the Step Into command from the Debug menu or press the hot key F8 or press the Step Into button on the toolbar · To start Step Over Choose the Step Over command of the Debug menu or press the hot key F10 or press the Step Over button on the toolbar · To start Step Out Choose the Step Out command of the Debug menu or press the hot key Shift+F7 or press the Step Out button on the toolbar Breakpoints The HT-IDE3000 HT-IDE3000 provides a powerful breakpoint mechanism which accepts various forms of conditioning including program address, source line number and symbolic breakpoint, etc. 37 HT-IDE3000 HT-IDE3000 User¢s Guide Breakpoint Features The following are the main features of the HT-IDE3000 HT-IDE3000 breakpoint mechanism: · At most 3 breakpoints with equal priority can take effect at any instant. · Any breakpoint will be recorded in the breakpoints list box after it is set, however this breakpoint may not be immediately effective. It can be set to be effective later, as long as it is not deleted, i.e.still in the breakpoints list box. · It is acceptable to add at most 20 breakpoints to the list box simultaneously. At least one breakpoint should be deleted first, if a 21st breakpoint is to be added. · Breakpoints of address or data, in binary form with don¢t-care bits, are permitted. · When an instruction is set to be an effective breakpoint, the HT-ICE will stop at this instruction, but will not execute it, i.e. this instruction will become the next one to be executed. Although an instruction is an effective breakpoint, the HT-ICE may not stop at this instruction due to execution flow or conditional skips. If an effective breakpoint is in the Data Space (RAM), the instruction that matches this conditional breakpoint data will always be executed. The HT-ICE will stop at the next instruction. Description of Breakpoint Items A breakpoint consists of the following descriptive items. It is not necessary to set all items, Fig 5-3: · Space The location of the breakpoint, either Program Code space or Data space. · Location The actual location of the breakpoint. The next paragraph will give the location format. · Content The data content of breakpoint. This item is effective only when the Space is assigned to the Data space. The Read and Write check box are used for executing conditions of the breakpoint. ® Format of Description Items - Location The allowed formats of Location items are: · Absolute address (in code space or data space) with 4 format types, namely decimal, hexadecimal (suffix with ²H² or ²h²), binary and don¢t-care bits. For example 20, 14h, 00010100b, 10xx0011 represents decimal 20, hexadecimal 14h, binary 00010100b and don¢ t-care bits 4 and 5 respectively. Note Don¢t-care bits must be in binary format. 38 Chapter 5 Menu - Debug · Line number with or without source file name, the format is: [source_file_name!].line_number where the source_file_name is a name of the optional source file. If there is no file name, the current active file is assumed. The exclamation point ²!² is necessary only when a source file name is specified. The dot . must prefix the line number which is decimal. Example: C:\HIDE\USER\GE.ASM!.42 sets the breakpoint at the 42nd line of the file GE.ASM in directory \HIDE\USER of drive C. Example: .48 sets the breakpoint at the 48th line of the current active file. · Program symbol with or without the source file name. The format is [source_file_name!].symbol_name All are the same as the line number location format except that the line_number is replaced with symbol_name. The following program symbols are acceptable: - Label name - Section name - Procedure name - Dynamic data symbols defined in data section ® Format of Description Items - Content and External Signals The format of the content and external signals have four digital number options, similar to the format of Location absolute address. These four types of number are decimal, hexadecimal, binary and don¢ t-care bits. ® Format of Breakpoints List Box The Breakpoints list box contains all the breakpoints that have been added, including effective breakpoints and non-effective breakpoints. The Add button should be used to add new breakpoints to the list box, and the Delete button to remove breakpoints from the list box. The format of each breakpoint in the list box is as follows: {, , , } where is effective status. ²+² is effective (enabled) and ²-² is non-effective (disabled). is the space type and operating mode. ²C² is the code space, "D/R" is the data space with read, ²D/W² is the data space with write, ²D/RW² is the data space with read and write. , and have the same data format as the input form respectively. 39 HT-IDE3000 HT-IDE3000 User¢s Guide How to Set Breakpoints There are two methods to set/enable a breakpoint, one is by using the Breakpoint command from the Debug menu, the other is by using the Toggle Breakpoint button on the toolbar. The rules of the breakpoint mechanism are as follows: · If the breakpoint to be set is not in the Breakpoints list box (Fig 5-3), then the descriptive items must be designated first, then added to the Breakpoints list box. · As long as the breakpoint exists in the list box, it can be made effective by Enabling the breakpoint if it fails to be initially effective. · Press the OK button for confirmation. Otherwise, all changes here will not be effective. · When using the Toggle Breakpoint button on the toolbar, the cursor should first be moved to the breakpoint line, and then the Toggle Breakpoint button pressed. If an effective breakpoint is to be changed to a non-effective breakpoint, this can be achieved by merely pressing the Toggle breakpoint button. ® Note To Add a Breakpoint · Choose the Breakpoint command from the Debug menu (or press the hot key Ctrl+B) A breakpoint dialog box is displayed (Fig 5-3) · Designate the descriptive items of the breakpoint Set Space, Location items Set Content item and Read/Write check box if Space is the data space Set External signals if necessary · Press the Add button to add this breakpoint to the Breakpoints list box. · Press the OK button to confirm If the total count of the effective breakpoints is less than 3, the newly added one will take effect automatically after it has been added. If the Breakpoints list box is full, with 20 breakpoints, the Add button is disabled and no more breakpoints can be added. Fig 5-3 40 Chapter 5 Menu - Debug ® To Delete a Breakpoint · Choose the Breakpoint command from the Debug menu or press the hot key Ctrl+B A breakpoint dialog box is displayed (Fig 5-3) · Choose or highlight the breakpoint to be deleted from the Breakpoints list box · Press the Delete button to delete this breakpoint from the Breakpoints list box · Press the OK button to confirm ® To Delete all Breakpoints · Choose the Breakpoint command from the Debug menu or press the hot key Ctrl+B A breakpoint dialog box is displayed (Fig 5-3) · Choose the Clear All button to delete all breakpoints from the Breakpoints list box · Press the OK button to confirm · You can also click the Clear All Breakpoint button on the toolbar to accomplish this task. ® To Enable (Disable) a Breakpoint · Choose the Breakpoint command from the Debug menu or press the hot key Ctrl+B A breakpoint dialog box is displayed (Fig 5-3) · Choose the disabled (enabled) breakpoint from the Breakpoints list box · Press the Enable (Disable) button, to enable or disable this breakpoint · Press the OK button to confirm Trace the Application Program The HT-IDE3000 HT-IDE3000 provides a powerful trace mechanism which records the execution processes and all relative information when the HT-IDE3000 HT-IDE3000 is emulating the application program. The trace mechanism provides qualifiers to filter specified instructions and trigger conditions in order to stop the trace recording. It also provides a method to record a specified count of the trace records before or after a trigger point. Note When the HT-IDE3000 HT-IDE3000 starts emulating (refer to the section on Emulation of the Application Programs), the trace mechanism will begin to record the executing instructions and relative information automatically, but not vice versa. Initiating the Trace Mechanism The basic requirement for initializing the trace mechanism is to set the Trace Mode with or without Qualify. The Trace Mode defines the trace scope of the application program and Qualify defines the filter conditions of the trace recording. The available Trace Modes are · Normal Sets the trace scope to all application programs and is the default mode. · Trace Main Sets the trace scope to all application programs except the interrupt service routine programs. · Trace INT Sets the trace scope to all interrupt service routine programs. 41 HT-IDE3000 HT-IDE3000 User¢s Guide According to Qualify, the trace mechanism decides which instructions and what corresponding information should be recorded in the trace buffer during the emulation process. The rule is that an instruction will be recorded if its information and status satisfy one of the enabled qualifiers. The format of Qualify is the same as that of the breakpoint. If all program steps are required to be recorded, then No Qualify is needed (do not set the Qualify). The default is No Qualify. In contrast to the Trace Mode and Qualify, which specify the conditions of trace recording, both the Trigger Mode and Forward Rate specify the conditions to stop the trace recording. The Trigger Mode specifies the kind of trigger point, and is a standard used to determine the location of the stop trace point. The Forward Rate specifies the trace scope between the trigger point and the stop trace point. The available Trigger Modes are: · No Trigger No stopping of the trace recording condition. This is the default case. · Trigger at Condition A The trigger point is at condition A. · Trigger at Condition B The trigger point is at condition B. · Trigger at Condition A or B The trigger point is at either condition A or condition B. · Trigger at Condition B after A The trigger point is at condition B after condition A has occurred. · Trigger when meeting condition A for k times The trigger point is when condition A has occurred k times. · Trigger at Condition B after meeting A for k times The trigger point is at condition B after condition A has occurred for k times. Condition A and Condition B specify the trigger conditions. The format of condition A or B is the same as that of the breakpoint. The Loop Count specifies the number of occurrences of the specified condition A. It is used only when the Trigger Mode is from one of the last two modes in the above list. The Forward Rate specifies the approximate rate of the trace recording information between the trigger point and stop trace point in the whole trace buffer. The trigger point divides the trace buffer into two parts, before and after trigger point. The forward rate is used to limit the trace recording scope after the trigger point. The percentage is adjustable between 0 and 100%. Note It is not necessary for the trace recording scope to be equal to the forward rate. If a breakpoint is met before reaching the trace recording scope or a trace stop command (refer to: Stopping the trace mechanism) is issued, the trace recording will be stopped. A Qualify list box records and displays all qualifiers used by the Trace Mode. Up to 20 qualifiers can be added into the list box and and up to 6 qualifiers can be effective. A Qualifier can be disabled or deleted from the list box. The format of each qualifier in the Qualify list box has the same format as the breakpoint in the Breakpoints list box (refer to the section on Breakpoints, Format of breakpoints list box) 42 Chapter 5 Menu - Debug Stopping the Trace Mechanism There are 3 methods to stop the trace recording mechanism: · Set the trigger point (Trigger Mode) and Forward Rate as shown above · Set breakpoints to stop the the emulation and the trace recording. · Issue a Trace Stop command from the Debug menu (Fig 5-2) to stop the trace recording. Fig 5-4 lists all the requirements to use the trace mechanism. This is the result of the Trace command from the Debug menu. Trace Start/Stop Setup ® To Set the Trace Mode · Choose the Trace command from the Debug Menu A Trace dialog box is displayed as in Fig 5-4. · Choose a trace mode from the Trace Mode pull-down list box · Press the OK button Fig 5-4 ® To Set the Trigger Mode · Choose the Trace command from the Debug Menu A Trace dialog box is displayed as in Fig 5-4. · Choose a trigger mode from the Trigger Mode pull-down list box · press the OK button ® To Change the Forward Rate · Choose the Trace command from the Debug Menu A Trace dialog box is displayed as in Fig 5-4 · Use the Forward Rate scroll bar to specify the desired rate · Press the OK button 43 HT-IDE3000 HT-IDE3000 User¢s Guide ® To Setup the Condition A/Condition B · Choose the Trace command of the Debug Menu A Trace dialog box is displayed as Fig 5-4. · Press Condition A/Condition B radio button · Press the Set Condition button A Set Qualify dialog box is displayed as in Fig 5-5. · Enter the conditional information · Press the OK button to close the Set Condition dialog box · Press the OK button to close the Trace dialog box Fig 5-5 ® To Add a Trace Qualify Condition · Choose the Trace command from the Debug Menu A Trace dialog box is displayed as in Fig 5-4. · Press the Qualify radio button · Press the Set Qualify button A Set Qualify dialog box is displayed as in Fig 5-5. · Enter the qualifier information · Press the OK button to close the Set Qualify dialog box · Press the Add button to add the qualifiers into the Qualify list box below · Press the OK button to close the Trace dialog box ® To Delete a Trace Qualify Condition · Choose the Trace command from the Debug Menu A Trace dialog box is displayed as in Fig 5-4. · Choose the qualify line to be deleted from the Qualify list box · Press the Delete button · Press the OK button to confirm ® To Delete All Qualify Conditions · Choose the Trace command from the Debug Menu A Trace dialog box is displayed as in Fig 5-4. · Press the Clear All button · Press the OK button to confirm Note If there is no qualifier, all instructions are qualified by default. 44 Chapter 5 Menu - Debug ® Note To Enable (Disable) a Trace Qualify Condition · Choose the Trace command from the Debug Menu A Trace dialog box is displayed as in Fig 5-4 · Choose the disabled (enabled) qualifier line to be enabled (disabled) from the Qualify list box · Press the Enable (disable) button · Press the OK button to confirm At most, 6 trace qualifications can be enabled at the same time. Trace Record Format Once the trace qualify and trigger conditions have been setup, those instructions which satisfy the qualify conditions will be recorded in the trace buffer. The Trace List command of the Window menu provides the functions to view and check the trace record information, used for debugging the program. The trace record fields may not all be displayed on the screen except for the sequence number. These fields are dependent upon the settings in the Debug sub-menu from the Options menu. The text enclosed by the parentheses are the headings shown in the Trace List command of the Window menu. Fig 5-6 and Fig 5-7 illustrate the contents of the trace list under the different debug options. Fig 5-6 · Sequence number (No) For any of the trigger modes, the sequence number of a trigger point is +0. The trace records before and after the trigger point are numbered using negative and positive line numbers respectively. If all the fields of the Trace Record Fields (in the Debug Option of Option menu) are selected, the result is as shown in Fig 5-7. If No trigger mode is selected or the trigger point has not yet occurred, the sequence number starts from -00001 and decreases 1 sequentially for the trace records (Fig 5-6). · Program count (PC) The program count of the instruction in this trace record. 45 HT-IDE3000 HT-IDE3000 User¢s Guide · Machine code (CODE) The machine code of this instruction. · Disassembled instruction (INSTRUCTION) The disassembled mnemonic instruction is disassembled using an HT-IDE3000 HT-IDE3000 utility. · Execution data (DAT) The data content to be executed (read/write). · Source file name with a line number (FILE-LINE) The source file name and the line number of this instruction. · Source file (SOURCE) The source line statement (including symbols). All the above fields are optional except the sequence number which is always displayed. Fig 5-7 Note ® To set the trace record fields use the Debug command of the Options menu. To view the trace record fields use Trace List command of the Window menu. Clear the Trace Buffer The trace buffer can be cleared by issuing the Reset Trace command. Hereafter, the trace information will be saved from the beginning of the trace buffer. Note that both the Reset command and the Power-On Reset command also clear the trace buffer. 46 Chapter 5 Menu - Debug Debugger Command Mode In addition to the windows based debugging mode, the HT-IDE3000 HT-IDE3000 provides an alternative debugging mode, named the Command Mode. Under this mode, the user, in addition to obtaining the same functions as the menu-driven windows based debugging mode, also has access to additional debugging functions. These added functions include the ability to save the debugging history into a log file in order to execute these debugging commands automatically again as well as the ability to execute the previous debugging command without rewriting the command. Enter/Quit the Command Mode ® Enter to Command Mode From the Debug Menu of the HT-IDE3000 HT-IDE3000 select ²Command Mode² command. When the command mode has been entered a new screen will appear where commands can be entered after the ²HT8>² prompt on the second line. (Fig 5-8) ® Command Mode Window · The Command Mode Title bar shows the name of the present project file. · Any command can be entered after the ²HT8>² prompt on the command line. · When the command is entered the full command syntax will be displayed on the bottom status bar. · After the command has been entered at the ²HT8> xxxx² prompt, the next line will display the result of the command execution. (Fig 5-9) Another ²HT8>² prompt will then be displayed where another command can be entered. ® Quit from the Command Mode To quit from the Command Mode the normal windows exit method can be used or a Q[uit] command can be entered at the command prompt. Functions Supported by the Command Mode The following table shows the complete list of debugging statements supported by the Command Mode Command Function Description Command Syntax ! Execute a previous command !dd ; Comment ; BP Breakpoint Commands BP {-C|-D|-E|-L} [list|*]. ® list=11 12. BP Breakpoint Set BP S[,RW], Location [,Data] [,Ext Sig] DB Dump Program Memory DB [bank.address [,range] ] DR Dump Data Memory DR [bank.]address[,range] FA Fill string FA {bank.address|symbol} list. ®list=11 12. FB Fill bytes FB {bank.address|symbol} list ® list=11 12. GO Free run or run to the specified address GO [address] 47 HT-IDE3000 HT-IDE3000 User¢s Guide Command Function Description Command Syntax JP Jump to specified address directly JP address H Help H HIS History of commands HIS LF Load and execute a log file LF [-V] [LogFileName] LP Load project LP ProjectName Q Quit Q R Reset R POR Power on reset POR S Single Step (Into/Over/Out) S [-I|-V|-O] default option: ²-I² TR Trace list TR [-L] [length] W Open/Write/Close a Log file W {-S|-C} [LogFileName] In the debugging command syntax, if large brackets exist, this indicates that a parameter must be inserted otherwise an error will occur. Parameters are separated by a | symbol. Fig 5-8 ® Breakpoint Commands There are two breakpoint commands, their command syntax and function is as follows: · BP - Breakpoint Clear/Enable/Disable/List Syntax: BP [-C | -D | -E | -L ] [list | *] Parameter -C is the clear breakpoint parameter. This will delete the indicated breakpoint or clear all the breakpoints shown in the Breakpoint Box. Within the list there can be from 1~20 numbers 48 Chapter 5 Menu - Debug PROJECT NAME COMMAND LINE COMMAND SYNTAX Fig 5-9 which represent the breakpoints already setup. This means that more than one can be selected. For example, the three numbers 1 3 8 each separated by a space, indicates that the 1st, 3rd and 8th, breakpoints will be cleared. This has the same operation as the Delete function within the Debug/Breakpoint window. The star symbol * means that all the breakpoints already setup will be cleared. It has the same operation as the Clear All function within the Debug/Breakpoint window. Parameter -D will change all the indicated breakpoints to non-active, however the breakpoints will still remain shown in the Breakpoint Box. This command is the same as the Disable function within the Debug/Breakpoint window. The star * has the same operation as that described above. Parameter -E will change all the indicated breakpoints to active. , This command is the same as the Enable function within the Debug/Breakpoint window. The star * has the same operation as that described above. Parameter -L will display all the presently setup breakpoints in the window, the format is consistent with the contents of the Debug/Breakpoint window, where the first column shows the breakpoint number. The user can refer to this breakpoint number to setup the required numbers in the BP -C, BP -D, BP -E statement. Note 1. BP-L this parameter does not require list | 2. The HT-IDE3000 HT-IDE3000 can only have a maximum of 3 breakpoints active at the same time. 49 HT-IDE3000 HT-IDE3000 User¢s Guide If no C, D, E or L parameters are given then the Breakpoint command will be of the following type: · BP - Breakpoint Set Syntax: BP S [,RW] ,Location [,Data] [,Ext Sig] The parameter within the brackets is optional however under certain conditions it must be specified. S denotes a Space, where a choice can be made between C or D. The letter C indicates that the breakpoint is set in Program Code Memory, while D indicates that the breakpoint is set in the Data Memory (RAM) If D is chosen to replace S then the read/write option [,RW] must also be specified. The user can choose from R or W or RW. This is because if the breakpoints are set in the Data Memory then the choice exists for the breakpoint to be activated on either a read, a write or both a read and write. If C is chosen to replace S, which indicates program code, then it is not necessary to setup RW. The ²Location² parameter sets the position of the breakpoint, its format is: [SourceFileName!].LineNumber or [SourceFileName!].SymbolName If no SourceFileName is specified then the already opened source file will be taken as the default. If D is chosen to replace S then the ²Data² parameter must be setup. The breakpoint is setup at the specified location in the Data Memory and will initiate a break when a read or write with the specified data occurs. Ext Sig is a parameter that can be chosen, for its use consult the HT-IDE3000 HT-IDE3000 User¢s Guide ® Comment Command · Syntax: ; comment string This command is provided to give an explanation to the Log file. Any characters found after the ; will have no functional effect. ® Dump Command · Syntax: DB bank.address ,range DB range DB This command will display in the window, the contents of the specified program memory area. This area is specified by indicating the address, as well as the range and bank. The data is in hex format. If the address is specified but the bank number is not specified then the bank number will be taken as that of the current bank. If neither address nor bank number is specified the bank number will be taken as that of the current bank number and the address will be taken as that of the present Program Counter. If the range is not specified then the range value will be taken as 16 words. The range is not allowed to exceed one bank (2000h). An example of this statement would be 1.0f00 which would indicate that the bank number is 1 and the address value is 0f00h. · Syntax: DR bank.address ,range DR address This command will display in the window, the contents of the specified area of Data Memory. This data area is specified by its address, range and bank. The data is displayed in hex format. If the range is not specified then it will be set to 16 bytes. The range is not allowed to exceed one bank (100h) and the bank address is expressed in hex format. 50 Chapter 5 Menu - Debug ® Fill Command This command changes the contents of the Data Memory · Syntax: FB {bank.address | symbol}, list Will write the bytes specified in the list into a Data Memory area at the specified bank number and at the specified start address or symbol. Either a bank.address or symbol name can be used. Also the list can be more than one byte, however at least o