Page 150 - Programming Microcontrollers in C
P. 150
Programming Microcontrollers 135
down-loaded to the development board through either a serial or a
parallel link depending upon the individual system.
The development board has the microcontroller that is to be
emulated on board. This microcontroller sometimes operates in a
nonuser mode that allows internal bus access. A second computer on
the development board controls the operation of the microcontroller.
Code delivered from the host is put into memory accessed by the
microcontroller, and the microcontroller can operate as if the code
were contained within its internal memory. All of the I/O lines associated
with the microcontroller are brought to a header on the development
board, and a cable can be attached to this header to a plug-in device
that plugs into a target board. This target system then operates as if it
had a programmed microcontroller plugged into its socket.
The microcomputer on the development board has a complete
monitor system in its firmware. This monitor provides
communications with the host, down-loading and up-loading
capability and, most important, complete debugging firmware for
the microcontroller.
There is a single line assembler and disassembler in the firmware.
This package allows the programmer to examine and change memory
in assembly mnemonics. The microcontroller program can be single
stepped, run, address breakpointed, and the memory can be displayed
in normal hexadecimal format. The microcontroller runs at full speed
when emulating operation in a target board.
An experienced programmer will be able to debug code in a
microcontroller with the help of such a development board. There is
additional software available that provides a nice display of all
pertinent information in a single screen on the host computer. In this
area, you will also find that the microcontroller can be controlled
from a display of C source code on the host computer. This technique
is called source level debugging.
On later chips, another feature is incorporated to help the
development environment. This feature is called Background Debug
Mode, or ONCE. Both of these similar operations allow debug to
take place in an external computer without any access to the
microcontroller resources such as interrupts or memory. When a chip
is put into BDM, certain pins become a special serial input/output
port. There are several commands that can be delivered to this port
from an external computer. These commands allow the computer to