# Release Notes for ISD51
In-System Debugger for 8051 Devices

This file contains release notes and last minute changes that are not found in the printed manuals.

Information in this file, the accompany manuals, and software is
Copyright © Keil Software, Inc and Keil Elektronik GmbH.
All rights reserved.

## Contents

1. ISD51 Overview
2. How ISD51 Works
3. Integrating ISD51 with User Programs
4. ISD51 API Routines
5. Configuring uVision2 for ISD51
6. Debugging with ISD51
7. Troubleshooting
8. Known Problems
9. Technical Support
10. Contact Details

## ISD51 In-System Debugger Overview

ISD51 (In-System Debugger) provides a new debug monitor technology for 8051 user programs. ISD51 a configurable library that you link to your user programs to provide support for program testing via the 8051 on-chip UART.

The software and hardware requirements of ISD51 are minimal. It can run from external or on-chip CODE space and require no special hardware components like von Neumann-wired memory.

ISD51 works on both very small 8051 devices like the Philips LPC series and on complete systems that have access to the full CODE and XDATA address space.

### Features

- Controlled program execution with single-stepping and multiple software breakpoints.
- Viewing and changing CPU registers and memory.
- Access to Special Function Registers (SFRs).
- Support for hardware breakpoint registers that are available on some 8051 variants.
- Execution of 8051 user programs in full speed when no software breakpoints are set. Hardware breakpoints do not affect execution speed.

### Requirements

- One 8051-compatible on-chip UART.
- 500-700 bytes of program code—depending on the number of SFRs.
- 6 bytes stack space.
- 1 byte IDATA RAM.
- 2 bytes IDATA RAM for each software breakpoint defined.

### Benefits

- No special hardware modifications to your target system are required.
- ISD51 may be used with any standard 8051 derivative.
- Program code can be stored in on-chip Flash/EPROM/ROM or in off-chip EPROM.
- No von Neumann memory, no XDATA space, no registers, and no bit-addressable space is required.
- ISD51 may be linked and shipped with the final end-product. ISD51 firmware is royalty-free.
- ISD51 protects your software investment since it may only be used when the original source code is available.

## How ISD51 Works

ISD51 adds a serial interrupt function (ISD51 interrupt) for the 8051 UART to your user program. When ISD51 connects to the uVision2 Debugger, the 8051 enters the ISD51 interrupt function. As long as the program execution is stopped, the 8051 program runs only the ISD51 interrupt function. When the uVision2 Debugger issues a Go command, the 8051 leaves the ISD51 interrupt function and executes the user program.

If no breakpoints are set or if all breakpoints set are hardware breakpoints, the 8051 executes the user program in full speed. If software breakpoints are set, the 8051 enters the ISD51 interrupt function after each 8051 CPU instruction. The ISD51 interrupt checks if the 8051 program reached a breakpoint address and, if so, begins communication with the uVision2 Debugger. Therefore, the 8051 program executes considerably (about 100x) more slowly when software breakpoints are used.

Since the ISD51 In-System Debugger is implemented as an interrupt function it is not possible to set breakpoints or single step in other interrupt functions that have the same or a higher priority than the ISD51 interrupt. By default, the ISD51 interrupt function uses interrupt priority level 0.

The uVision2 Debugger sends a 0xA5 character to the ISD51 interrupt function to halt the user program and start communication with the debugger. For this reason, 8051 program must be started when the uVision2 Debugger is invoked.

### ISD51 Side Effects

- Works only when the ISD51 interrupt and the global interrupt system is enabled. You may, of course, disable ISD51 operation during critical program sections.
- Allows breakpoints even in ROM. If software breakpoints are set, the 8051 program runs under control of the ISD51 interrupt function and execution speed is degraded about 100x (programs run 100 times slower).
- Breakpoints or program single-stepping is not possible in 8051 interrupt functions that have the same or higher interrupt priority level than the ISD51 interrupt.
- If the ISD51 interrupt is enabled it is possible to stop 8051 program execution from within the uVision2 Debugger using the Stop toolbar button.

## Integrating ISD51 with User Programs

The following steps are required to add ISD51 features to your application.

