EVBU - An Open Source 68HC11 Simulator

Andrew Sterian
Padnos College of Engineering & Computing
Grand Valley State University


Top-Level | BUFFALO Emulation | Peripheral Emulation | Waveform I/O Version 0.6
July 17, 2004
Installation | Running EVBU | Limitations | Usage Notes | Copyright | To Do | Credits | History

Introduction

The Motorola 68HC11 is a popular microcontroller and several evaluation boards are available (including Motorola's original board, known as the EVBU) for exploring the capabilities of this microcontroller. This software is a 68HC11 simulator that emulates many aspects of an EVBU with a 68HC11 running the BUFFALO monitor program. The user interface to EVBU is similar (but not identical) to what a user would experience using a terminal program connected to the EVBU hardware. EVBU is free software licensed under the terms of the GPL.

In addition to a command-line emulation of BUFFALO, the EVBU software provides a logic-analyzer-like interface to the 68HC11 port pins. This allows you to view output waveforms and to construct and view input stimulus waveforms.

The main goal of the EVBU software is to aid in the understanding of the 68HC11 and of various concepts in digital systems. It is not the goal of EVBU to be a fast, complete, all-singing-all-dancing simulator (investigate THRSim11 or UMPS if you are looking for one). Only some of the 68HC11 peripherals are implemented. Thus, EVBU is intended mostly as a teaching tool, although it is a fairly capable simulator. The execution speed is on the order of 500X real time for an 8 MHz 68HC11. That is, it takes about 500 seconds to simulate 1 second of real time (on a 1 GHz Pentium processor). Improving the speed of the simulator is not a major goal of the project.

EVBU is written in pure Python and uses the wxPython graphical framework. It should run on any platform that supports the above applications. EVBU was developed with Python 2.1.1 and wxPython 2.3.2. Earlier versions of Python and wxPython may work, but there are no guarantees. Note that on Unix systems, wxPython currently requires GTK, so make sure this package is installed. Also note that wxPython's version is closely tied to the Python version, so if you need to upgrade your Python installation, you will probably also need to upgrade wxPython.

The EVBU program offers several enhancements over the actual BUFFALO monitor:

You can download the latest version of EVBU from:

http://claymore.engineer.gvsu.edu/~steriana/Python

Note that EVBU actually comes in two parts: PySim11, a Python package that is the actual simulation engine, and EVBU, another Python package that implements the interface to this engine. Both packages work closely with each other and will simply be referred to as "EVBU" in this document.

Installation

First, install Python 2.1.1 or later and wxPython 2.3.2 or later. If you already have the above packages (but in older versions) try running EVBU and see what happens...you may not need to upgrade.

Windows

Run the evbu0.5.exe installation program. I will assume you choose all of the default installation options. The installer will create and populate the following directories:

The above assumes you have Python installed in C:\Python21. The first two directories are where the simulator modules are located. The last directory contains the documentation, example files, etc. Also in this last directory is a sample batch file EVBU.BAT which shows you how to run the EVBU program.

Unix

Extract the evbu0.5.tar.gz file then install as follows:

The installer will create and populate the following directories:

The above assumes your Python library directory is as indicated (it may be elsewhere but the installer should be able to find it, so don't worry about it). The first two directories are where the simulator modules are located. The last directory contains the documentation, example files, etc. Also in this last directory is a sample shell script evbu which shows you how to run the EVBU program.

Running EVBU

Windows

If Python has been registered as the official handler of .PY files, then you should be able to just create a desktop link to the evbu.py file, and clicking on the link will start EVBU. Right-click on the desktop, select "New-->Shortcut..." and Browse to find the evbu.py file. Give it a shot...it'll probably work.

Otherwise, you run EVBU by invoking the Python interpreter on the evbu.py file of the evbu package. For example:

c:\python21\python c:\python21\evbu\evbu.py

Pretty painful, huh? The idea is that you put the above in a batch file and place the batch file somewhere on your PATH. The EVBU.BAT file that comes with this software contains a line like the above (which you can customize to your own installation). Place the EVBU.BAT file somewhere on your path...C:\WINDOWS is probably a safe bet. Open a command window (a.k.a DOS box) and type "echo %PATH%" (no quotes) for more ideas of where to place this batch file.

Unix

You run EVBU by invoking the Python interpreter on the evbu.py file of the evbu package. For example:

python /usr/local/lib/python2.1/site-packages/evbu/evbu.py

The evbu shell script that comes with this software contains an example for running EVBU, modelled on the above. Place this shell script on your path. I suggest /usr/local/bin if you have write permission, or $(HOME)/bin if you do not (and make sure $(HOME)/bin is on your path).

Limitations

The limitations of EVBU are partially intentional (to preserve similarities with the spartan BUFFALO interface) and partially due to the goals of the software. The current limitations are listed below; ongoing development may chip away at them over time.

Usage Notes

Program Options

The '-h' option prints a brief summary of available options. The starting address can either be set manually using the 'RM' command, or via the S19 file using the 'END' directive, or via the '-s' EVBU option. The '--use-swi' option allows your program to use SWI for its own purposes and does not return control back to the simulator. The '--no-buffalo' option does not install the BUFFALO service subroutines and interrupt vectors. The '--no-timer' and '--no-pio' options prevent the timer and parallel I/O peripherals, respectively, from being included in the simulation and speed up execution.

Command Line Interface

If you are familiar with the BUFFALO monitor, you should find the interface of this software to be familiar. The best documentation for the command line interface is obtained by typing 'help command' for the command of interest. Typing 'help overview' gives a list of commands. Some commands have the same name as the BUFFALO counterparts but are slightly different. The LOAD command, for example, is not 'LOAD T' as in BUFFALO but simply 'LOAD FILENAME.S19' which loads an S19 file directly into memory. More information is available in the BUFFALO Commands section.

New commands worthy of investigation are:

The trace command 'T' displays the instruction that just executed along with the register values after execution, just like BUFFALO, but then also displays the next instruction that will be executed. This may be confusing at first but I believe it makes debugging much easier.

The point behind the 'TN' and 'TY' commands is to help test various paths through your program without a lot of work. For example, if you have a 'BRSET' instruction testing the state of an external port pin, you can use 'TY' to simulate the effect of having the pin set and the branch taken.

Symbolic Debugging

EVBU supports loading MAP files in the format generated by the -MTA option (i.e., generate an ASCII map file) of the ASM11 freeware 68HC11 assembler. When the 'LOAD' command is issued, the S19 file name has its extension replaced to .MAP and the corresponding file is sought in the same directory. If it exists, it is automatically loaded. The 'LOADMAP' command can also be used to load a specific MAP file.

When a MAP file is loaded, the symbols in the file are available as constants. For example, rather than setting a breakpoint by using an absolute address, a symbol name can be used instead. NOTE: Symbol names in EVBU are case-insensitive. Do not enable the -C option of the ASM11 program to allow case-sensitive labels.

The MAP file also contains line number information from the source file. When a MAP file is loaded, the 'L' command will display source code surrounding the line that represents the current value of the program counter. Similarly, tracing through instructions with the 'T' command will display source lines.

BUFFALO Subroutines

Many of the BUFFALO subroutine entry points such as OUTSTR and HEXBIN are supported using "virtual functions." This is a concept supported by PySim11 which traps execution at certain addresses and rather than executing 68HC11 code invokes a Python function instead, then issues a simulated RTS instruction. For example, the following 68HC11 assembly code:

OUTSTR    EQU $FFC7
          LDX #hello
          JSR OUTSTR
          SWI
hello     FCC 'Hello!'
          FCB 4,13

will print the string 'Hello!' just as it would under BUFFALO. This support of BUFFALO also extends to the interrupt table. A secondary interrupt table is created at $00C4 which contains a list of JMP instructions to interrupt service routines, as with the actual BUFFALO monitor.

Copyright & License

Copyright © 1999-2002 Andrew Sterian. All Rights Reserved. mailto: steriana@claymore.engineer.gvsu.edu

Both EVBU and PySim11 come with ABSOLUTELY NO WARRANTY. This is free software licensed under the terms of the GNU General Public License. You are welcome to redistribute this software under certain conditions. For more details, see the previous link.

To Do

  1. Thorough testing.
  2. Loading of symbols from GCC-generated code.
  3. IRQ and XIRQ
  4. A/D converter
  5. Apply memory protections to the PySim11 engine to emulate the 68HC11E9 and display 'rom' or raise an exception when non-RAM is written to.
  6. Allow entry of expressions rather than just constants
  7. Better breakpoint handling: one-time-only breakpoints, breakpoints with conditions and expressions, actually using the count field of a breakpoint to stop only after some hits, automatic actions on breakpoint hit, breakpoints on memory changes, etc.
  8. Better documentation, tutorial, more examples.

Credits

This help file is based on a template for the help file for mxTools by M.A. Lemburg. This software was created with VIM; thanks to the authors of this program and special thanks for the Python syntax support. Thanks to Tony G. Papadimitriou for his freeware ASM11 assembler. Thanks to Mark Wicks for finding bugs and contributing patches. Thanks to the wxPython and wxWindows authors for great Open Source contributions, and, of course, to the Python developers and support community.

History

Version 0.6 -- July 17, 2004

Version 0.5 -- March 10, 2002

Version 0.4 -- June 15, 2000

Version 0.3 -- May 10, 2000

Version 0.2 -- February 29, 2000

Version 0.1 -- December 30, 1999


© 1999-2002, Copyright by Andrew Sterian; All Rights Reserved. mailto: steriana@claymore.engineer.gvsu.edu