| |
Datasheet Home \ Datasheet Details
Download
PDF Abstract Text:
NOTICE
Part I Integrated Development Environment ............1
July 2006
NOTICE
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 System ............................................13 File Menu ............................................................15 Edit Menu............................................................16 View Menu ...........................................................16
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
Chapter 5 Menu - Debug.........................................33
Reset the HT-IDE3000 System...........................................34 To Reset from the 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
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
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
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
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
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
Part I Integrated Development Environment
Part I
Integrated Development Environment
Chapter 1 Overview and Installation
Chapter 1
Overview and Installation
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. 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
Holtek In-Circuit Emulator - HT-ICE
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
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 or later. Note that if Windows NT / 2000 / XP or later systems are used, then the HT-IDE3000 software must be installed in the Supervisor Privilege mode.
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
Fig 1-3
System Requirement
The hardware and software requirements for installing 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
Windows 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 CD into the CD ROM drive, the following dialog will be shown.
Fig 1-4
Chapter 1 Overview and Installation
Fig 1-6
· Step 3 The following dialog will be shown to ask the user to enter a directory name.
Fig 1-7
Fig 1-8
Chapter 1 Overview and Installation
Fig 1-10
· 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 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 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 provider can be requested to supply an ID number.
Fig 1-12
Chapter 2 Quick Start Chapter 2
Quick Start
This chapter gives a brief description of using 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
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:
Fig 2-1
Chapter 3 Menu File / Edit / View / Tools / Options Chapter 3
Menu File / Edit / View / Tools / Options
This chapter describes some of the menus and commands of the HT-IDE3000. Other menus are described in the Project, Debug and Window chapters.
Start the HT-IDE3000 System
Fig 3-1 · Click Start Button, select Programs and select Holtek HT-IDE3000 - Click the HT-IDE3000 icon
· If the last project you worked on 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-3 · If the last project you work on HT-IDE3000 is in simulation mode (using Simulator), then Fig 3-4 will be displayed to indicate that HT-IDE3000 will enter the simulation mode.
Fig 3-4 The 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.
Chapter 3 Menu File / Edit / View / Tools / Options
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
· 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 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. (Refer to Fig 3-6) · Line Move the cursor to the specified line (specified by line number) of the active file
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.
® 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 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.
Chapter 3 Menu File / Edit / View / Tools / Options
Fig 3-8
Writer
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
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
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.
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 is in simulation mode.
Data EEPROM Editor
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 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.
Chapter 3 Menu File / Edit / View / Tools / Options
Debug Command
This command sets the options used by the Debug menu (Chapter 5 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.
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 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.
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.
Chapter 4 Menu - Project
Chapter 4
Menu - Project
Fig 4-1
The 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 system, a working unit is a project with each user application described by a unique project. When developing an HT-IDE3000 application for the first time, the development steps, as described earlier, are recommended.
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.
The project name is a file name with the extension .PRJ.
Fig 4-2
Open and Close a Project
The 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.
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 window. Otherwise, the results are unpredictable. The HT-IDE3000 will retain the opening project information if the system exits from the HT-IDE3000 without closing the opening project. This project will be opened automatically the next time the HT-IDE3000 is run.
Manage the Source Files of a Project
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
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
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
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 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
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.
Chapter 5 Menu - Debug
Chapter 5
Menu - Debug
Fig 5-1
There are 4 kinds of reset methods in the 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 Debug menu (Fig 5-2) · Software power-on reset command in the HT-IDE3000 Debug menu (Fig 5-2)
Fig 5-2
Chapter 5 Menu - Debug
The effects of the above 4 types of reset are listed in table 5-1. Reset Item Clear Registers Clear Options Clear PDF, TO PC Value Emulation Stop Check Stand-Alone Power-On Reset () Yes Yes () () Yes Target Board Reset () No No 0 No() No Table 5-1 Software Reset Command () No No 0 Yes No Software Power-On Reset Command () No Yes 0 Yes No
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 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
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 debug commands.
During emulation of an application program, the corresponding project has to be open.
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 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 provides two step modes, namely manual mode and automatic mode. In the manual mode, the HT-IDE3000 executes exactly one step command each time the single-step command is executed. In the automatic mode, the 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.
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.
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 provides a powerful breakpoint mechanism which accepts various forms of conditioning including program address, source line number and symbolic breakpoint, etc.
Breakpoint Features
Description of Breakpoint Items
20, 14h, 00010100b, 10xx0011
Chapter 5 Menu - Debug
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. ® 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
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 provides a powerful trace mechanism which records the execution processes and all relative information when the 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.
When the 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.
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)
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
® 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
If there is no qualifier, all instructions are qualified by default.
Chapter 5 Menu - Debug
® 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.
· Machine code (CODE) The machine code of this instruction. · Disassembled instruction (INSTRUCTION) The disassembled mnemonic instruction is disassembled using an 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
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.
Chapter 5 Menu - Debug Debugger Command Mode
In addition to the windows based debugging mode, the 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
Functions Supported by the Command Mode
Free run or run to the specified address GO address
Fig 5-8
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.
Chapter 5 Menu - Debug
If path contains spaces then the name must be included in quotation marks otherwise an error condition will occur.
· Example: ®
If no LogFileName is specified, then the same name as the current Project File name will be taken as the filename. Parameter -V indicates that the command line and the execution result should be displayed in the window. If LF has no -V option, then the result record will be placed in a logfile of the same name with a .res file extension name. Log file is created using the W command. The contents can be modified by using the File and Edit function within the HT-IDE3000. However these contents must contain the correct Debugging Commands otherwise an error condition will occur, the execution will stop and return to the prompt sign
1. If spaces are included in the LogFileName then the name must be included within quotation marks otherwise an error condition will occur. 2. The logfile cannot contain the LF, W or Q commands.
Quit Command · Syntax: Q This command will end the Command Mode and return to the present window.
Chapter 5 Menu - Debug
1. If spaces are included in the LogFileName then the name must be included within quotation marks otherwise an error condition will occur. 2. After executing the W -S command the LF or W -S command cannot be executed.
Log File Format
HT-COMMAND Error Messages
Error Message Invalid Command Can not find HT-IDE Syntax error No project for debug ROM bank out of range RAM bank Out of range Description The command just entered is illegal The present environment is not the HT-IDE3000 The input syntax is incorrect No project file has been opened in the HT-IDE3000 The Program Memory dump has exceeded its range The Data Memory dump has exceeded its range
Can not run xxx command in emulation mode The xxx command cannot be executed Can not run xxx command in load file mode Can not run xxx command in write file mode Unterminated string No Command in history buffer Open xxx log file error Close xxx log file error Read xxx log file error Write xxx log file error Not in emulation status Sources have been modified, please rebuild Stop by user Get PC failed Stack overflow No debug info Cannot find the symbol Cannot find the register The xxx command cannot be executed The xxx command cannot be executed The character string definition requires balanced quotes History buffer empty Cannot open the log file Cannot close the log file Cannot read the log file Cannot write to the log file Before executing this command first enter emulation mode The original source file has been modified requiring the files to be rebuilt User has stopped execution Reading the value of the Program Counter has failed The stack has exceeded its capacity The setup breakpoints have no debug information The indicated symbol cannot be found The indicated register cannot be found
Chapter 6 Menu - Window
Chapter 6
Menu - Window
The HT-IDE3000 provides various kinds of windows which assist the user to emulate or simulate application programs. These windows (as shown in Fig 6-1) include program Data Memory (RAM), program code memory (ROM), Trace List, Register, Watch , Stack, Program, Output, etc.
Fig 6-1
· RAM The RAM window display the contents of the program Data Memory space as shown in Fig 6-2. The address spaces of the registers are not included in the RAM window because they are displayed in the register window. The contents of the RAM window can be modified directly for debugging purpose. The address displayed vertically is the base address while the horizontal single digit address is the offset. All the digits are displayed in hexadecimal format.
Fig 6-2 · ROM The ROM window displays the contents of the program code memory space as shown in Fig 6-3. The ROM address range is from 0 to last address where the last address depends upon the MCU selected in the project. The horizontal and vertical scrollbars can be used to view any address in the ROM window. The contents in ROM window are displayed in hexadecimal format and cannot be modified.
Fig 6-3 · Trace List The Trace List window displays the trace record information as shown in Fig 6-4. The contents of the trace record can be defined in the Debug command in the Options menu. Double click the trace record in the Trace List window will activate the source file window and the cursor will stop at the corresponding line.
Chapter 6 Menu - Window
Fig 6-4 · Register The Register window displays all the registers defined in the MCU selected in the project. Fig 6-5 shows an example of the Register window of HT48C70-1. The contents of the Register window can be modified for debugging. Note that the Register window is dockable.
Note that both address and data are displayed in hexadecimal format as shown in Fig 6-6. The symbol and their corresponding data will be saved by the HT-IDE3000 and displayed the next time the Watch window is opened. The symbols can be deleted from Watch window by pressing the delete key. Note that the Watch window is dockable.
Fig 6-6 · Stack The Stack window displays the contents of the stack buffer for the MCU selected in the current project. The maximum stack level is dependent upon the MCU selected. Fig 6-7 shows an example of the Stack window. The growth of the stack is
|