Xplor8 - Version 1 Manual
This page intentionally left blank 2
CONTENTS 1 INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.1 The Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2 This Manual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.3 Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.4 Xplor8 Source Code . . .
Output Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Command History Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Command Edit Box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Status Line . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Information Sidebar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Register Display and Change . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Save Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Send Bytes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Launch Terminal Window . . . . . . . . . . . . . . . . . . . . . . .
APPENDIX F - RS232 COMMUNICATIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 APPENDIX G - GETTING STARTED and QUICK TOUR . . . . . . . . . . . . . . . . . . . . . . 93 APPENDIX H - DISTRIBUTION FILES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 APPENDIX J - Xplor8 REVISION HISTORY & KNOWN BUGS . . . . . . . . . . . . . . . . . .
1 INTRODUCTION 1.1 The Program Xplor8 is a simple loader/de-bugger/monitor interface for the Freescale (Motorola) HC908 micro controller units. I developed it as a simple alternative to some of the all-singing and dancing commercial programs, which I found a bit daunting for a beginner. It is not intended as an integrated development environment, but as a basic GUI interface to the MON08 firmware program built into these chips.
1.4 Xplor8 Source Code Xplor8 is written in Object Pascal as implemented by Borland, in my case in Delphi versions 4 and 7. Two additional components are used in Xplor8 which are not natively present in my Standard copy of Delphi 4: The chief one is the comms port component and for this I've used the one developed by Dejan Crnila which is available as freeware on the SourceForge site. The other is an extended combo box available from the Tory’s Delphi site.
1.7 Getting Started For those simply wishing to get started as soon as possible, I’ve put the basic installation and operating instructions in Appendix G. 1.8 Note on the Author Before you, the reader, complain that the program doesn’t appear to behave exactly as you would like, or lacks some essential feature, please bear in mind that I’m only a hobby programmer with an interest in the HC908 chips. I’m not working in a commercial environment.
2 MISCELLANEOUS 2.1 Installing Double click on the self-installing exe file, named something like ‘Install-Xplor8-xyz.exe’ which you have downloaded from the web site. This is a console application, so will start in a DOS box. You will be given the chance to change the default installation folder (C:\Program files\Xplor8) if you wish to install it somewhere else. The installation utility does not also place an icon on the desktop; if want one, you can right click on Xplor8.
2.5 Supporting Files To be fully operational, Xplor8 needs access to various supporting files of information. These are: 1. A configuration file for each version of the HC908 MCU range. This file records such data about the MCU as its memory map. Example name: 908QT1.cfg 2. Utility file(s) in standard Motorola S19 format to allow verification, programming and erasing of FLASH memory. Example name: QTY_UT1.S19 4. A file of information on the CPU opcodes. Default name: HC08_Opcodes.
talker to transmit the required bytes of MCU memory to Xplor8 where they will be stored in the corresponding address locations in the local memory array. From there they will be displayed in the output window. It should be noted that it is certainly not the case that the local memory is always a faithful copy of the MCU controlled memory. In fact, at start-up, the Xplor8 local memory is initially filled with zeros.
3 MON08 MONITOR FIRMWARE 3.1 Introduction The HC908 series of micro controllers come with a small monitor program (MON08) already programmed into ROM. This program has a software bit-bang emulation of the standard RS232 serial protocol and six low-level commands which together allow the user to read and write RAM memory, read the stack pointer (SP) and run a program.
3.2 Utility Files The on-chip monitor program has only basic commands which have to be used as the building blocks for more complex functions. In particular, the monitor ‘write’ commands can only write to RAM, so programming of Flash memory requires that another short program is available to do this. Such a program cannot itself reside in Flash, and therefore most HC908 chips have a Flash programming routine built into an auxiliary ROM area of memory.
This viewer may be launched either from the View Menu menu or from Settings>Security Bytes (page 38). The default log is limited to 100 records, and when the log reaches this size, the earliest records are progressively deleted as new ones are added. A warning is issued when the log is nearly full of new records, and the user is prompted to save a copy of the default log under a different name.
4 MEMORY MANAGEMENT 4.1 Writing to RAM The monitor ROM routines on the MCU are able to write directly to RAM, including the I/O registers. 4.2 Writing to FLASH Writing to (i.e. programming) FLASH memory is carried out transparently by Xplor8, subject to certain general conditions, as follows: • Flash memory has been successfully unlocked • The range to be programmed is not protected by a value in the FLBPR register - see the HC908 data sheet.
5 DEBUGGING 5.1 Breakpoints Tracing, and running programs to breakpoints, requires that breakpoints can be established at the right places in the MCU program code. On the HC908 chips only a single breakpoint can be set at one time, by writing a value to the breakpoint register. Programs may be run or traced in both RAM and FLASH memory.
6 PROGRAM FEATURES 6.
6.2 Main M enu The main menu provides access the various facilities in Xplor8. For more details see the individual menu descriptions later in this chapter. 6.3 Speedbuttons Nine speedbuttons are provided along the top of the main form to carry out common tasks. From left to right these are: Connect Click to carry out the Connect / Disconnect command (page 43), i.e. open or close the serial (COM) port. Reset Click to carry out the Reset command (page 56).
The division between the output and command history windows is a moveable splitter bar, allowing one window to be enlarged or reduced at the expense of the other. Word wrap is enabled in this window. A right-click context menu is available within the Output Window. This provides: • • • • Select All Copy Delete Clear All 6.5 Command History Window Displays a list of all the commands issued during the use of the program.
2. The command is copied to the command history list and to the output window, where it appears in green type. 3. If the command is correctly formatted, it is executed and the results, if any, will appear in the Output Window and in the Information Sidebar displays, as appropriate. Pressing the escape key while this box has focus will clear its contents, and stop any macro playing or recording. 6.7 Status Line This is divided into three panels as follows (from the left): 1.
6.8.2 T/G, L/U and BR addresses • T/G The T/G address show where Tracing and Running will next begin in the absence of a specific address • L/U The L/U address shows where Listing or Unassembling will begin in the absence of a specific address • BR The BR address shows the latest value written to the BRKH/L registers on the MCU.
Add... Click to open the Add to Watch dialog for adding an address to watch (see below). Delete Deletes an item selected in the Watch display. Clear All Deletes all the items in the display. Undelete Restores deleted items Adjust the relative sizes of the Start/Break Point display and the Watch window with the moveable splitter bar. The addresses and labels in the Watch display are remembered in the project file between sessions. 6.9 Add to Watch Dialog for adding items to the watch window.
Save Project... Saves the current configuration to a project file. If the file exists, it will be silently updated, if not, a file save dialog will appear. Keyboard shortcut: Ctrl+S Save Project As... Opens a file save dialog for the user to save the current configuration to a file with a new name. Keyboard shortcut: F12 Reopen... The sub-menu displays a list of up to ten of the most recently used project files. The top entry in the list is grayed-out if it is the one currently open. Import...
6.12 Actions M enu Menu to simplify the issuing of commands that involve the loading and saving of files to and from the MCU. Such commands all need a file name typed on the command line which is tiresome to do accurately. Using these menu items brings up a 'file open' or 'file save' dialog as appropriate, in which the user may select a file name in the usual way. Closing the dialog then fills in the command line and executes the command.
Load S19 to Local... As though the 'LDL' command had been issued - see the Load Memory command Save Local to S19... As though the 'SVL' command had been issued - see the Save Memory command Verify S19 v. Local... As though the 'VL' command had been issued - see the Verify command Load Binary to Local... As though the 'LDL' command had been issued - see the Load Memory command Save Local to Binary... As though the 'SVL' command had been issued - see the Save Memory command 6.
Contents Opens Help Topics at the Contents tab. Shortcut is Shift+F1. Getting Started Opens Help at ‘Getting Started’ - see Appendix G. Error Report... Opens the Error Report dialog for compiling a text file report on a problem encountered while using Xplor8, see page 79. Useful if email support is required. About Brings up the usual 'About' box. 6.16 Keyboard Shortcuts Keyboard Shortcuts - Main Window Active Ctrl+B Reset the MCU. Useful if you have fitted the remote resetting hardware.
Ctrl+C Copy to Clipboard Ctrl+V Paste from Clipboard Ctrl+X Cut to Clipboard Ctrl+Y Delete the line containing the insertion point (caret). Keyboard Shortcuts - Terminal Window Active Ctrl+I Send a binary image file Ctrl+Q Close the terminal window 6.17 Symbol Table/Register Display Window to display the currently-loaded symbol table (see Using a Symbol Table on page 63), or the current MCU control registers.
6.19 Security Bytes Log Viewer This window displays a log of security bytes. It may be used to view the default log, or one of the copies saved by the user. For general details of how Xplor8 handles security bytes see Security Bytes (page 14). On the “File Menu” are the following options: Open Default Log Click to display the default security byte log. This is the prime location updated every time Xplor8 detects a change in the security bytes Open Saved Log... Click to open a previously saved copy log.
Xplor8 after the write operation and are not simply the bytes which the user sent to program memory. New The user has successfully attempted an Unlock operation with a new entry in the 'Current Security Bytes' edit boxes in Settings>Security Bytes (page 38). 'New' is taken by Xplor8 to mean not previously noted in the default log file. XX An attempted Unlock operation with these bytes failed. Rd The user clicked the 'Read off MCU' button in Settings>Security Bytes.
7 CONFIGURATION 7.1 Settings Dialog The six tabs of the Settings Dialog contain various editable fields for the customization of Xplor8. All the configuration data on the tabs is stored in project files when the program closes, and the file name of the project file is itself stored in the Windows Registry, so that the settings are restored when Xplor8 is started again. At the bottom of the dialog are three buttons: OK Button Click to close and save the data entered in the various tabs.
E Clock Frequency Select the E clock frequency at which the MCU is working. See the HC908 data sheet for the chip that you are using. Those chips with an internal RC oscillator may be operating on either their internal oscillator or on an external crystal. Command Defaults Bytes to List Sets the default value for the number of bytes to list if the List command (page 50) is issued with only a starting address.
7.3 Settings>COM Port Tab for configuring the RS232 port which will be used to communicate with the target board. Note the caveats in USB-to-Serial Adapters on page 12. Port to use: Select an available COM port from the drop-down list. This combo box displays all the COM ports returned by the Windows 'Enumerate COM Ports' function. Baud Rate This combo box selects the baud rate which Xplor8 uses to communicate with the Monitor ROM program on the MCU.
PC controls reset Tick this box if the host PC is able to control the reset cycle on the target board. Using DTR/RTS Select whichever signal is used for the remote re-setting. With +ve/-ve going pulse Select the pulse polarity. For the avoidance of doubt about the meaning of RS232 'asserted', etc. the descriptions +ve/-ve refer to the actual polarity of the pulse with respect to the common ground pin (pin 5 on the DB9 connector).
7.4 Settings>Macros Tab for editing the boot script and for settings affecting macro library files. Run this script on boot Tick this check box and enter the desired commands in the edit box below. See Boot Script on page 69 for more details. Associate current macro with Project Check this box to cause the current macro library file to be reloaded when the current project is reloaded.
Command line format error Tick this box to cause a playing macro to stop if a command within the macro is formatted incorrectly, causing an error message beginning with the <–- symbol to appear in the Command History window. Command failure Tick this box to cause a playing macro to stop if a command within the macro has an unsuccessful result; for example the Verify Erase command (page 67) finds some un-erased memory. 7.
Such spaces can improve the readability of disassembled code by highlighting the places where sequential code execution is not possible. Run/Trace Display in O.W. This group of checkboxes governs the extent of the information provided in the output window during running and tracing. Instruction at Start : check this box to display a disassembly of the CPU instruction at the address at which running or tracing started.
7.6 Settings>Security Bytes Tab for working with the security bytes needed to unlock FLASH memory. See Security Bytes (page 14) for a full explanation of how Xplor8 handles these. Current Security Bytes ($FFF6..$FFFD) Enter the bytes (as four 2-byte hexadecimal words) into the edit boxes. These bytes will be sent by default by the Unlock command. The bytes are grouped into words to correspond with the vectors which reside at the addresses $FFF6 to $FFFD.
View Saved Copy Log... Click for a file-open dialog to select a previously-saved copy of the security byte log. The selected file is then displayed in the SB Log Viewer. Save Copy of Log... Click to open a save-file dialog so that you may save a copy of the default security byte log under a different name. Number of new records since last copy saved: Read-only edit box displaying the number of read/write records saved in the default log since a copy was last made by the user.
8 COMMANDS 8.1 General information Commands to Xplor8 to carry out monitoring, debugging and loading operations are typed in to the Command Edit Box at the lower left-hand corner of the main form. When the Enter or Return key is pressed, the command is copied to the command history list in the window above the edit box. It does not matter where the cursor is in the command line when the Enter key is struck, provided that the command line edit box has focus.
• Some commands can be limited to affecting only the local, Xplor8, copy of the MCU memory space (see local memory on page 11). All the sample L(List) commands above would result in listing MCU memory. Typing the following command lists only the local copy of memory: LL 80 8F The addition of the letter L after the first L limits the command to act only on the local memory. Because the local commands do not have to read and write to the MCU they will appear to work faster.
The tokenized forms are also used within project files to store file information. This simplifies the backup and transfer of projects to another computer, since file information is interpreted locally instead of by using absolute paths. 8.3 Labels instead of Addresses Label names, as listed in a loaded symbol table, or as found in the register information file, may be used wherever an address is expected. Label names are partially case sensitive.
8.4 Clear Local Memory CLM Format: CLM This command only clears the local memory held within Xplor8. It does not affect the CPU or its memory at all. 8.5 Clear Output Window CLS Format: CLS This command only clears the output window. It does not affect the CPU or its memory at all. 8.6 Connect / Disconnect Format CONNECT | DISCONNECT Command to open or close the RS232 serial COM port.
8.7 Edit Flash Byte EFB Format: EFB Address NewByte Command to change a single byte of FLASH memory. 'Address' is an address in FLASH memory, 'NewByte' is the new value. If the value at Address is $FF before the command, then the new value is simply written to memory; if not, then the whole page which includes the byte to be changed is read into Xplor8, the page erased, and then rewritten with the byte at 'Address' having the new value.
8.8 Fill Memory F Format: F StartAddress EndAddress|+Length ByteString|CharacterString or FL StartAddress EndAddress|+Length ByteString|CharacterString To fill memory with a repeating sequence of bytes, the start address must be explicitly stated (an asterisk will not do). Either the end address, or a length must be specified, followed by the bytes or character string to be placed in memory. Character strings must be delimited by matching pairs of single or double quotation marks.
8.9 Find Bytes FIND Format: FIND StartAddress EndAddress|+Length ByteString|CharacterString or FINDL StartAddress EndAddress|+Length ByteString|CharacterString To find a string of bytes within memory, the start address must be explicitly stated (an asterisk will not do). Either the end address, or a length must be specified, followed by the bytes or character string to be found. Character strings must be delimited by matching pairs of single or double quotation marks.
8.10 Find Next NEXT Format: NEXT To find the next occurrence of a string of bytes previously specified with a FIND command. This command actually searches only local memory, but this is unimportant as local memory will have been updated by the FIND command. No commands other that FIND or NEXT can be interposed between one use of FIND or NEXT and the NEXT command - for example, issuing the FIND command followed by the L(List) command will generate an error if the NEXT command is then issued.
8.11 Go (Run) G Format: G [StartAddress|* [Breakpoint] ] Command to run a program on the MCU. If StartAddress is not specified, or an asterisk is used, then the current value of the 'T/G' address will be used. If StartAddress is specified, or an asterisk is used, then a Breakpoint (page 17) may be specified at which execution will halt. Programs may be started at an address in RAM or FLASH.
8.12 List Macros LM Format: LM Command to list the names of the macros in the currently loaded macro library file. See Macros on page 68 for more information on the structure of macro files and commands. The following example lists the names of the macros in the currently loaded macro library file. LM If the file "Sample 1.
8.13 List Memory L Format: L [StartAddress|* [EndAddress|+Length]] or LL [StartAddress|* [EndAddress|+Length]] Command to list memory. If no end address is specified, then 16 locations will be listed, beginning at StartAddress. If no start address is specified in the command, then 16 locations will be listed, beginning at the current value of the Xplor8 'L/U' address - see the Information Sidebar on page 21. The default value of 16 locations may be changed in Settings>General.
8.14 Load Memory LD Format: LD Path&Filename.rec|.s19 LDL Path&Filename.rec|.s19 or LD Path&Filename.obj|bin StartAddress LDL Path&Filename.obj|bin StartAddress Command to fill memory from an S19 file or from a binary image file. The LD form writes to MCUcontrolled memory, LDL writes only to local memory. A complete path and filename, with extension, must be supplied. If a file in S19 record format is to be loaded, then the extension must be '.s19' or '.rec'.
8.15 Mass Erase ME Format: ME [Address] Command to mass erase all of FLASH memory. 'Address' is optional; if it is not included, or has any value other than $FFFF, then a confirmatory dialog appears to make sure that you really do wish to erase all the FLASH memory! By setting 'Address' to $FFFF, this dialog is skipped, which is useful in macros. This command is the only one which will work if the MCU is not unlocked by sending the correct security bytes. 8.
8.17 Modify Memory M, MM Format: M StartAddress or MM StartAddress Command to modify random access memory byte by byte. An explicit start address must be specified. When the command is given, Xplor8 will reply with the address and the current value at that address, followed by a period. Typing a new byte value, followed by the enter key, will change that memory location, then advance the memory address by one and present the next byte for modification.
leads to: 8010 30. This command cannot write to FLASH memory. 8.18 Page Erase PE Format: PE StartAddress [EndAddr|+Length] Command to erase one or more pages of FLASH memory. If only a single argument is supplied then only the page containing that address will be erased. If either StartAddress or EndAddress do not lie on an erase page boundary, a warning dialog appears to the effect that the range about to be erased is larger than you have specified.
8.20 Register Display and Change R Format: R I/OReg|CtrlReg or R I/OReg|CtrlReg=NewValue Command to display and modify the MCU Input/Output registers. I/OReg or CtrlReg stands for one of the HC908 I/O or control registers, e.g. PTA or DDRA. When using this command to change a register, no spaces should be left either side of the equals sign. The R command may be used in two different ways: 1.
8.21 Reset RESET Format RESET This command, which is only available when 'PC controls reset' is checked on the Settings>COM Port tab, and the necessary hardware is in place, allows Xplor8 to reset the MCU remotely by toggling an RS232 control pin. This is a convenience, but you can still use Xplor8 without this facility. This command is only available when connected, i.e. when the COM port is open. The 'Reset' speedbutton may be used as a quick way of issuing this command.
8.22 Save Memory SV Format: SV StartAddress EndAddress|+Length Path&Filename.rec|.s19 SVL StartAddress EndAddress|+Length Path&Filename.rec|.s19 or SV StartAddress EndAddress|+Length Path&Filename.obj|.bin SVL StartAddress EndAddress|+Length Path&Filename.obj|.bin Command to save a block of memory to a file in S19 or binary image format. The SV form saves MCU-controlled memory, SVL saves only local memory. The start address of the block to be saved must be stated explicitly ( an asterisk will not do).
8.23 Send Bytes SEND Format: Send BaudRate InterCharDelay ByteString BaudRate to suit the on-chip program. This baud rate applies only to the Send command, Xplor8 reverts to the MON08 interface communication rate at the end of the command. Note: not all baud rates are obtainable. On most PC systems the UART is a 16550 compatible device, and the Comms port driver is the standard one that comes with Windows.
8.24 Launch Terminal Window TERM Format: TERM This command opens the Terminal Window (see page 74). It is included so that a macro can put the user in direct terminal communication with a target board. Suppose, for example, that the demonstration program included in the distribution, TermDemo.asm, has been compiled to run at $8000.
8.25 Trace T Format: T[Repeats] [StartAddress|*] Command to trace a program in MCU controlled memory. If no explicit start address is specified, then tracing will begin at the current value of the 'T/G' address. Repeats is an optional number which specifies how many times the command is to be repeated. Note that repeats is specified as a decimal number, unlike all other values which are entered in hexadecimal. The value of 'Repeats' follows the letter T without a gap.
8.26 Step Over O Format: O[Repeats] [StartAddress|*] Command to step over a program in MCU controlled memory, that is to jump over subroutine calls. If the next instruction is not a subroutine call, then this command behaves exactly like the Trace command. The 'T' and 'O' commands may be freely inter-mixed. If no explicit start address is specified, then stepping/tracing will begin at the current value of the 'T/G' address.
8.27 Unassemble U Formats: U[Repeats] [StartAddress|*] or UL[Repeats] [StartAddress|*] or U [StartAddress|*] [EndAddress|+Length] or UL [StartAddress|*] [EndAddress|+Length] Command to unassemble (disassemble or reverse engineer) memory. If no start address is specified, or an asterisk is used, Xplor8 will use the current value of its own starting address, in L/U. Either an ending address, or a number of repeats may be specified (but not both).
The readability of disassembly listings may be enhanced by checking 'UnAsm: add spaces at code breaks' on the Settings>Debug tab. This will add a blank line in unassembly listings after the following instructions: • • • Unconditional jumps, including the BRA (Branch Always) instruction. No space is left if the jump address is that of the immediately following instruction, i.e. the jump was included simply to use up processor cycles. Return from Interrupt, RTI Return from Subroutine, RTS 8.
One or two factors have to be borne in mind when using a symbol table: • Labels are partially case-sensitive. When looking-up the symbol table, Xplor8 searches first for an exact case match, and returns the associated value if found, then makes a search ignoring case. This allows you to have two labels with the same spelling, but different capitalization (if your assembler can do it). • In an assembly language program, more than one label may reference the same value.
8.29 Unlock UNLOCK Format: UNLOCK [SecurityBytes] Use the unlock command to send the eight security bytes to unlock FLASH memory. 'SecurityBytes' is an optional string of eight bytes in hexadecimal notation; if omitted, the command will send the current security bytes nominated in Settings>Security Bytes (page 38).
8.30 Verify V Format: V Path&Filename.rec|.s19 or VL Path&Filename.rec|.s19 Command to verify memory by comparing it with an S19 format file. The V form verifies MCUcontrolled memory, VL verifies only local memory. If the path and filename includes spaces, then the whole argument string must be enclosed in single or double quotation marks, as in this example: V "C:\My Documents\HC908\S19 Files\First.S19" The path part of the filename may be shortened by the use of tokens - see Path Tokens on page 41.
8.31 Verify Erase VE Format: VE StartAddress [EndAddress|+Length] Command to verify that MCU memory is erased (bytes = $FF). If no arguments are supplied then the whole of FLASH memory will be checked. If StartAddress only is specified, then only that one address will be checked. Specifying both StartAddress and EndAddress will check the given range. The command works by loading a utility file to RAM, not by reading in MCU memory, so it works fast.
9 AUTOMATION 9.1 Introduction It is possible to automate the action of Xplor8 in four ways: 1. Three commonly-used commands can be issued automatically at start-up: • Connect / Disconnect • Reset • Unlock To use this feature, tick the appropriate boxes in Settings>General. 2. A group of commands may be executed automatically immediately after the initial commands mentioned above - see Boot Script on page 69. 3.
Definition of a macro begins with the word 'DEFM' (Define Macro) followed by the name of the macro. The name may in turn be followed by up to 10 Replaceable Parameters (see page 70) . The next line must be 'BEGIN'. Thereafter the commands that make up the macro are written in the order in which they are to be performed. The last line of the macro must be 'END'. You should note the following: • Blank lines, and those beginning with an asterisk in the first character position, are ignored.
then FF will be written to FLBPR immediately after unlocking - see Register Display and Change (page 55) for more details of the 'R' command. 9.4 Autostart Macro If a macro named 'AUTOSTART' is part of a library file already loaded when the MCU is re-booted, then this macro will be played automatically after the FLASH is unlocked, and after any boot script.
BEGIN MACRO3 "[Xplor8]\Samples\Looptest.S19" END Playing MACRO4 in the above example thus: Macro4 is equivalent to: LD "[Xplor8]\Samples\Looptest.S19" 9.6 Playing and Recording M acros 9.6.1 Playing Macros may be played by: 1. 2. 3. 4.
or the speedbuttons. Recorded command lines are appended to the end of whatever library script is open in the macro editor. 9.6.3 Stopping Playing or Recording Use the 'Stop' speedbutton, or click the 'Record' or 'Play' button again, as appropriate, when it will return to its inactive state. While the command edit box has focus, hitting the key will also stop playing and recording. 9.
Delete Line Delete the line containing the insertion point. Shortcut: Ctrl+Y Make into Macro If a line or lines have been selected in the editor, then this menu item will insert the necessary 'DEFM', 'BEGIN' and 'END' lines to form a complete macro definition. There is no need to be precise about the selection, provided that the selected area begins somewhere in the first desired line and ends somewhere in the last desired line.
10 TERMINAL WINDOW 10.1 Introduction Xplor8 has an integrated terminal window which allows the user to send and receive bytes with a connected MCU, provided a suitable program is running on the MCU. Bytes may be sent as ASCII text, or in their hexadecimal representation.
10.3 Interaction with the M onitoring/Debugging Functions It is basically only possible to use either the main Xplor8 monitor program or the terminal window at any one time, although it is quite possible to switch from one to the other provided the correct sequence is followed. A study of the section on the demonstration terminal communication program provided in the distribution, and of the code in that program, will answer most questions about the mutual compatibility of the monitor and terminal. 10.
Word Wrap Settings Terminal Settings... Check to wrap text in the display. Click to open the Terminal Window Settings dialog. Help Index Opens Help Topics at the Index tab. Shortcut is F1. Contents Opens Help Topics at the Contents tab. Shortcut is Shift+F1. Help on Terminal Opens the 'Terminal Window' help topic. 10.5 Terminal Window Settings Dialog for customization of the Terminal Window. Access this dialog from the 'Settings' menu item.
Delay (in milliseconds) between characters when sending a file Enter a time in milliseconds which will be inserted between the sending of each character from a binary image file, or from the keyboard when 'Send only on ' is checked. Valid values are 0 ms to 100 ms. 10.6 Terminal Demonstration Program In the distribution file is the program 'TermDemo.asm', which is installed by default in the '..\Samples\ sub-directory.
11 ERRORS 11.1 Communication and Echo Errors When Xplor8 sends a byte to the monitor firmware it usually expects to receive an echoed byte. By comparing the transmitted and received bytes, the program is able to assure the integrity of the RS232 communications link. If the echo is wrong, Xplor8 shows an error dialog. Two classes of byte error may be distinguished: Errors in the command byte received by the monitor firmware and errors in bytes being written to memory.
11.2 Diagnostics When an error dialog is displayed, diagnostic information is added to the Output Window. In the following example, I added the line 7FF0..7FFF to the 'External RAM' box in Settings>Memory. Now this area of memory is unimplemented on my system, so trying to use the Fill Memory command will fail: F 7FF0 7FF0 12 produces: Echo error writing RAM Addr 7FF0 Sent 12 Rcvd BE State:Stopped Reboot MCU? = No The constants in the information above are: Addr Address of byte at which the echo occurred.
APPENDIX A - ACKNOWLEDGM ENTS Motorola/Freescale For their flexible design of the HC908 micro controllers and for their good documentation Borland For their Delphi RAD tool - just the greatest Dejan Crnila For his comms port component for Delphi, v2.63. This is available from Delphi City: http://www.delphicity.
APPENDIX B - HARDWARE This diagram shows the basic set-up needed for Xplor8 to communicate with the MCU, to allow Xplor8 to reset the MCU remotely, and possibly make use of the mode switch output. NOTE: NOT TO BE USED FOR CONSTRUCTION. This diagram is a notional schematic only; intended to illustrate the intent of the various components. Please see the circuit diagrams and pin and voltage information published in the Freescale data sheet for the particular MCU that you are using.
3. Relay RL1 performs the power-on reset. A relay is likely to be particularly inappropriate here because of contact bounce. 4. Relay RL2 provides the switching between monitor mode and user mode. This is only required if you wish to switch modes remotely. 5. Vtst is the higher-than-Vdd voltage needed to access monitor mode. See the individual data sheets for its value.
APPENDIX C - COMM AND SUMM ARY CLM Clear the local, Xplor8, copy of memory CLS Clear output window CONNECT / DISCONNECT Open or close the COM port CRC CRCL CRC CRCL Compute a CRC-16 sum for a file or a block of MCU memory EFB Path&FileName.rec|s19 Path&FileName.
R IOReg|CtrlReg [=NewValue] Display and modify registers RESET Remotely reset the target MCU SV Save a block of MCU or local memory to an S19 or binary image file or SVL SEND StartAddr EndAddr|+Length Path&Filename.Ext StartAddr EndAddr|+Length Path&Filename.
APPENDIX D - SETUP FOR DIFFERENT M CU’s Using Xplor8 with different members of the HC908 family. Utility Files These are in S19 format and vary with MCU according to the amount of RAM available, and the address of the on-chip auxiliary routines, if any. The source files are also included in the distribution. Chip Type Utility files and Function HC908GP32 GP32_UT1.S19 GP32_UT2.S19 GP32_UT3.S19 Verifying FLASH programming Page and mass erasing HC908JB8 JB8_UT1.
APPENDIX E - COMM AND-LINE ERROR MESSAGE SUMM ARY Command Line Errors There are numerous ways in which what is typed on the command line may not be appropriate. If Xplor8 detects an error, it replies by echoing the command line to the Command history window with a left-pointing arrow and an explanatory message. The following table lists all the errors that may occur.
Address(es) overlap FLASH Command arguments, or the loading addresses in an S19 file, overlap FLASH.
BEGIN not found The 'BEGIN' directive was not found in a macro invoked from the command line No library macros found File not found Unrecognized file type Files for loading or saving can only have the extensions: .rec, .s19, .bin, or .
APPENDIX F - RS232 COMM UNICATIONS Introduction The RS232 standard, now more correctly the EIA232 standard, first appeared in the 1960's. It was originally written to standardize the interconnection of terminals and modems, in the days when one mainframe computer hosted many remote terminals. In the standard, a terminal is referred to as a DTE (Data Terminal/Terminating Equipment), and the modem as a DCE (Data Communication Equipment).
The pins are labeled with a functional description as follows. 'IN' and 'OUT' refer to the signal directions as they apply to the DTE: Pin Number Abbreviation IN or OUT Description 1 CD (or DCD) IN Carrier Detect. Used by a modem (DCE) to tell the DTE that it has detected a carrier signal 2 RxD IN Received Data. Data sent by the DTE to the DCE 3 TxD OUT Transmitted Data. Data sent by the DTE to the DCE 4 DTR OUT Data Terminal Ready. Used by the DTE to tell the DCE that it is operational.
Logic Levels It is this aspect which causes the most bewilderment among users, largely because of the counterintuitive naming conventions used. The negative voltage is referred to as a logic 1 or 'mark' condition and a positive voltage is referred to as logic 0 or 'space' condition. A driver transmitting data on the TxD pin idles in the logic 1 or 'mark' state, i.e. with a negative voltage output.
Break Signal The RS232 standard also specifies a signal called a Break, which is the sending of continuous Space (logic 0) values (no Start or Stop bits). I believe the name dates from the days when many news teleprinters used to be connected in series, and the break signal could be used to alert all machines that an important announcement was pending. As noted above, it does not mean a physical break in the connecting cable.
APPENDIX G - GETTING STARTED and QUICK TOUR Installation Double click on the self-installing exe file, named something like ‘Install-Xplor8-xyz.exe’ which you have downloaded from the web site. This is a console application, so will start in a DOS box. You will be given the chance to change the default installation folder (C:\Program files\Xplor8) if you wish to install it somewhere else. The installation utility should place an icon on the desktop; if it does not, you can right-click on Xplor8.
• Move to the ‘Security Bytes’ tab. Enter the sequence of bytes needed to unlock FLASH memory on the MCU. If you are using a brand new chip these will all be FF. • Close the Settings dialog by clicking 'OK'. Connecting to the Monitor Firmware (MON08) • Click the 'Connect' speedbutton at the left hand end of the row of buttons. • Reboot the MCU. Either using the reset button on the target board, or, if the appropriate hardware is in place, by clicking the 'Reboot Talker' speedbutton.
QUICK TOUR A quick introduction to the capabilities of Xplor8. The tour assumes that you are able to unlock FLASH memory on the MCU you are using - either because the chip is already fully erased or because you know the security byte sequence. If you are not able to unlock the chip, you will have to mass erase it first - see the last item below. 1.
LD "[Xplor8]\Samples\LOOPTEST.S19" Writing FB00..FB23 Loading complete 4. Unassembling Memory Confirm that you have loaded the 'Looptest' file satisfactorily by unassembling it. Type (upper or lower case): U FB00 FB1E Compare the listing in the output window with that in the LOOPTEST.LST file which is also in the \Samples\ subfolder. 5. Unassembling with Labels Open Settings>Debug, and check 'As last loaded S19 file' in the Symbol Table panel. Close Settings by clicking the 'OK' button.
8. Tracing a Program Type: T FB00 Depending on the selections in Settings>Debug, the output window will display information on the instruction and registers at the starting point, $FB00, and at the break point ($FB01). The status line should show 'Monitor Mode'.
APPENDIX H - DISTRIBUTION FILES The installation file Install-Xplor8-xyz.exe sets up the following files, in the sub-directories listed below. Note that the Xplor8 printed Manual itself is an Adobe Acrobat (.pdf) file which must be downloaded from the web site separately. Primary installation folder: ReadMe.txt Xplor8.exe InstallLib.dll UnInstall.
GP32_UT3.ASM JB8_UT1.ASM JKL_UT1.ASM JKL_UT2.ASM QTY_UT1.ASM QTY_UT2.ASM Sub-folder ..\Projects\ Default location for project files. Sub-folder ..\Registers\ Regs_908GP32.csv Control register information for the 908GP32 Regs_908JB8.csv Control register information for the 908JB8 Regs_908JL3.csv Control register information for the 908JL3 Regs_908QT1.csv Regs_908QT24.csv Regs_908QY1.csv Regs_908QY24.csv Control register information for the QT and QY chips Sub-folder ..\Samples\ TermDemo.
APPENDIX J - Xplor8 REVISION HISTORY & KNOWN BUGS Revision History Known Bugs: Does not display correctly on operating systems, such as Microsoft Vista®, when using displays set to 120 dpi or more. Display is effectively unusable. Only current workaround is to use 96 dpi.