1. Copy ISD51.A51 and ISD51.H into your project folder from the \C51\ISD51 folder.
2. Add ISD51.A51 to your uVision2 Project.
3. Add ISD51.H to the C module that contains the main C function (using #include "ISD51.H").
4. Check the configurations settings in ISD51.H and modify them, if necessary, to match your target hardware. The default configuration is suitable for classic 8051 devices with 256 bytes of on-chip DATA/IDATA and a standard 8051-compatible on-chip UART.
5. Add baud rate initialization code for the on-chip UART to your C main function. You may copy this from the \C51\EXAMPLES\HELLO example program.
6. Add the appropriate ISD51 startup function to your C code.
   - ISDinit: Initializes ISD51 and starts user program. When the uVision2 Debugger connects, program execution halts.
   - ISDwait: Initializes ISD51 and waits until the uVision2 Debugger connects.
   - ISDcheck: Checks to see if the uVision2 Debugger has connected with the 8051. If so, the ISD51 interrupt is initialized. ISDcheck must be called periodically, for example in the main loop of a typical embedded program.
7. Build the user program and burn it into the 8051 device with classic programming utilities like the Flash utilities from the silicon vendor, download programs from evaluation board providers, or an EPROM device programmer.

Program that demonstrate how to add ISD51 capability are provided in the \C51\ISD51\EXAMPLES folder.

## ISD51 API Routines

ISD51 provides several functions your application may use. These functions and macros are prototyped in ISD51.H in the \C51\ISD51 folder.

- void ISDinit (void)
  This routine initializes ISD51 for communication with the uVision2 debugger. After invoking this routine, your 8051 user program continues execution normally.
- void ISDwait (void)
  This routine initializes ISD51 for communication with the uVision2 debugger and waits until communication is established with the debugger. This function does not return until the uVision2 Debugger connects with ISD51.
- void ISDcheck (void)
  This routine checks to see if the uVision2 Debugger is trying to connect with the 8051. If so, ISD51 is initialized for communication with the uVision2 debugger. ISDcheck should be called periodically in your 8051 user program.
- void ISDbreak (void)
  This routine forces execution of the ISD51 interrupt function. This allows you to hard-code breakpoints into your user program. The uVision2 Debugger must be connected to the user hardware before you invoke this routine.
- void ISDdisable (void)
  This routine disables the ISD51 interrupt which allows you to protect critical program sequences in your user program from software breakpoints. Once this routine is invoked, it is not possible to single step or set software breakpoints until ISDenable is invoked.
- void ISDenable (void)
  This routine enables the ISD51 interrupt. After invoking the ISDdisable routine, you must invoke ISDenable to re-enable the ISD51 interrupt.

## Configuring uVision2 for ISD51

Once you have added ISD51 to your program, you may configure the uVision2 Debugger for communication with the 8051 target system.

1. Start the 8051 application on the target system before you start the uVision2 Debugger.
2. In uVision2, select Project - Options for Target - Debug: Use: Keil ISD51 In-System Debugger.
3. In the same dialog, enable Load Application at Startup so that the uVision2 Debugger loads the symbolic information for your 8051 user program.
4. In the same dialog, disable Go till main. Your user program will be started by the hardware reset of the 8051 target system.
5. In the same dialog, open the ISD51 Driver Settings dialog to configure the following:

> ### COM Port Settings

> - Port: PC COM port used to connect to the 8051 target hardware.
> - Baudrate: Communication baud rate with the 8051 target hardware.
> - RTS Logical: Level on the RTS line of the COM Port (see below).
> - DTS Logical: Level on the DTS line of the COM Port (see below).

> ### RTS and DTS settings

> - Active: Signal is always active during uVision2 Debugger communication.
> - Inactive: Signal is always inactive during uVision2 Debugger communication.
> - Reset Active: Signal is active for 500 mSec on Reset Command of uVision2 Debugger.
> - Reset Inactive: Signal is inactive for 500 mSec on Reset Command of uVision2 Debugger.

> ### Cache Options

> The ISD51 driver implements data caches to speed-up screen updates.

> - Disable the cache options to view actual (un-cached) values of DATA (and SFR), IDATA, or XDATA space when you halt program execution. This way you can be certain you are viewing the current values of I/O ports, timers, or memory-mapped peripherals.
> - Enable the cache options to obtain maximum performance.

> ### Code Breakpoint Options

> This option selects whether or not ISD51 uses software breakpoints, hardware breakpoints, or a combination of both.

> - If your target 8051 device does not support hardware breakpoints, you must select software breakpoints only.
> - If your target 8051 device supports hardware breakpoints, you must use software breakpoints when no hardware breakpoints are available.

> ### Miscellaneous Options

> The Verify if Application in ROM is identical to current Project option selects whether or not the uVision2 ISD51 Debugger Driver compares the program code in the 8051 target with the program code of the current project when initializing ISD51 communications. You may disable this option to speed-up the connection time of the debugger with the target system.

> ### ISD51 Identification

> This box displays the version number and other status information when the uVision2 Debugger connects to the ISD51 running on the 8051 target system. You may check this information when you open the ISD51 Driver Settings dialog during debugging.

## Debugging with ISD51

Once the uVision2 Debugger is configured, you may start debugging with Debug - Start/Stop Debug Session. The uVision2 Debugger connects to the 8051 target system via the ISD51 software.

ISD51 supports most uVision2 debugger features. For instance, you may single-step through code, set breakpoints, and run your application. Variables may be viewed using the standard debugger features.

### uVision2 Restrictions When Using IDS51

There are several restrictions you must consider when using ISD51 and the uVision2 Debugger.

- It is not possible to use Debug - Memory Map to change the memory mapping of the 8051 system. This is because the memory mapping of the 8051 target system depends on hardware components.
- The Performance Analyzer, Call Stack, Code Coverage, and Step Out command are not available with ISD51.
- The Periodic Window Update Option may not be used with ISD51.

## Troubleshooting

If the uVision2 Debugger does not connect to the ISD51 hardware you should first verify that the target system's serial interface is correctly configured. You may check this by using the uVision2 Simulation as follows:

1. Select Project - Options for Target - Debug: Use Simulator.
2. Start program simulation with Debug - Start/Stop Debug Session. This loads the user program in simulation mode.
3. Start running the user program (Debug - Go).
4. Verify the settings of the UART with the Serial Port Dialog (Peripherals - Serial). The baud rate is displayed correctly if you have entered the correct XTAL frequency in Project - Options for Target - Target - Xtal. Typically, the baud rate will not match the PC baud rate 100%, but it should be within 2.5%.
5. Check serial communications:
   - Open the serial communication window (View - Serial Window).
   - Right-click in the Serial Window and select Hex Mode from the context menu.
   - Enter sin=0xA5 in the Command Window to Input a 0xA5 character in the serial input stream.
   The uVision2 Simulator should then simulate the IDS51 interrupt and display 0xF7 followed by 6 more hex values in the serial window.

If everything is correctly configured and you are still unable to connect to the IDS51 hardware, your 8051 program may call the following function after initializing the serial interface.

    /*
    * Test Function: verify serial communication with HyperTerminal
    */

    void TestSerial (void) {
      char c = 'A';

      TI = 1;
      while (1) {
        if (RI) {
          c = SBUF;
          RI = 0;
        }

      while (!TI);

      TI = 0;
      SBUF = c;
      }
    }

This function outputs the character A via the serial interface. If you transmit a character via the serial interface to the user program, that character will be sent instead. You may check this using a terminal program like HyperTerminal to see if the 8051 correctly outputs the A character and if the output character changes when you send a different character.

## Known Problems

This section lists all known problems with the ISD51 In-System Debugger.

> Hardware Breakpoints On The TI MSC1210

> The TI MSC1210 implements hardware breakpoint registers that, when used, may generate the following side effects:

> - Execution may stop up to two CPU instructions after the breakpoint.
> - Execution may stop when a 1-Byte or 2-Byte CPU instruction executes immediately before the breakpoint.
> - XDATA access breakpoints do not work and, even if they did, it is impossible to distinguish READ or WRITE accesses.

## Technical Support

At Keil Software, we are dedicated to providing you with the best development tools and technical support. That's why we offer numerous ways you can get the technical support you need to complete your embedded projects.

- Technical Support Knowledgebase
  More than 1500 technical support questions and answers are available in the Support Solutions Knowledgebase. When a new question arises, it is added to the knowledgebase which is continuously published to the Web. This enables you to get technical support at times when our support staff is unavailable.
- Application Notes
  Numerous Application Notes help you decipher complex features and implement robust applications.
- Example Programs and Files
  Utility programs, example code, and sample projects are regularly added to the Download File section of the web site.
- Discussion Forum
  Post questions, comments, and suggestions to the Keil Software Discussion Forum and interact with other Keil users around the world.

Many of the features of our Technical Support Knowledgebase and Web Site are the results of your suggestions. If you have any ideas that will improve them, please give us your feedback!

## Contact Details

If you experience any problems or have any questions about this product, contact one of our distributors or offices for assistance.

In the USA... Keil Software, Inc. 1501 10th Street, Suite 110 Plano, TX 75074 USA 800-348-8051 - Sales 972-312-1107 - Support 972-312-1159 - Fax sales.us@keil.com - Sales E-Mail support.us@keil.com - Support E-mail |  | In Europe... Keil Elektronik GmbH Bretonischer Ring 15 D-85630 Grasbrunn Germany +49 89 456040-0 - Sales +49 89 456040-24 - Support +49 89 468162 - Fax sales.intl@keil.com - Sales E-Mail support.intl@keil.com - Support E-Mail

Copyright © Keil Software, Inc. and Keil Elektronik GmbH.
All rights reserved.
Visit our web site at www.keil.com.