AN2548 Freescale Semiconductor / Motorola, AN2548 Datasheet - Page 19

no-image

AN2548

Manufacturer Part Number
AN2548
Description
Serial Monitor Program for HCS12 MCUs
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
Stack Usage Details
MOTOROLA
the vectors are not needed at those times. Interrupts only become critical when
the monitor passes control to the user program through a GO or TRACE1
command.
The monitor also redirects programming commands for the $FF80–$FFFE
area to the $F780–$F7FF pseudo vector area. This allows programs that are
developed with the serial monitor program to execute normally if loaded stand
alone.
Worst-case stack usage by the monitor determines how much extra space a
user needs to allow below their application stack to support debugging with the
monitor. With the large RAM space available in the HCS12 Family, this is not
as important as with small MCUs with less RAM. Typically, the bootloader
functions for programming and erasing nonvolatile memory are done before
attempting to do any debugging on user programs. Because of this, the amount
of stack needed for these commands is generally not important.
The monitor was written to try to minimize the amount of stack needed to
support debugging.
During reset initialization:
Users should allow 35 bytes of extra space in the bottom-most area of the stack
for worst-case stack usage. This space will be needed for debugging
application programs with the monitor program. Because the smallest HCS12
Family member to date has 2K of RAM available, the 2% overhead is
considered to be a minor limitation.
Failure to allow this extra space could result in the monitor overwriting other
user resources such as RAM variables or register space. For applications that
cannot tolerate this extra stack space, use a BDM-based debug development
system that does not use any user memory or resources.
The monitor checks the value of the SP in the SWI service routine to make sure
it can support normal monitor activity. If SP is less than RamStart+35 or greater
than RamLast, the monitor forces a warm reset to get the stack pointer back
into a legal range. If SP is outside this range, the stacking operation for the SWI
could write over other system resources including program variables or control
and status registers.
Freescale Semiconductor, Inc.
For More Information On This Product,
The stack pointer is set to the end of RAM+1 ($4000).
A 9-byte user register stack frame is set up with all zeros except the user
CCR which is initially set to $D0 (SX-IN---).
The I bit is set, which disables all maskable interrupts.
The user PC is initially loaded with the user reset vector at $F7FE:$F7FF
assuming that the lsb of the vector is not $FF.
Serial Monitor Program for HCS12 MCUs
Go to: www.freescale.com
Software Detail
AN2548/D
19

Related parts for AN2548