herunterladen

The products described in this document incorporate SuperFlash
technology licensed from SST.
is a registered trademark of Microsoft Corporation in the U.S. and/or other countries.
© Motorola, Inc., 2003
AN2548/D
9/2003
Serial Monitor Program for
HCS12 MCUs
Application Note
By Jim Williams
8/16 Bit Applications Engineering
Austin, Texas
Introduction
This application note describes a 2-Kbyte monitor program for the HCS12
series MCU. This program supports 23 primitive debug commands that allow
FLASH/EEPROM programming and debugging through an RS-232 serial
interface to a personal computer. The monitor supports primitive commands to
reset the target MCU, read, or modify memory (including FLASH/EEPROM
memory), read or modify CPU registers, GO, HALT, or TRACE single
instructions. To allow a user to specify the address of each interrupt service
routine, this monitor redirects interrupt vectors to an unprotected portion of
FLASH just before the protected monitor program. This monitor is intended to
be generic, so this single application (with very slight modification) should
execute on any HCS12 derivative.
Using this monitor program provides users with a cost-effective method to
evaluate their MCUs by writing programs, programming them into the MCU,
then debugging their applications for the HCS12 MCU — using only a serial I/O
cable and free software on their personal computer. The monitor does not use
any RAM other than the stack itself. Because the monitor uses the COP
watchdog for a cold reset function, user code should not enable or disable the
COP function (by writing to COPCTL). This development environment
assumes that the user resets to the monitor when performing debug
operations. If user code takes control directly from reset, and then an SCI0
interrupt or a SWI attempts to enter the monitor, the monitor may not function
because SCI0, the phase-locked loop (PLL), and memory initialization
registers may not be initialized as they would be for a cold reset into the
monitor.
There is no error handling for the PLL. If the frequency source is missing or
broken, the monitor will not function. Through the use of equate definitions, the
monitor sets the operating speed of the MCU to 24 MHz. User modification of
Freescale Semiconductor, I
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
nc
.
..
© Freescale Semiconductor, Inc., 2004. All rights reserved.