
Development Support
M68HC12B Family Data Sheet, Rev. 9.1
294
Freescale Semiconductor
The second type of BDM commands are called firmware commands because they are implemented in a
small ROM within the HC12 MCU.
The CPU must be in background mode to execute firmware
commands. The usual way to get to background mode is by the hardware command BACKGROUND. The
BDM ROM is located at $FF20 to $FFFF while BDM is active. There are also seven bytes of BDM
registers which are located at $FF00 to $FF06 while BDM is active. The CPU executes code from this
ROM to perform the requested operation. The BDM firmware watches for serial commands and executes
them as they are received. The firmware commands are shown in
Table 18-3
.
Each of the hardware and firmware BDM commands starts with an 8-bit command code (opcode).
Depending upon the commands, a 16-bit address and/or a 16-bit data word is required as indicated in the
tables by the command. All the read commands output 16 bits of data despite the byte/word implication
in the command name.
WRITE_BD_WORD
CC
16-bit address
16-bit data in
Write to memory with BDM in map (may steal cycles if external
access) must be aligned access.
Write to memory with BDM out of map (may steal cycles if
external access) data for odd address on low byte, data for even
address on high byte.
Write to memory with BDM out of map (may steal cycles if
external access) must be aligned access.
WRITE_BYTE
C0
16-bit address
16-bit data in
WRITE_WORD
C8
16-bit address
16-bit data in
1. STATUS command is a specific case of the READ_BD_BYTE command.
2. ENABLE_FIRMWARE is a specific case of the WRITE_BD_BYTE command.
Table 18-3. BDM Firmware Commands
Command
Opcode (Hex)
Data
Description
READ_NEXT
62
16-bit data out
X = X + 2; Read next word
pointed to by X
READ_PC
63
16-bit data out
Read program counter
READ_D
64
16-bit data out
Read D accumulator
READ_X
65
16-bit data out
Read X index register
READ_Y
66
16-bit data out
Read Y index register
READ_SP
67
16-bit data out
Read stack pointer
WRITE_NEXT
42
16-bit data in
X = X + 2; Write next word
pointed to by X
WRITE_PC
43
16-bit data in
Write program counter
WRITE_D
44
16-bit data in
Write D accumulator
WRITE_X
45
16-bit data in
Write X index register
WRITE_Y
46
16-bit data in
Write Y index register
WRITE_SP
47
16-bit data in
Write stack pointer
GO
08
None
Go to user program
TRACE1
10
None
Execute one user instruction
then return to BDM
TAGGO
18
None
Enable tagging and go to
user program
Table 18-2. BDM Hardware Commands (Continued)
Command
Opcode (Hex)
Data
Description