
Appendix B
Appendix B-2
MCF5206 USERS MANUAL Rev 1.0
MOTOROLA
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
A
To generate a ColdFire executable of the target debugger, you should use a ColdFire-
compliant port of the same C compiler originally used to create the M68K debugger target.
This procedure prevents differences in calling convention and parameter passing from C to
handwritten assembly. Another advantage to this approach is that special C flags are
retained. Many C compilers have special extensions as well.
Whichever approach is used, the assembly language lines that are outside the ColdFire
instruction set must be identified. Any ColdFire assembler that properly flags nonColdFire
instructions can be used. During the process of conversion, you can ignore architectural
issues temporarily because the target is still an M68K.
Once the instruction set differences have been resolved, the architectural differences
between the ColdFire and M68K need to be addressed.
B.3 INITIALIZATION CODE
The target software and firmware often execute code that identifies the type of processor.
Such a process provides one port that works with various M68K Family members and
implementations. The easiest way to identify the ColdFire architecture from other M68K
processors is to execute an ILLEGAL opcode ($4AFC). This execution generates an
exception stack frame while ensuring that the tracing is disabled. The first two bits of the
exception stack frame would immediately determine whether the processor is a ColdFire
processor.
Motorola suggests that ColdFire architecture testing be performed immediately to avoid
executing potentially undefined opcodes in the ColdFire architecture. Unused opcodes in
the ColdFire architecture are not guaranteed to result in an illegal instruction exception.
Another item to consider is that the ColdFire architecture will have integrated versions with
modules yet to be defined. It may be a good idea to ensure that there are enough hooks to
allow for initialization of routines.
B.4 EXCEPTION HANDLERS
When dealing with exceptions in debug-oriented software, it is often necessary to extract
exception stack information to obtain the SR and PC. The format word (MC68010 and
higher) is typically used by generalized exception routines. Their sole purpose is to catch
unexpected exceptions and to easily use vector information to identify the cause of the
exception. The MC68000 exception frame is different from that of other members of the
M68K processors in that there is no notion of a format word. This difference would have
forced target software to deal with exception stack frame differences already. The approach
now in use provides guidance on handling ColdFire exception stack frame differences. In
many low-level exception handlers, the extraction of the stacked SR, PC, or format word is
performed in a common source file or the offsets are handled in some type of header file.
Interrupt handlers probably require no modification because in most cases, an interrupt
occurs asynchronously with respect to normal program flow. Therefore, interrupt handlers
cannot rely on items on the stack as it is often unnecessary to know exactly what was
happening at the time of the interrupt.
F
re
e
sc
a
le
S
e
m
ic
o
n
d
u
c
to
r,
I
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
n
c
..
.