ISD51 In-System Debugger

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


Revision History:


Contents

  1. ISD51 Overview
  2. How ISD51 Works
  3. Integrating ISD51 with User Programs
  4. ISD51 API Routines
  5. Flash Breakpoints
  6. Hardware Breakpoints with TI MSC1210
  7. Configuring µVision2 for ISD51
  8. Debugging with ISD51
  9. Troubleshooting
  10. Technical Support

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 requires 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

Requirements

Restrictions

The current version of ISD51 has the following restrictions:

Benefits

How ISD51 Works

ISD51 adds a serial interrupt function (ISD51 interrupt) for the 8051 UART to your user program. When ISD51 connects to the µVision2 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 µVision2 Debugger issues a Go command, the 8051 leaves the ISD51 interrupt function and executes the user program.

When you set flash breakpoints or hardware breakpoints, the 8051 executes the user program in full speed. Flash breakpoints can be easily configured for many current 8051 device variants that support In-Application Flash programming with sector sizes up to 128 Bytes.

If the device does not support flash breakpoints you may use software breakpoints. In this case, 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 µVision2 Debugger. Therefore, the 8051 program executes considerably (about 100x) slower when software breakpoints are used.

The µVision2 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 µVision2 Debugger is invoked.

ISD51 Side Effects

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 µVision2 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.
  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.

Initialization Routines

ISD51 is initialized with one of the following function calls:

Breakpoint Handling

ISD51 breakpoint handling can be influenced with:

User I/O via Serial Debugging Interface

ISD51 specific serial user input/output functions work via the UART interface that is used for debugging. The functions are enabled with the defines ISD_PUTCHAR and ISD_GETKEY. When enabled, functions like printf and getchar communicate via the Serial Window of the µVision2 debugger. Since the UART is already configured for ISD51 communication, no additional serial initialization is required. ISD51 defines in addition to the standard putchar and _getkey functions:

Flash Breakpoints

ISD51 supports flash breakpoints for devices with IAP (In-Application Programming) support and flash block sizes up to 128 Bytes. ISD51 modifies for flash breakpoints the code memory and inserts CALL instructions. The IAP functions are configured in the ISD51.H header file that you have added to your project. The define CBLK_SZ specifies the flash block size and the macro CWRITE defines a flash erase and programming function.

Flash Breakpoint Side Effects

To perform a flash breakpoint, ISD51 inserts a CALL instruction in the user program. This avoids extra hardware for the breakpoint logic. However, the CALL instruction occupies up to three bytes and therefore breakpoints may have side effects when set before a label (jump target) on one or two byte CPU instructions. The following example demonstrates this problem.

User Program

0100  E4        CLR     A
0101  74 03     MOV     A,#3
 :     :         :
 :     :         :
0110  80 ED     SJMP    0101

First, the user program is executed until address 0x110 with a µVision2 debugger command like G, 0x110.

Then, a breakpoint is set at address 0x100. The breakpoint is realized by writing a CALL instruction into the user program which means that the user program is modified by the breakpoint.

User Program Modified Due to Flash Breakpoints

0100  XX        LCALL           ; An CALL instruction is
0101  XX XX     ???             ; written at address 0x100. 
 :     :         :
 :     :         :
0110  80 ED     SJMP    0101

When the user program continues execution at address 0x110 the program jumps to address 0x101. But this memory location is modified due to the breakpoint at address 0x100. Therefore, the MOV A,#3 instruction will be not executed and the behavior of the user program is unpredictable.

In C applications, use the disassembly window and check if the instruction sequence described above exists. The following C statements may cause such side effects:

Hardware Breakpoints on TI MSC1210

The TI MSC1210 supports hardware breakpoint registers that can be enabled in the ISD51.H header file with the define TI_MSC1210_BREAKS. When used, this hardware breakpoints may generate the following side effects:

Configuring µVision2 for ISD51

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

  1. Start the 8051 application on the target system before you start the µVision2 Debugger.
  2. In µVision2, 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 µVision2 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

RTS and DTS settings

Cache Options

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

Code Breakpoint Options

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

Miscellaneous Options

The Verify if Application in ROM is identical to current Project option selects whether or not the µVision2 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.

If your application requires specific configuration areas, you may configure the verify address range with the defines CMP_START and CMP_END in the ISD51.H header file.

ISD51 Identification

This box displays the version number and other status information when the µVision2 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 µVision2 Debugger is configured, you may start debugging with Debug - Start/Stop Debug Session. The µVision2 Debugger connects to the 8051 target system via the ISD51 software.

ISD51 supports most µVision2 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.

µVision2 Restrictions When Using IDS51

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

Troubleshooting

If the µVision2 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 µVision2 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: The µVision2 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.

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.

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!


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