Enhanced M68HC11 Bootstrap Mode

Freescale Semiconductor, Inc.
Order this document
by EB422/D
Motorola Semiconductor Engineering Bulletin
Freescale Semiconductor, Inc...
EB422
Enhanced M68HC11 Bootstrap Mode
By Steven McAslan
CSIC Development Systems
Motorola Ltd., East Kilbride, Scotland
Introduction
Motorola has enhanced the capability of the special bootstrap mode
operation of many M68HC11 Family MCUs. The enhancements are
possible by the addition of larger boot ROM memories, thereby
expanding the functionality of the mode.
The bootstrap mode listings enclosed here cover a wider range of
application possibilities than before and offer enhanced or modified
operation over earlier offerings. Recent enhancements include the
addition of autostart facilities for PLL (phase-locked loop) systems,
enhanced security options, and embedding of PCbug11 talkers in the
boot ROM.
This engineering bulletin describes the boot ROMs from these MCUs:
MC68HC11ED0, MC68HC711EA9, MC68HC11PH8, MC68HC711PH8,
secured MC68HC711E20, secured MC68HC711E32, and secured
MC68HC11E32.
© Motorola, Ltd., 1995, 2000
EB422
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Engineering Bulletin
Special Bootstrap Mode
References [1] contains a complete description of the operation of the
M68HC11 bootstrap mode. However, for completeness, a brief review
follows.
Freescale Semiconductor, Inc...
Bootstrap mode differs from other M68HC11 modes because of its preprogrammed capability. When the M68HC11 enters bootstrap mode, it
enables and then executes code from a special internal ROM (boot
ROM). The standard function of this code is to allow the user to
download a program into the internal RAM of the M68HC11 device and
then execute the downloaded code. The MCU downloads the code
through its SCI (serial communication interface) serial module and then
passes control to the code in the RAM. In addition, the MCU allows users
access to its internal memory and registers without restriction.
Since this internal ROM provides the functionality of the bootstrap mode,
extensions or reductions in the size of this ROM can enhance or restrict
the functionality of the mode. This bulletin describes some functionality
enhancements (and restrictions) that Motorola has made to recent
additions to the M68HC11 Family.
Motorola supplies a PC-based software package that communicates
with M68HC11 devices in bootstrap mode. PCbug11 is available from
your local Motorola supplier. See [3] in References.
EB422
2
MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Engineering Bulletin
MC68HC11ED0 Bootstrap Mode
MC68HC11ED0 Bootstrap Mode
The MC68HC11ED0 (ED0) is a low-end addition to the M68HC11
Family. It has only 512 bytes of RAM available internally and a limited
pin count. Therefore, the ED0 has a boot ROM much reduced in size and
functionality from the standard offering.
Freescale Semiconductor, Inc...
Unlike other M68HC11 boot ROMs, the ED0 does not allow the user to
download code into all the internal RAM. In this case, the bootstrap
mode only allows the user to load 256 bytes from address $0100 to
$01FF. Additionally, unlike most other M68HC11s, the ED0 forces the
user to download exactly 256 bytes before it can begin executing the
code. A further restriction is that all the interrupt vectors point to a single
address while in bootstrap mode, $00FD. These restrictions limit the
capability of the MCU to support system debugging.
Table 1 describes the relevant capability of the ED0 compared to a
similar device, the MC68HC11D3 (D3).
Table 1. ED0 versus Boot ROM Capability
MC68HC11D3
MC68HC11ED0
Total RAM size
512
512
Maximum download
512
256
Minimum download
1
256
$0000
$0100
21
1 at $00FD
Download start address
Unique vectors
EB422
MOTOROLA
3
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Engineering Bulletin
Freescale Semiconductor, Inc...
MC68HC(7)11EA9 Bootstrap Modes
These MCUs share many features with the MC68HC(7)11E9 (E9)
devices and as described later, the EPROM version also contains some
enhancements from the basic bootloader. A further complication is that
the EA9 device has a PLL available for use with the MCU oscillator.
Since this boot ROM does not contain any facility to allow it to control the
PLL, the user should disable the PLL and connect a standard high
frequency crystal or external clock (8 MHz). Disable the PLL by ensuring
that the VDDSYN voltage connects to ground.
On the MC68HC711EA9 (EA9), two additional subroutines are available
to simplify the programming and verification of the internal EPROM
array. The user may access these routines by downloading a jump
instruction through the bootloader and then executing that jump.
References [1] describes these routines (PROGRAM and UPLOAD) in
greater detail for the MC68HC11E9 MCU.
The ROM EA9 performs in a similar fashion to the E9 ROM version.
MC68HC(7)11PH8 Bootstrap Modes
Motorola added a much larger boot ROM to the MC68HC11PH8 (PH8)
MCUs. This allows a greater range of flexibility for the user of these
devices: automatic startup, embedded PCbug11 talker software, and
enhanced automatic baud rate selection.
Both the ROM and EPROM versions of the PH8 have automatic startup
on the PLL when in bootstrap mode. However, the user still has the
option to use a high-frequency crystal; in this case, disable the PLL. The
autostart option allows the user to specify the VCO control register
(SYNR) value immediately after startup. The MCU reads the value on its
port F and then starts the PLL using that value. If the value found on port
F is $FF, then the MCU writes $CC to SYNR. Port F can have pullups
present and so $FF is the value that the CPU would read with no
connections on the port. The multiplier $CC gives an operating
frequency of 8 MHz from a 38.4-kHz crystal. Table 2 shows the options
EB422
4
MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Engineering Bulletin
MC68HC(7)11PH8 Bootstrap Modes
available to the user on both the MC68HC11PH8 and the
MC68HC711PH8.
Freescale Semiconductor, Inc...
Table 2. PLL Bootstrap Autostart Configuration
VDDSYN
Port F
Crystal
MCU Frequency
Comment
GND
Don’t care
8 MHz
8 MHz
PLL disabled;
crystal frequency used
VDD
NC(1) or
$FF
XValue
XValue * 208
PLL active;
crystal * 208 used
VDD
Other FSet
XValue
FSet * XValue
PLL active;
port F multiplier used
1. When pullups are enabled in CONFIG register
The MCU uses a 10-ms delay timed for a 38.4-kHz crystal before
completing the PLL initialization. For a much higher value crystal, this
delay may be insufficient to allow the PLL to settle.
A useful function of bootstrap mode is the ability to make the address
and data buses active once bootstrap mode is active. Users should take
great care when using this feature, if port F has any pullup or down
hardware connected to it. Port F becomes the low byte of the address
bus when enabled and damage could result unless the user takes
suitable precautions.
Both PH8 devices also support the enhanced baud rate selection. This
feature is present on the MC68HC11K4 (K4) MCU and [1] References
describes its operation. By combining the wide range of baud rates
available with the flexibility of the PLL autostart function, users can
access almost every baud rate available.
The EPROM version of the PH8 contains the PROGRAM subroutine
described in References [1]. The PH8 implementation allows dynamic
relocation of the EPROM where the boot ROM overlaps the internal
EPROM. It achieves this by detecting when the EPROM overlaps the
boot ROM, moving the EPROM, adjusting the user’s current address,
programming the byte, restoring the user’s address, and then moving
the EPROM back again. The PROGRAM version of the K4, by contrast,
moves the EPROM once before the user begins programming.
EB422
MOTOROLA
5
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Engineering Bulletin
Freescale Semiconductor, Inc...
The ROM version of the PH8 also has an embedded version of a
PCbug11 talker. Embedding talkers in boot ROM has the advantage of
freeing memory in RAM (from where talkers normally run). The
disadvantage of such a talker is that there is no possibility to alter it if
required, for example, to change programming delay times. Also, due to
the limited memory available, the talker in the PH8 boot ROM does not
support the trace and breakpoint functions of PCbug11.
To use the boot ROM talker, the user must force a jump to the start of
the boot ROM talker. Listing 1. PCbug11 MC68HC(7)11PH8 Talker
Initialization Code shows the code required to perform the initialization.
Note that the boot ROM code only initializes the SCI vector by default;
the user should add further initialization to this talker file, if required. To
generate a machine readable talker, assemble the file using ASMHC11
with the ;B option. The .MAP shown in Listing 2. PCbug11 PH8 Talker
Map File tells PCbug11 where the talker code is. This must have the
same name as the talker file and both files require the use of PCbug11
version 3.40 or later.
Listing 1. PCbug11 MC68HC(7)11PH8 Talker Initialization Code
M68HC11 Absolute Assembler Version 2.70C:\talkph8.ASC
1 A
0000
ORG
$0
2 A
0000
7EBE40 start JMP
$BE40
3 A
END
Listing 2. PCbug11 PH8 Talker Map File
Name of constant must not exceed 14 characters.
Value of constant must start in column 15 or higher.
talker_start $BE40
Talker code start address. (TLKRSTART)
talker_idle
$BE5E
Talker code idle loop address. (IDLE)
user_start
$BE49
User’s reset entry into talker code. (USERSTART)
xirq_ujmp
$00F2
Address of user’s XIRQ server address.
relocate_buf $00A0
PCbug11 workspace in MCU RAM
xirq_srv
$BE61
Talker’s XIRQ service address. (SCISRV)
swi-srv
$BE99
Talker’s SWI service address for break points. (SWISRV)
swi_idle
$BE5E
Talker’s SWI idle loop. (SWIIDLE)
null_srv
$BE99
Talker RTI. (NULLSRV)
xirq_jmp
$00F2
XIRQ vector.
swi_jmp
$00F5
SWI vector.
cme_jmp
$00FE
COP clock monitor vector.
EB422
6
MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Engineering Bulletin
MC68HC(7)11E20/32 Bootstrap Modes
MC68HC(7)11E20/32 Bootstrap Modes
These devices are derivatives of the popular MC68HC(7)11E9 devices.
The EPROM versions have two enhanced features:
•
A revised security mode to protect EPROM
•
An embedded PCbug11 talker
Freescale Semiconductor, Inc...
A standard security mode exists on many M68HC11 MCUs. This
protects internal EEPROM and RAM from access by erasing them
before the MCU enters bootstrap mode. The user enables this feature
by clearing the NOSEC bit in the CONFIG register on the MCU.
On the MC68HC711E20 (711E20) and MC68HC711E32 (711E32)
MCUs, the same control bit activates the security mode. However, the
new security mode protects the internal EPROM as well as EEPROM
and RAM. The new protection takes the form of a blank check on the
entire EPROM array. If any EPROM cell is not blank ($FF), then the CPU
enters an infinite loop doing nothing. While this enhancement greatly
improves the security of customer information, it also brings greater
responsibility. In particular, users should take great care before clearing
the NOSEC bit on one-time programmable (OTP) devices. Since these
devices are not erasable, it is impossible to re-enter bootstrap mode
again. In addition, the order in which the CPU checks internal memory
means that the user may be unable to use the MCU again. For erasable
devices with quartz window, the mode is re-usable once the user erases
the internal EPROM. Of course, if the EPROM is blank, then there is no
security breach anyway, and the NOSEC bit being cleared will erase the
internal EEPROM as normal in bootstrap mode.
The enhanced security mode secures memory in this order:
1. EEPROM
2. RAM
3. EPROM
4. CONFIG register
This means that MCU erases its internal EEPROM and RAM before
checking the internal EPROM. For applications with internal variables or
EB422
MOTOROLA
7
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Engineering Bulletin
preset values in the EEPROM, placing the device in bootstrap mode
would erase those values even if the EPROM is not blank. If in addition
the device is an OTP, then bootstrap mode is not usable again to
reprogram the contents of the EEPROM.
Freescale Semiconductor, Inc...
In summary, this security mode offers a degree of protection for internal
memory contents much greater than standard M68HC11 security mode.
However, users must take great care to ensure that they only enable the
mode when convinced that they have no further need for bootstrap
mode, except, of course, for erasable devices.
The PCbug11 talkers embedded in the 711E20 and 711E32 are full
implementations unlike the PH8 version listed earlier. In this case, as
well as causing a jump to the talker, it is also advisable to initialize the
SWI interrupt vector to point to the null service routine (RTI). This
precaution avoids system problems where the user has an SWI
interrupt. Since the 7E20 and 7E32 talkers vary slightly, the user must
generate two sets of talker and .MAP files. The files are described in:
•
Listing 3. PCbug11 MC68HC(7)11E20 Talker Initialization
Code
•
Listing 4. PCbug11 MC68HC(7)11E20 Talker Map File
•
Listing 5. PCbug11 MC68HC(7)11E32 Talker Initialization
Code
•
Listing 6. PCbug11 MC68(7)11E32 Talker Map File
EB422
8
MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Engineering Bulletin
MC68HC(7)11E20/32 Bootstrap Modes
Listing 3. PCbug11 MC68HC(7)11E20 Talker Initialization Code
M68HC11 Absolute Assembler Version 2.70C:\talk7e20.ASC
1 A
0000
ORG
$0
2 A
0000
7EBE40 start
JMP
$BE40
3 A
00F4
ORG
$F4
4 A
00F4
7EBEA1
JMP
$BEA1
5 A
END
Freescale Semiconductor, Inc...
Listing 4. PCbug11 MC68HC(7)11E20 Talker Map File
Name of constant must not exceed 14 characters.
Value of constant must start in column 15 or higher
talker_start $BE40
Talker code start address. (TLKRSTART)
talker_idle
$BE5B
Talker code idle loop address. (IDLE)
user_start
$BE49
User’s reset entry into talker code. (USERSTART)
xirq_ujmp
$00F2
Address in talker code of user’s XIRQ server address.
relocate_buf $00A0
Address to where user’s code is relocated on break point.
xirq_srv
$BE5E
Talker’s XIRQ service address. (SCISRV)
swi-srv
$BEDD
Talker’s SWI service address for break points. (SWISRV)
swi_idle
$BEE1
Talker’s SWI idle loop. (SWIIDLE)
null_srv
$BEA1
Talker RTI. (NULLSRV)
xirq_jmp
$00F2
XIRQ vector.
swi_jmp
$00F5
SWI vector.
cme_jmp
$00FE
COP clock monitor vector.
Listing 5. PCbug11 MC68HC(7)11E32 Talker Initialization Code
M68HC11 Absolute Assembler Version 2.70C:\talk7e32.ASC
1 A
0000
ORG
$0
2 A
0000
7BE40
start
JMP
$BE40
3 A
00F4
ORG
$F4
4 A
00F4
7EBE9B
JMP
$BE9B
5 A
END
Listing 6. PCbug11 MC68(7)11E32 Talker Map File
Name of constant must not exceed 14 characters.
Value of constant must start in column 15 or higher
talker_start $BE40
Talker code start address. (TLKRSTART)
talker_idle
$BE5B
Talker code idle loop address. (IDLE)
user_start
$BE49
User’s reset entry into talker code. (USERSTART)
xirq_ujmp
$00F2
Address in talker code of user’s XIRQ server address.
relocate_buf $00A0
Address to where user’s code is relocated on break point.
xirq_srv
$BE5E
Talker’s XIRQ service address. (SCISRV)
swi_srv
$BED7
Talker’s SWI service address for break points. (SWISRV)
swi_idle
$BEDB
Talker’s SWI idle loop. (SWIIDLE)
null_srv
$BE9B
Talker RTI. (NULLSRV)
xirq_jmp
$00F2
XIRQ vector.
swi_jmp
$00F5
SWI vector.
cme_jmp
$00FE
COP clock monitor vector.
EB422
MOTOROLA
9
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Engineering Bulletin
Boot ROM IDs
Across the M68HC11 Family, boot ROM IDs are available (with some
exceptions) to allow users to identify the device in use and the revision
of the boot ROM software. The ID is present in the boot ROM at one of
two locations and in one of two formats. The format in use in general
depends on the lineage and age of the device.
Freescale Semiconductor, Inc...
The first ID originated with the MC68HC11E9 and uses two bytes that
contain this information:
•
EPROM (711) or not
•
Device numeric identifier, up to 15
•
Device alphabetic identifier, one character or two if both are less
than F
The second ID originated later, uses a different format, and contains this
information:
•
EPROM (711) or not
•
Bootstrap ROM allows for enhanced security operation or not
•
First digit of device identifier
•
Second digit of device identifier or enhanced numeric identifier
•
Numeric identifier up to 15 or enhanced numeric identifier up to 63
Table 3 gives details on how to decode the first format.
Table 3. M68HC11 Device ID First Format
Address
$BFD1
Content
Revision of boot ROM, A upward
$BFD2, $BFD3
Mask set ID, $0000 for EPROM, otherwise used
by mask generation
$BFD4, $BFD5
2-byte device ID as follows:
Bit 15–bit 12 is a 7 if EPROM, 0 if ROM.
Bit 11–bit 8 is hex nibble of first ASCII letter.
Bit 7–bit 4 is hex nibble of second ASCII letter.
Bit 3–bit 0 is hex nibble of digit.
Alternatively:
Bit 11–bit 8 is digit.
EB422
10
MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Engineering Bulletin
Boot ROM IDs
Table 4 gives details on how to decode the second format.
Table 4. M68HC11 Device ID Second Format
Address
Content
Freescale Semiconductor, Inc...
$BFBB
Revision of boot ROM, A upward
$BFBC, $BFBD
Mask set ID, $0000 for EPROM, otherwise used
by mask generation
$BFBE, $BFBF
2-byte device ID as follows:
Bit 15 is 0 if the part is ROM or ROMless, 1 if the part is
EPROM.
Bit 14 is a 0 if unsecured.
Bit 13–bit 9 are lower five bits of first ASCII letter.
Bit 8–bit 4 are lower five bits of second ASCII letter.
Bit 3–bit 0 are last digit of part number.
Alternatively:
If bit 8 – bit 6 are %111, then bit 5–bit 0 are last digit
of number part.
Table 5 gives guidance on where to find the ID for many M68HC11
devices.
Table 5. M68HC11 Boot ROM Device IDs
Device
ID
Location
MC68HC11A0/1/8
None
N/A
MC68HC11D3
$11D3
$BFD4
MC68HC11E20
$E9E9
$BFD4
MC68HC11E32
$4BE0
$BFBE
MC68HC11E9
$E9E9
$BFD4
MC68HC11EA9
$0EA9
$BFD4
MC68HC11ED0
None
N/A
MC68HC11F1
$F1F1
$BFD4
MC68HC11K4
$044B
$BFD4
MC68HC11PA8
$6018
$BFBE
MC68HC11PH8
$2088
$BFBE
MC68HC711D3
$71D3
$BFD4
MC68HC711E20
$CBF4
$BFBE
MC68HC711E32
$CBE0
$BFBE
MC68HC711E9
$71E9
$BFD4
MC68HC711EA9
$7EA9
$BFD4
MC68HC711K4
$744B
$BFD4
MC68HC711PA8
$E018
$BFBE
Mc68HC711PH8
$E088
$BFBE
EB422
MOTOROLA
11
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Engineering Bulletin
Conclusion
Freescale Semiconductor, Inc...
By using the features embedded in the bootstrap ROMs of the described
MCUs, the user can enjoy enhanced bootstrap operation from the
M68HC11 Family. Table 6 describes the bootstrap features of several
M68HC11 devices at the time of printing. Complete commented listings
of the boot ROM programs in seven specific versions of the M68HC11
are contained in:
•
Listing 7. MC68HC11ED0 Bootloader ROM Listing
•
Listing 8. MC68HC711EA9 Boatloader ROM Listing
•
Listing 9. MC68HC711PH8 Bootloader ROM Listing
•
Listing 10. MC68HC11PH8 Bootloader ROM Listing
•
Listing 11. MC68HC711E20 Secured Bootloader ROM Listing
•
Listing 12. MC68HC711E32 Secured Bootloader ROM Listing
•
Listing 13. MC68HC11E32 Secured Bootloader ROM Listing
Other versions can be found in References [1] and [2].
References
[1] M68HC11 Bootstrap Mode, Motorola document order number
AN1060/D
[2] M68HC11 Reference Manual, Motorola document order number
M68HC11RM/AD
[3] PCbug11 User’s Manual, Motorola document order number
M68PCBUG11/D
[4] ROMed HC11E32 and HC11PH8 including Buffalo Monitor and
PCbug11 Talker, Motorola document order number EB419/D
EB422
12
MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Engineering Bulletin
References
Table 6. M68HC11 Boot ROM Features
MCU
Download (Bytes)
PROGRAM
UPLOAD
TALKER
Other
Fixed, 256
No
No
No
None
MC68HC11D3
Variable, 512
No
No
No
None
MC68HC11E20
Variable, 768
No
No
No
None
MC68HC11E32
Variable, 2048
No
No
Yes
None
MC68HC11E9
Variable, 512
No
No
No
None
MC68HC11EA9
Variable 512
No
No
No
None
MC68HC11ED0
Fixed, 256
No
No
No
None
MC68HC11F1
Variable, 1024
No
No
No
None
MC68HC11K4
Variable, 768
No
No
No
None
MC68HC11PA8
Variable, 2048
No
No
Yes
PLL autostart
MC68HC11PH8
Variable, 2048
No
No
Yes
PLL autostart
MC68HC711D3
Variable, 512
Yes
Yes
No
None
MC68HC711E20
Variable, 768
No
No
Yes
Enhanced security
MC68HC711E32
Variable, 2048
No
No
Yes
Enhanced security
MC68HC711E9
Variable, 512
Yes
Yes
No
Enhanced security
on request
MC68HC711EA9
Variable, 512
Yes
Yes
No
No
MC68HC711K4
Variable, 768
Yes
Yes
No
No
MC68HC711PA8
Variable, 2048
Yes
No
No
PLL autostart
Mc68HC711PH8
Variable, 2048
Yes
No
No
PLL autostart
Freescale Semiconductor, Inc...
MC68HC11A0/1/8
EB422
MOTOROLA
13
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Engineering Bulletin
Freescale Semiconductor, Inc...
Listing 7. MC68HC11ED0 Bootloader ROM Listing
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
*Bootloader Firmware for MC68HC11ED0
********************************************************
* November 11 1991
********************************************************
* Equates for use with index offset = 0
0008
0009
0028
002b
002c
002d
002e
002f
003b
003f
PORTD
DDRD
SPCR
BAUD
SCCR1
SCCR2
SCSR
SCDAT
PPROG
CONFIG
bf80
bf80
********************************************************
* This bootstrap program allows the user to
* download a program of exactly 256 bytes.
* The program must start at $0100.
* Each byte of the program is received by the
* SCI, starting with the $0100 byte and working
* up to the $01FF.
*
* This bootloader is based on the bootloader for the
* MC68HC11A8. Modifications are to place the registers
* at $00XX and destination to $0100.
********************************************************
ORG
$BF80
BEGIN
EQU
*
bf80
8e
00
ff
bf83
14
28
20
bf86
bf89
bf8b
cc
97
d7
a2
2d
2d
0c
bf8d
14
2d
01
bf90
bf94
12
15
08
2d
01 fc
01
bf97
bf9b
13
96
2e
2f
20 fc
bf9d
bf9f
81
27
ff
03
bfa1
14
2b
33
bfa4
bfa4
ce
01
00
bfa7
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
$08
$09
$28
$2B
$2C
$2D
$2E
$2F
$3B
$3F
* Init.stack
LDS
#$00FF
* Put PORTD in wired-or mode
BSET
SPCR
$20
* Init SCI, restart the divider chain, enable tx & rx
LDD
#$A20C
STAA
BAUD
STAB
SCCR2
* Send break as soon as start bit is detected
BSET
SCCR2
$01
* Clear break as soon as start bit is detected
BRSET
PORTD
$01 *
BCLR
SSCR2
$01 *
Clear break
* Wait for first character (users send $ff)
BRCLR
SCSR
$20 *
Wait for RDRF
LDAA
SCDAT
Read data
*** No jump to EEPROM or RAM here !!
* If data = $FF, then /16 is correct baud
CMPA
#$FF
BEQ
BAUDOK
* else change to /104 (/13 & /8) 1200 @ 2 MHz
BSET
BAUD
$33
* Then download 256 byte program
BAUDOK EQU *
LDX
#$100
Init pointer
* Read in program and put in RAM
BK2
EQU
*
EB422
14
MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Engineering Bulletin
Listing 8. MC68HC711EA9 Boatloader ROM Listing
Freescale Semiconductor, Inc...
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
bfa7
bfab
bfad
bfaf
bfb1
13
96
a7
97
08
2e
2f
00
2f
20 fc
bfb2
bfb5
8c
26
02
f0
00
bfb7
bfb7
7e
01
00
BRCLR
SCSR $20 * $20
LDAA
SCDAT
STAA
$00,x
STAA
SCDAT
INX
* Until the end is reached
CPX
$#0200
BNE
BK2
********************************************************
* All start user’s program
*
STAR
EQU
*
JMP
$0100
END
Listing 8. MC68HC711EA9 Boatloader ROM Listing
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0008
000e
0016
0023
0080
0028
002a
002b
002c
002d
002e
002f
***********************************************************
*BOOTLOADER FIRMWARE FOR 68HC711EA9 - 23 Aug 91
***********************************************************
* Features of this bootloader are. . .
*
* Auto baud select between 7812.5 and 1200 (8 MHz)
* 0 - 512 byte variable length download
* Jump to EEPROM at $B600 if 1st download byte = $00
* PROGRAM - Utility subroutine to program EPROM
* UPLOAD - Utility subroutine to dump memory to host
* Mask I.D. at $BFD4 = $7EA9
***********************************************************
* Revision A *
* This bootloader based on the MC68HC711E9
* Bootloader Revision A with SCI register
* behavior from MC68HC711K4 Bootloader
* Revision B
*
* IMPORTANT VDDSYN must be tied low to allow the
* oscillator to work as a normal 68HC11.
*
* This new version allows variable length download
* by quitting reception of characters when an idle
* of at least four character times occurs
*
***********************************************************
*
* EQUATES FOR USE WITH INDEX OFFSET = $1000
*
PORTD
EQU
$08
TCNT
EQU
$0E
TOC1
EQU
$16
TFLG1
EQU
$23
* BIT EQUATES FOR TFLG1
0CF1
EQU
$80
*
SCBD
EQU
$28
Baud Register
SCCR1
EQU
$2A
SCCR2
EQU
$2B
SCSR1
EQU
$2C
SCSR2
EQU
$2D
SCDRH
EQU
$2E
SCDRL
EQU
$2F
EB422
MOTOROLA
15
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Freescale Semiconductor, Inc...
Engineering Bulletin
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098
003b
PPROG
EQU
$3B
* BIT EQUATES FOR PPROG
ELAT
EQU
$20
EPGM
EQU
$01
*
0020
0001
* MEMORY CONFIGURATION EQUATES
*
EEPMSTR
EQU
$B600
EEPMEND
EQU
$B7FF
*
EPRMSTR
EQU
$D000
EPRMEND
EQU
$FFFF
*
RAMSTR
EQU
$0000
RAMEND
EQU
$01FF
b600
b7ff
d000
ffff
0000
01ff
* DELAY CONSTANTS
*
DELAYS
EQU
DELAYF
EQU
*
PROGDEL
EQU
*
0db0
021b
1068
Start of EEPROM
End of EEPROM
Start of EPROM
End of EPROM
3504
539
Delay at slow baud
Delay at fast baud
4200
2 ms prog delay
At 2.1 MHz
*******************************************
ORG$BF00
*******************************************
bf00
bf00 7e bf 13
bf03
* Next two instructions provide a predictable place
* to call PROGRAM and UPLOAD even if the routines
* change size in future versions.
*
PROGRAM
JMP
PRGROUT
EPROM prog utility
UPLOAD
EQU
*
Upload utility
bf03
bf06
bf09
bf0d
bf0f
bf11
*********************************************
* UPLOAD - Utility subroutine to send data from
* inside the MCU to the host via the SCI interface.
* Prior to calling UPLOAD set baud rate, turn on SCI
* and set Y=first address to upload.
* Bootloader leaves baud set, SCI enabled, and
* Y pointing at EPROM start ($D0000) so these default
* values do not have to be changed typically.
* Consecutive locations are sent via SCI in an
* infinite loop. Reset stops the upload process.
*********************************************
LDX
#$1000
Point to registers
UPLOOP
LDAA
0,Y
Read byte
BRCLR
SCSR1,X $80 *
Wait for TDRE
STAA
SCDRL,X
Send it
INY
BRA
UPLOOP
Next...
ce
18
1f
a7
18
20
10 00
a6 00
2c 80 fc
2f
08
f3
EB422
16
MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Freescale Semiconductor, Inc...
Engineering Bulletin
Listing 8. MC68HC711EA9 Boatloader ROM Listing
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131
0132
0133
0134
0135
0136
0137
0138
0139
0140
0141
0142
0143
0144
0145
0146
0147
0148
0149
0150
0151
0152
0153
0154
0155
0156
0157
0158
0159
0160
0161
0162
bf13
bf13 3c
bf14 cd 10 00
*****************************************************
* PROGRAM - Utility subroutine to program EPROM.
* Prior to calling PROGRAM set baud rate, turn on SCI
* set X=2ms prog delay constant, and set Y=first
* address to program. SP must point to RAM.
* Bootloader leaves baud set, SCI enabled, X=4200
* and Y pointing at EPROM start ($D000) so these
* default values don’t have to be changed typically.
* Delay constant in X should be equivalent to 2 ms
* at 2.1 MHz X=4200; at 1 MHz X=2000.
* At external voltage source is required for EPROM
* programming.
* This routine uses 2 bytes of stack space
* Routine does not return. Reset to exit.
*****************************************************
PRGROUT
EQU
*
PSHX
Save prog dly
LDX
#$1000
Point to regs
* Send $FF to indicate ready for program data
bf171f 2c 80 fc
bf1b 86 ff
bf1d a7 2f
bf1f
bf1f
bf23
bf25
bf28
bf2a
bf2c
bf2e
bf31
bf33
bf35
bf36
bf37
bf38
bf39
bf3b
bf3d
bf3f
WAIT1
1f
e6
18
27
86
a7
18
86
a7
32
33
37
36
e3
ed
86
a7
2c 20 fc
2f
e1 00
1d
20
3b
e7 00
21
3b
0e
16
80
23
bf41 1f 23 80 fc
bf45 6f 3b
bf47
bf47
bf4b
bf4e
bf50
bf52
BRCLR
LDAA
STAA
SCSR1,X $80 *
#$FF
SCDRL,X
EQU
BRCLR
LDAB
CMPB
BEQ
LDAA
STAA
STAB
LDAA
STAA
PULA
PULB
PSHB
PSHA
ADDD
STD
LDAA
STAA
*
SCSR1,X $20 *
SCDRL,X
$0,Y
DONEIT
#ELAT
PPROG,X
0,Y
#ELAT+EPGM
PPROG,X
BRCLR
CLR
TFLG1,X OC1F *
PROG,X
TCNT,X
TOC1,X
#OC1F
TFLG1,X
Wait for TDRE
Wait for RDRF
Get rx byte
Already prog?
Skip prog cyc
EPROM in prog
Write data
Prog start
Get dly const
into D-reg
But keep dly
on stack
Delay + TCNT
2ms delay
Clear flag
Wait for dly
Prog stop
*
DONEIT
1f
18
a7
18
20
2c 80 fc
a6 00
2f
08
cb
EQU
*
BRCLR
SCSR1,X $80 *
Wait for TDRE
LDAA
$0,Y
Get EPROM &
STAA
SCDRL,X
Xmit for verf
INY
Next location
BRA
WAIT1
Back for next
* Loops indefinitely as long as more data sent.
***********************************************************
* Main bootloader starts here
***********************************************************
* RESET vector bootloader starts here
bf54
bf54 8e 01 ff
bf57 ce 10 00
bf5a cc 00 20
BEGIN
EQU
LDS
LDX
LDD
*
#RAMEND
#$1000
#$0020
Initialise SP
Point at regs
Init baud for
EB422
MOTOROLA
17
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Freescale Semiconductor, Inc...
Engineering Bulletin
0163
0164
0165
0166
0167
0168
0169
0170
0171
0172
0173
0174
0175
0176
0177
0178
0179
0180
0181
0182
0183
0184
0185
0186
0187
0188
0189
0190
0191
0192
0193
0194
0195
0196
0197
0198
0199
0200
0201
0202
0203
0204
0205
0206
0207
0208
0209
0210
0211
0212
0213
0214
0215
0216
0217
0218
0219
0220
0221
bf5d
bf5f
bf62
bf64
bf67
ed
cc
ed
cc
ed
28
40 0c
2a
02 1b
16
STD
LDD
STD
LDD
STD
SCBD,X
7812 at 2MHz
#$400C
Port D WOI &
SCCR1,X
Rx & Tx on
#DELAYF
Fast baud dly
TOC1,X
is default
*
* Send BREAK to signal ready for download
BSET
SCCR2,X $01
Send break
PORTD,X $01 *
RxD pin low?
BRSET
BCLR
SCCR2,X $01
Clear break
bf69 1c 2b 01
bf6c 1e 08 01 fc
bf70 1d 2b 01
bf73 1f 2c 20 fc
bf77 a6 2f
bf79
bf7b
bf7e
bf7e
bf80
26 03
7e b6 00
bf82
bf84
bf86
bf89
bf8b
bf8b
c6
e7
cc
ed
bf8f
bf8f
bf91
bf91
bf95
bf96
bf97
bf98
bf9a
bf9c
bf9c
bf9e
bfa1
bfa3
bfa5
bfa9
BRCLR
SCSR1,X $20 *
Wait for RDRF
LDAA
SCDRL,X
Read data
* Data will be $00 if BREAK OR $00 received
BNE
NOTZERO
No JMP ! = 0
JMP
EEPMSTR
JMP to EEPROM
NOTZERO
EQU
*
CMPA
#$FF
$FF is $FF
BEQ
BAUDOK
if baud OK
* Or else change to 1200 @ 2MHz
LDAB
#$D0
STAB
SCBD+1,X
Baud to 1200
LDD
#DELAYS
And slower...
STD
TOC1,X
delay const
BAUDOK
EQU
*
LDY
#RAMSTR
Start of RAM
81 ff
27 09
d0
29
0d b0
16
18 ce 00 00
WAI
ec 16
WTLOOP
1e 2c 20 07
8f
09
8f
26 f7
20 0f
NEWONE
a6
18
a7
18
18
26
2f
a7 00
2f
08
8c 02 00
e4
bfab
bfab ec 10 68
bfae 18 ce d0 00
bfb2 7e 00 00
STAR
EQU
LDD
EQU
BRSET
XGDX
DEX
XGDX
BNE
BRA
*
TOC1,X
D = Dly const
*
Exit loop if RDRF set
SCSR1,X $20 NEWONE
X = Dly const
Dec count
D = Dly const
WTLOOP
Finished?
STAR
Quit on t/o
EQU
LDAA
STAA
STAA
INY
CPY
BNE
*
SCDRL,X
$00,Y
SCDRL,X
#RAMEND+1
WAIT
Put rx data
into next RAM
Tx for hshake
Next RAM loc
Past end?
No, get next
EQU
LDX
LDY
JMP
*
#PROGDEL
#EPRMSTR
RAMSTR
X = prog dly
Y=EPROM start
To RAM start
***********************************************************
* Block fill unused bytes with zeros
bfb5 00 00 00 00 00 00
00 00 00 00 00 00
00 00 00 00 00 00
00 00 00 00 00 00
00 00 00 00
bfd1 41
BSZ
$BFD1-*
***********************************************************
* Boot ROM revision level in ASCII
*
(ORG$BFD1)
FCC "A"
EB422
18
MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Freescale Semiconductor, Inc...
Engineering Bulletin
Listing 9. MC68HC711PH8 Bootloader ROM Listing
0222
0223
0224
0225
0226
0227
0228
0229
0230
0231
0232
0233
0234
0235
0236
0237
0238
0239
0240
0241
0242
0243
0244
0245
0246
0247
0248
0249
0250
0251
0252
0253
0254
0255
bfd2 00 00
bfd4 7e a9
***********************************************************
* Mask set I.D. ($0000 FOR EPROM PARTS)
*
(ORG$BFD2)
FDB
$0000
***********************************************************
* ’711EA9 I.D. - Can be used to determine MCU type
*
(ORG$BFD4)
FDB
$7EA9
***********************************************************
* VECTORS - point to RAM for pseudo-vector JUMPs
bfd6
bfd8
bfda
bfdc
bfde
bfe0
bfe2
bfe4
bfe6
bfe8
bfea
bfec
bfee
bff0
bff2
bff4
bff6
bff8
bffa
bffc
bffe
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
bf
c4
c7
ca
cd
d0
d3
d6
d9
dc
df
e2
e5
e8
eb
ee
f1
f4
f7
fa
fd
54
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
END
$100-60
$100-57
$100-54
$100-51
$100-48
$100-45
$100-42
$100-39
$100-36
$100-33
$100-30
$100-27
$100-24
$100-21
$100-18
$100-15
$100-12
$100-9
$100-6
$100-3
BEGIN
SCI
SPI
PULSE ACCUM INPUT EDGE
PULSE ACCUM OVERFLOW
TIMER OVERFLOW
TIMER O/P COMPARE 5
TIMER O/P COMPARE 4
TIMER O/P COMPARE 3
TIMER O/P COMPARE 2
TIMER O/P COMPARE 1
TIMER I/P CAPTURE 3
TIMER I/P CAPTURE 2
TIMER I/P CAPTURE 1
REAL TIME INT
IRQ
XIRQ
SWI
ILLEGAL OP-CODE
COP FAIL
CLOCK MONITOR
RESET
Listing 9. MC68HC711PH8 Bootloader ROM Listing
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
***************************************************************
* BOOTLOADER FIRMWARE FOR MC68HC711PH8 - 7 OCT 93
***************************************************************
* Features of this bootloader are...
*
* Auto baud select between 7812, 1200, 9600, 5208
*
and 3906 (E = 2 MHz).
* 0 - 768 byte variable length download:
*
reception of characters quits when an idle of at
*
least four character times occurs. (Note: at 9600
*
baud rate this is almost five bit times and at
*
5208 and 3906 rates the timeout is even longer).
* Jump to EEPROM at $0D00 if first byte = $00.
* PROGRAM - Utility subroutine to program EPROM.
* Part I.D. at $BFBE is $E088. {7PH8}
***************************************************************
* Revision A (1 DEC 92) *
* Based on P2 Bootloader Rev B.
***************************************************************
* Revision B (7 OCT 93) *
* Security mode caused an overwrite of registers
* with $FF. Fix implemented - (CPX)
EB422
MOTOROLA
19
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Freescale Semiconductor, Inc...
Engineering Bulletin
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
*
* Altered PLL startup behaviour as follows :
* 1/ Changed programmed value read from PORT B to F
* 2/ If $FF is found then use value $CC instead. This
*
winds a 38.4KHz crystal to 8MHz (i.e. * 208).
* 3/ Default delay of 10ms has been adjusted for a
*
38.4KHz crystal rather than 640KHz.
*
* INITIAL subroutine removed since it was useless and
* PROGRAM enhanced to move the EPROM block iff the
* destination address clashes with the boot ROM
***************************************************************
0004
0005
0008
0009
000e
0016
0023
002e
002f
0080
002b
0020
0001
0035
0037
003b
003d
003e
003f
0070
0072
0073
0074
0075
0076
0077
* Equates (registers in direct space)
*
PORTB
EQU
$04
PORTF
EQU
$05
PORTD
EQU
$08
DDRD
EQU
$09
*
TCNT
EQU
$0E
TOC1
EQU
$16
TFLG1
EQU
$23
PLLCR
EQU
$2E
SYNR
EQU
$2F
* Bit equates for TFLG1
OC1F
EQU
$80
*
EPROG
EQU
$2B
* Bit equates for EPROG
ELAT
EQU
$20
EPGM
EQU
$01
*
BPROT
EQU
$35
INIT2
EQU
$37
PPROG
EQU
$3B
INIT
EQU
$3D
TEST1
EQU
$3E
CONFIG
EQU
$3F
*
SCBD
EQU
$70
SCCR1
EQU
$72
SCCR2
EQU
$73
SCSR1
EQU
$74
SCSR2
EQU
$75
SCDRH
EQU
$76
SCDRL
EQU
$77
0080
087f
* Memory configuration equates
*
EEPMSTR
EQU
$0D00
EEPMEND
EQU
$0FFF
*
EPRMSTR
EQU
$4000
EPRMEND
EQU
$FFFF
*
RAMSTR
EQU
$0080
RAMEND
EQU
$087F
be40
bfff
00b0
0080
BOOTSTR
BOOTEND
BOOTHI
BOOTLO
0d00
0fff
4000
ffff
EQU
EQU
EQU
EQU
$BE40
$BFFF
$B0
$80
Start of EEPROM
End of EEPROM
Start of EPROM
End of EPROM
Start of RAM
End of RAM
Start of boot ROM
End of boot ROM
Hi BR address
Shifted BR address
EB422
20
MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Freescale Semiconductor, Inc...
Engineering Bulletin
Listing 9. MC68HC711PH8 Bootloader ROM Listing
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131
0132
0133
0134
0135
0136
0137
0138
0139
0140
0141
0142
0143
0144
0145
0146
0147
0148
0149
0150
0151
0152
* Delay constants
*
DELAYS
EQU
5547
Dly at slow baud rate
DELAYF
EQU
854
Dly at fast baud rates
*
PROGDEL EQU
4200
2 mSec prog delay
*
at 2.1MHz
*
***************************************************************
ORG
$BE40
***************************************************************
15ab
0356
1068
be40
***************************************************************
* REVISION B - When the EPROM destination address
* is within the range of the boot ROM, then move the
* EPROM down to $0000 and alter the destination
* address to match.
*
* PROGRAM - Utility subroutine to program EPROM.
* Prior to calling PROGRAM set baud rate, turn on SCI
* set X=2ms prog delay constant, and set Y=first
* address to program. SP must point to RAM.
* Bootloader leaves baud set, and SCI enabled so
* default values do not have to be changed typically.
* Delay constant in X should be equivalent to 2 ms
* at 2.1 MHz X=4200; at 1 MHz X=2000, at 4MHz X=8000.
* An external voltage source is required for EPROM
* programming.
* This routine uses 4 bytes of stack space.
* Routine does not return. Reset to exit.
***************************************************************
PROGOUT EQU *
be40
* Send $FF to indicate ready for program data
be40 13 74 80 fc
be44 86 ff
be46 97 77
be5a
be5a
be5c
be5e
be60
be62
be64
be66
be68
be6a
be6c
be6e
be70
be72
18
25
18
22
18
84
8b
18
86
97
8d
18
84
8b
18
86
97
SCSR1 $80 * Wait for TDRE
#$FF
SCDRL
8c be 40
22
8c bf ff
1c
* WAIT FOR A BYTE
WAIT1
EQU
BRCLR
LDAB
* REVISION B - Check
CPY
BLO
CPY
BHI
8f
0f
80
8f
0f
3f
14
8f
0f
b0
8f
8f
3f
* REVISION B - Move Boot ROM and adjust Y
ADJ
EQU
*
Adjust Y & move EPROM
XGDY
ANDA
#$0F
Mask off hi nibble
ADDA
#BOOTLO
Replace with hi nibble
XGDY
LDAA
#$0F
EPROM on
STAA
CONFIG
at shifted addr
BSR
PROG
Program memory
XGDY
ANDA
#$0F
Mask off hi nibble
ADDA
#BOOTHI
Replace with hi nibble
XGDY
LDAA
#$8F
EPROM at standard addr
STAA
CONFIG
be48
be48 13 74 20 fc
be4c d6 77
be4e
be52
be54
be58
BRCLR
LDAA
STAA
*
SCSR1 $20 *
SCDRL
if boot ROM
#BOOTSTR
NOADJ
#BOOTEND
NOADJ
Wait for RDRF
Get received byte
is in the way
Is Y < BOOTSTR
Is Y > BOOTEND
EB422
MOTOROLA
21
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Freescale Semiconductor, Inc...
Engineering Bulletin
0153
0154
0155
0156
0157
0158
0159
0160
0161
0162
0163
0164
0165
0166
0167
0168
0169
0170
0171
0172
0173
0174
0175
0176
0177
0178
0179
0180
0181
0182
0183
0184
0185
0186
0187
0188
0189
0190
0191
0192
0193
0194
0195
0196
0197
0198
0199
0200
0201
0202
0203
0204
0205
0206
0207
0208
0209
0210
0211
0212
0213
0214
0215
0216
be74 20 02
be76
be76 8d 04
NOADJ
be78
be78 18 08
be7a 20 cc
CARRYON EQU *
BRA
CARRYON
Find next address
EQU
BSR
*
PROG
No need to adjust Y
INY
BRA
WAIT1
Point to next location
Back to top for next
* Loops indefinitely as long as more data sent.
be7c
be7c
be7f
be81
be83
be85
be88
be8a
be8c
be8d
be8e
be8f
be91
be93
be95
18
27
86
97
18
86
97
3c
32
33
d3
dd
86
97
e1 00
1d
20
2b
e7 00
21
2b
0e
16
80
23
* REVISION B - Now a subroutine
PROG
EQU
*
CMPB
$0,Y
BEQ
DONEIT
LDAA
#ELAT
STAA
EPROG
STAB
0,Y
LDAA
#ELAT+EPGM
STAA
EPROG
PSHX
PULA
PULB
ADDD
TCNT
STD
TOC1
LDAA
#OC1F
STAA
TFLG1
be97 13 23 80 fc
be9b 7f 00 2b
be9e
be9e
bea2
bea5
bea7
DONEIT
13 74 80 fc
18 a6 00
97 77
39
See if already prog
If so, skip prog cycle
Put EPROM in prog mode
Write data
Turn on prog voltage
Save delay on stack
Put delay into D-reg
Dly const+present TCNT
Schedule OC1 =prog dly
Clear any prev flag
BRCLR
CLR
TFLG1 OC1F * Wait for delay to expire
EPROG
Turn off prog voltage
EQU
BRCLR
LDAA
STAA
RTS
*
SCSR1 $80 * Wait for TDRE
$0,Y
Read from EPROM and...
SCDRL
Xmit for verify
Go back for more
********
*
* REVISION B - Load from PORTF, change $FF -> $CC
* Now check to see if the PLL is active:
* If VDDSYN pin is low the PLL is inactive and the
* MCU will continue using the EXTAL frequency
* This is detected since the PLLON bit is forced to
* zero.
* If VDDSYN pin is high then the MCU will switch
* to the new higher frequency. After a delay of
* 10ms (for a crystal of 38.4KHz).
* The value to be stored in the SYNR register is
* loaded from port F.
* IMPORTANT NOTE: IF SOME PINS ON PORTF ARE
*
SHORTED TO GROUND, BE SURE
*
TO REMOVE SHORTS BEFORE
*
SETTING MDA BIT FOR EXPANDED
*
BUSES
* Procedure for PLL is:
* 1/ If PLLON=0 then continue bootloader
* 2/ Load value from port F - ACCB
* 3/ If ACCB=$FF then ACCB:=$CC
* 4/ Reset BCS=0
* 5/ Reset PLLON=0
* 6/ Store ACCB in SYNR
* 7/ Set PLLON=1
* 8/ If PLLON=0 then continue bootloader
EB422
22
MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Freescale Semiconductor, Inc...
Engineering Bulletin
Listing 9. MC68HC711PH8 Bootloader ROM Listing
0217
0218
0219
0220
0221
0222
0223
0224
0225
0226
0227
0228
0229
0230
0231
0232
0233
0234
0235
0236
0237
0238
0239
0240
0241
0242
0243
0244
0245
0246
0247
0248
0249
0250
0251
0252
0253
0254
0255
0256
0257
0258
bea8
bea8
beaa
beac
beae
beb0
beb2
beb4
beb4
beb6
beb8
beba
bebc
bebe
bec0
bec2
bec4
bec6
beca
becc
bece
bed0
bed2
bed3
bed3
bed7
bed7
bed9
bedb
bede
96
2a
d6
c1
26
c6
2e
26
05
ff
02
cc
84
97
84
97
d7
8a
97
96
2a
18
18
26
8a
97
39
bf
2e
3f
2e
2f
80
2e
2e
0c
ce 00 0e
09
fc
44
2e
18 ce 0b b8
18 09
26 fc
7f 00 3b
39
* 9/ If PLLON=1 then wait 10ms (@ 38.4KHz)
* 10/ Set BCS=1 and MCS=1
* 11/ Continue bootloader
********
PLLSTRT EQU *
LDAA
PLLCR
Get control values
BPL
DONE
Not active carry on
LDAB
PORTF
Get SYNR value
CMPB
#$FF
Check for default
BNE
NOTFF
Not $FF so carry on
LDAB
#$CC
Load value for 8MHz
NOTFF
EQU
*
ANDA
#$BF
Reset BCS=0
STAA
PLLCR
ANDA
#$3F
Reset PLLON=0
STAA
PLLCR
STAB
SYNR
New value for SYNR
ORAA
#$80
Set PLLON=1
STAA
PLLCR
LDAA
PLLCR
Check if PLL is active
BPL
DONE
Not active carry on
LDY
#14
Dly for 10ms @ 38.4KHz
DELLP
DEY
BNE
DELLP
ORAA
#$44
STAA
PLLCR
BCS/MCS for high speed
DONE
RTS
***************************************************************
* EEPROM ERASE DELAY
ERASE
EQU
*
LDY
#3000
BK1
EQU
*
DEY
BNE
BK1
CLR
PPROG
Clear
RTS
***************************************************************
* Block fill unused bytes with zero
bedf 00 00 00 00 00 00
00 00 00 00 00 00
00 00 00 00 00 00
00 00 00 00 00 00
00 00 00 00 00 00
00 00 00
0259
0260
0261 bf00
0262
0263
0264
0265
0266
0267
0268
0269 bf00 7e be 40
0270
0271
0272
0273
0274
BSZ
$BF00-*
***************************************************************
ORG
$BF00
***************************************************************
* Next instruction provides a predictable place
* to call PROGRAM even if the routine changes in
* size in future versions. Note that the "UPLOAD"
* routine did not fit on this part.
*
PROGRAM JMP
PROGOUT Program utility
***************************************************************
* Main bootloader starts here
***************************************************************
* RESET vector points to here
EB422
MOTOROLA
23
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Freescale Semiconductor, Inc...
Engineering Bulletin
0275
0276
0277
0278
0279
0280
0281
0282
0283
0284
0285
0286
0287
0288
0289
0290
0291
0292
0293
0294
0295
0296
0297
0298
0299
0300
0301
0302
0303
0304
0305
0306
0307
0308
0309
0310
0311
0312
0313
0314
0315
0316
0317
0318
0319
0320
0321
0322
0323
0324
0325
0326
0327
0328
0329
0330
0331
0332
0333
0334
0335
0336
0337
0338
bf03
bf03 8e 08 7f
bf06 8d a0
BEGIN
bf08
bf08
bf0b
bf0d
bf10
CONTINU EQU
cc
dd
cc
dd
00 1a
70
40 0c
72
bf12 12 3f 08 3c
bf16
bf16 96 74
bf18 86 ff
bf1a 97 77
bf1c
bf1f
bf21
bf23
bf26
bf27
bf29
7f
c6
d7
f7
5c
d7
8d
00 35
06
3b
0d 00
3b
a8
bf2b 13 3f 01 0d
bf2f ce 0d 00
bf32
bf32
bf34
bf36
bf37
bf3a
bf3c
bf3c
bf3c
bf3f
bf3f
bf41
bf42
bf45
bf47
bf47
bf48
bf4a
bf4c
bf4d
bf4f
a1
26
08
8c
26
00
e0
10 00
f6
ce 08 7d
a7 00
09
8c 00 7f
26 f8
5a
d7
d7
5c
d7
bd
3b
3f
3b
be d3
EQU
LDS
BSR
*
#RAMEND
PLLSTRT
Initialize stack pntr
Turn on PLL
*
LDD
#$001A
Initialize baud for...
STD
SCBD
9600 baud at 2 MHz
LDD
#$400C
Put SCI in WOI mode...
STD
SCCR1
Enable Xmtr and Rcvr
* Test the security bit
BRSET
CONFIG $08 NOSEC
***************************************************************
* WE ARE IN SECURITY MODE
* OUTPUT $FF ON TRANSMITTER
AGAIN
EQU *
LDAA
SCSR1
LDAA
#$FF
STAA
SCDRL
Transmit $FF
* ACCA NOW IS SET FOR $FF
* ERASE EEPROM
CLR
BPROT
Turn off Block Protect
LDAB
#$06
EELAT and BULK ERASE
STAB
PPROG
Set EELAT=1 & ERASE=1
STAB
EEPMSTR
Save in any EEPROM loc
INCB
Set EEPGM bit
STAB
PPROG
to begin programming
BSR
ERASE
Wait 10ms (@ 2MHz)
* If EEPROM is not enabled then we can't check its
* erased - ACCA is still $FF
BRCLR
CONFIG $01 NOEE
LDX
#EEPMSTR
* Check the EEPROM is erased
LOOP
EQU
*
CMPA
0,X
BNE
AGAIN
EEPROM not erased
INX
CPX
#EEPMEND+1 All checked
BNE
LOOP
NOEE
EQU
*
***************************************************************
* WRITE OVER ENTIRE RAM, EXCEPT LAST TWO BYTES WHICH
* ARE USED BY THE STACK AND RAMSTR WHICH IS LEFT
* INTACT. ACCA IS STILL $FF
ERAM
EQU
*
LDX
#RAMEND-2
LOP1
EQU
*
STAA
0,X
DEX
CPX
#RAMSTR-1
*** REVISION B
BNE
LOP1
***************************************************************
* NOW ERASE CONFIG REGISTER
ECONFG
EQU
*
DECB
STAB
PPROG
B still = $06
STAB
CONFIG
BULK ERASE CONFIG
INCB
STAB
PPROG
JSR
ERASE
***************************************************************
* NON-SECURITY AND SECURITY MODES MEET HERE
*
EB422
24
MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Freescale Semiconductor, Inc...
Engineering Bulletin
Listing 9. MC68HC711PH8 Bootloader ROM Listing
0339
0340
0341
0342
0343
0344
0345
0346
0347
0348
0349
0350
0351
0352
0353
0354
0355
0356
0357
0358
0359
0360
0361
0362
0363
0364
0365
0366
0367
0368
0369
0370
0371
0372
0373
0374
0375
0376
0377
0378
0379
0380
0381
0382
0383
0384
0385
0386
0387
0388
0389
0390
0391
0392
0393
0394
0395
0396
0397
0398
0399
bf52
bf52 cc 03 56
bf55 dd 16
bf57 14 73 01
bf5a 12 08 01 fc
bf5e 15 73 01
bf61 13 74 20 fc
bf65 96 77
bf67 26 03
bf69 7e 0d 00
bf6c
bf6c 81 f0
bf6e 27 1d
bf70 c6 d0
bf72 81 80
bf74 27 10
bf76 c6 40
bf78 85 20
bf7a 27 0a
bf7c
bf7e
bf80
bf82
c6
d7
85
26
20
71
08
09
bf84 c6 24
bf86
bf86
bf88
bf8b
bf8d
bf8d
bf91
bf91
bf93
bf93
bf97
bf98
bf9a
bf9c
bf9c
bf9e
bfa1
bfa3
bfa5
bfa9
NOSEC
EQU *
LDD
#DELAYF
STD
TOC1
* Send BREAK to signal ready for
BSET
SCCR2 $01
BRSET
PORTD $01 *
BCLR
SCCR2 $01
BRCLR
SCSR1 $20 * Wait for RDRF
LDAA
SCDRL
Read data
* Data will be $00 if BREAK or $00 received
BNE
NOTZERO
Bypass jump if not $00
JMP
EEPMSTR
Jump to EEPROM if $00
NOTZERO
EQU
*
* Check div by 26 (9600 baud at 2 MHz)
CMPA
#$F0
$F0 seen as $F0...
BEQ
BAUDOK
if baud was correct
* Check div by 208 (1200 baud at 2 MHz)
LDAB
#$D0
Init B for this rate
CMPA
#$80
$FF seen as $80...
BEQ
SLOBAUD
if baud was correct
* Check div by 64 (3906 baud at 2 MHz)
* (equals: 8192 baud at 4.2 MHz)
LDAB
#$40
Init B for this rate
BITA
#$20
$FD has bit 5 clear...
BEQ
SLOBAUD
if baud was correct
* Change to div by 32 (7812 baud at 2 MHz)
* (equals: 8192 baud at 2.1 MHz)
LDAB
#$20
Init B for this rate
STAB
SCBD+1
BITA
#$08
$FF has bit 3 set...
BNE
BAUDOK
if baud was correct
* Change to div by 36 (7777 baud at 640KHz x 14)
*
LDAB
#$24
By default
SLOBAUD
d7 71
cc 15 ab
dd 16
BAUDOK
18 ce 00 80
WAIT
de 16
WTLOOP
12 74 20 05
09
26 f9
20 0f
NEWONE
96
18
97
18
18
26
77
a7 00
77
08
8c 08 80
e6
bfab
bfab 7e 00 80
Dly for fast bd rates
Set as default delay
download
Set send break bit
RxD pin low?
Clear send break bit
STAR
EQU
STAB
LDD
STD
EQU
LDY
*
SCBD+1
#DELAYS
TOC1
*
#RAMSTR
EQU
LDX
EQU
BRSET
DEX
BNE
BRA
*
TOC1
Move delay const to X
*
SCSR1 $20 NEWONE Exit if RDRF set
Decrement count
WTLOOP
Loop if not timed out
STAR
Quit on timeout
EQU
LDAA
STAA
STAA
INY
CPY
BNE
*
SCDRL
$00,Y
SCDRL
#RAMEND+1
WAIT
Get received data
Store to next RAM location
Transmit for h/shake
Point to next RAM loc
See if past end
If not, get another
EQU
JMP
*
RAMSTR
** To start of RAM **
Store baudrate
Switch to slower...
delay constant
Point to start of RAM
EB422
MOTOROLA
25
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Freescale Semiconductor, Inc...
Engineering Bulletin
0400
0401
0402
0403 bfae 00 00 00 00 00 00
00 00 00 00 00 00
00
0404
0405
0406
0407
0408 bfbb 42
0409
0410
0411
0412 bfbc 00 00
0413
0414
0415
0416
0417
0418
0419
0420
0421
0422
0423 bfbe e0 88
0424
0425
0426
0427 bfc0 00 00
0428 bfc2 00 00
0429 bfc4 00 00
0430 bfc6 00 00
0431 bfc8 00 00
0432 bfca 00 00
0433 bfcc 00 b5
0434 bfce 00 b8
0435 bfd0 00 bb
0436 bfd2 00 be
0437 bfd4 00 c1
0438 bfd6 00 c4
0439 bfd8 00 c7
0440 bfda 00 ca
0441 bfdc 00 cd
0442 bfde 00 d0
0443 bfe0 00 d3
0444 bfe2 00 d6
0445 bfe4 00 d9
0446 bfe6 00 dc
0447 bfe8 00 df
0448 bfea 00 e2
0449 bfec 00 e5
0450 bfee 00 e8
0451 bff0 00 eb
0452 bff2 00 ee
0453 bff4 00 f1
0454 bff6 00 f4
0455 bff8 00 f7
0456 bffa 00 fa
0457 bffc 00 fd
0458 bffe bf 03
0459
0460
***************************************************************
* Block fill unused bytes with zero
BSZ
$BFBB-*
***************************************************************
* Boot ROM revision level in ASCII
*
(ORG $BFBB)
FCC
"B"
***************************************************************
* Mask set I.D. ($0000 for EPROM parts)
*
(ORG$BFBC)
FDB
$0000
***************************************************************
* 711PH8 I.D. - can be used to determine MCU type
* Bit 15 is a 0 if the part is ROM (or ROMless,
* 1 -> EPROM)
* Bit 14 is a 0 if unsecured
* Bits 13 - Bit 9 are lower 5 bits of 1st ASCII letter
* Bits 8 - Bit 4 are lower 5 bits of 2nd ASCII letter
* Bits 3 - Bit 0 are last digit of part number
* (note: $50 = P , $48 = H in ASCII)
*
(ORG$BFBE)
FDB
%1110000010001000
***************************************************************
* VECTORS - point to RAM for pseudo-vector JUMPs
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
END
$0000
$0000
$0000
$0000
$0000
$0000
$100-75
$100-72
$100-69
$100-66
$100-63
$100-60
$100-57
$100-54
$100-51
$100-48
$100-45
$100-42
$100-39
$100-36
$100-33
$100-30
$100-27
$100-24
$100-21
$100-18
$100-15
$100-12
$100-9
$100-6
$100-3
BEGIN
reserved
reserved
reserved
reserved
reserved
reserved
BIT SYNC & LOCK
PORTH WOI
8 BIT TIMERS
SCI2
SPI2
SCI1
SPI1
PULSE ACCUM INPUT EDGE
PULSE ACCUM OVERFLOW
TIMER OVERFLOW
TIMER OUTPUT COMPARE 5
TIMER OUTPUT COMPARE 4
TIMER OUTPUT COMPARE 3
TIMER OUTPUT COMPARE 2
TIMER OUTPUT COMPARE 1
TIMER INPUT CAPTURE 3
TIMER INPUT CAPTURE 2
TIMER INPUT CAPTURE 1
REAL TIME INT
IRQ
XIRQ
SWI
ILLEGAL OP-CODE
COP FAIL
CLOCK MONITOR
RESET
EB422
26
MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Engineering Bulletin
Listing 10. MC68HC11PH8 Bootloader ROM Listing
Freescale Semiconductor, Inc...
Listing 10. MC68HC11PH8 Bootloader ROM Listing
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
*****************************************************************
* SECURED BOOTLOADER FOR MC68HC11PH8 - 26 AUG 93
*****************************************************************
* Features of this bootloader are...
*
* Auto baud select between 7812, 1200, 9600, 5208
*
and 3906 (E = 2 MHz).
* 0 - 768 byte variable length download:
*
reception of characters quits when an idle of at
*
least four character times occurs. (Note: at 9600
*
baud rate this is almost five bit times and at
*
5208 and 3906 rates the timeout is even longer).
* Jump to EEPROM at $0D00 if first download byte = $00.
* Part I.D. at $BFBE is $2088. {PH8}
*****************************************************************
* Revision A (12 MAY 93) *
* Based on 7PH8 Bootloader Rev A.
*****************************************************************
* Revision B (26 AUG 93) *
* Security mode caused an overwrite of registers
* with $FF. Fix implemented - (CPX)
*
* Altered PLL startup behaviour as follows :
* 1/ Changed programmed value read from PORT B to PORT F
* 2/ If $FF is found then use value $CC instead. This
*
winds a 38.4KHz crystal to 8MHz (i.e. * 208).
* 3/ Default delay of 10ms has been adjusted to be for a
*
38.4KHz crystal rather than 640KHz.
*
*****************************************************************
0004
0005
0008
0009
000e
0016
0023
002e
002f
0080
0035
0037
003b
003d
003e
003f
0070
0072
0073
0074
0075
0076
0077
0d00
0fff
0080
087f
* Equates (registers in direct space)
*
PORTB
EQU
$04
PORTF
EQU
$05
PORTD
EQU
$08
DDRD
EQU
$09
*
TCNT
EQU
$0E
TOC1
EQU
$16
TFLG1
EQU
$23
PLLCR
EQU
$2E
SYNR
EQU
$2F
* Bit equates for TFLG1
OC1F
EQU
$80
*
*
BPROT
EQU
$35
INIT2
EQU
$37
PPROG
EQU
$3B
INIT
EQU
$3D
TEST1
EQU
$3E
CONFIG
EQU
$3F
*
SCBD
EQU
$70
SCCR1
EQU
$72
SCCR2
EQU
$73
SCSR1
EQU
$74
SCSR2
EQU
$75
SCDRH
EQU
$76
SCDRL
EQU
$77
* Memory configuration equates
*
EEPMSTR
EQU
$0D00
EEPMEND
EQU
$0FFF
*
RAMSTR
EQU
$0080
RAMEND
EQU
$087F
Start of EEPROM
End of EEPROM
Start of RAM
End of RAM
EB422
MOTOROLA
27
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Freescale Semiconductor, Inc...
Engineering Bulletin
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131
0132
0133
0134
0135
0136
0137
0138
0139
0140
0141
0142
0143
0144
0145
* Delay constants
*
15ab
DELAYS
EQU
5547
Delay at slow baud rate
0356
DELAYF
EQU
854
Delay at fast baud rates
*
1068
PROGDEL
EQU
4200
2 mSec programming delay
*
at 2.1MHz
*
bed5
ORG
$BED5
********
*
* REVISION B - Load from PORTF, change $FF -> $CC
* Now check to see if the PLL is active:
* If VDDSYN pin is low the PLL is inactive and the
* MCU will continue using the EXTAL frequency
* This is detected since the PLLON bit is forced to
* zero.
* If VDDSYN pin is high then the MCU will switch
* to the new higher frequency. After a delay of
* 10ms (for a crystal of 38.4KHz).
* The value to be stored in the SYNR register is
* loaded from port F.
* IMPORTANT NOTE: IF SOME PINS ON PORTF ARE
*
SHORTED TO GROUND, BE SURE
*
TO REMOVE SHORTS BEFORE
*
SETTING MDA BIT FOR EXPANDED
*
BUSSES
* Procedure for PLL is:
* 1/ If PLLON=0 then continue bootloader
* 2/ Load value from port F - ACCB
* 3/ If ACCB=$FF then ACCB:=$CC
* 4/ Reset BCS=0
* 5/ Reset PLLON=0
* 6/ Store ACCB in SYNR
* 7/ Set PLLON=1
* 8/ If PLLON=0 then continue bootloader
* 9/ If PLLON=1 then wait 10ms (@ 38.4KHz)
* 10/ Set BCS=1 and MCS=1
* 11/ Continue bootloader
********
bed5
PLLSTRT
EQU
*
bed5 96 2e
LDAA
PLLCR
Get control values
bed7 2a 26
BPL
DONE
Not active carry on
bed9 d6 05
LDAB
PORTF
Get SYNR value
bedb c1 ff
CMPB
#$FF
Check for default
bedd 26 02
BNE
NOTFF
Not $FF so carry on
bedf c6 cc
LDAB
#$CC
Load value for 8MHz
bee1
NOTFF
EQU
*
bee1 84 bf
ANDA
#$BF
Reset BCS=0
bee3 97 2e
STAA
PLLCR
bee5 84 3f
ANDA
#$3F
Reset PLLON=0
bee7 97 2e
STAA
PLLCR
bee9 d7 2f
STAB
SYNR
New value for SYNR
beeb 8a 80
ORAA
#$80
Set PLLON=1
beed 97 2e
STAA
PLLCR
beef 96 2e
LDAA
PLLCR
Now check if PLL is active
bef1 2a 0c
BPL
DONE
Not active carry on
bef3 18 ce 00 0e
LDY
#14
Delay for 10ms
bef7 18 09
DELLP
DEY
bef9 26 fc
BNE
DELLP
befb 8a 44
ORAA
#$44
befd 97 2e
STAA
PLLCR
Set BCS/MCS bit for high speed
beff 39
DONE
RTS
bf00
bf00
*****************************************************************
ORG
$BF00
*****************************************************************
*****************************************************************
* Main bootloader starts here
*****************************************************************
* RESET vector points to here
BEGIN
EQU
*
EB422
28
MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Freescale Semiconductor, Inc...
Engineering Bulletin
Listing 10. MC68HC11PH8 Bootloader ROM Listing
0146
0147
0148
0149
0150
0151
0152
0153
0154
0155
0156
0157
0158
0159
0160
0161
0162
0163
0164
0165
0166
0167
0168
0169
0170
0171
0172
0173
0174
0175
0176
0177
0178
0179
0180
0181
0182
0183
0184
0185
0186
0187
0188
0189
0190
0191
0192
0193
0194
0195
0196
0197
0198
0199
0200
0201
0202
0203
0204
0205
0206
0207
0208
0209
0210
0211
0212
0213
0214
0215
0216
0217
0218
0219
bf00 8e 08 7f
bf03 8d d0
bf05
bf05
bf08
bf0a
bf0d
LDS
BSR
#RAMEND
PLLSTRT
Initialize stack pntr
Turn on PLL
CONTINU
EQU
*
LDD
#$001A
Initialize baud for...
STD
SCBD
9600 baud at 2 MHz
LDD
#$400C
Put SCI in wire-OR mode...
STD
SCCR1
Enable Xmtr and Rcvr
* Test the security bit
bf0f 12 3f 08 3d
BRSET
CONFIG $08 NOSEC
*****************************************************************
* WE ARE IN SECURITY MODE
* OUTPUT $FF ON TRANSMITTER
bf13
AGAIN
EQU
*
bf13 96 74
LDAA
SCSR1
bf15 86 ff
LDAA
#$FF
bf17 97 77
STAA
SCDRL
Transmit $FF
* ACCA NOW IS SET FOR $FF
cc
dd
cc
dd
00 1a
70
40 0c
72
* ERASE EEPROM
CLR
BPROT
Turn off Block Protect
LDAB
#$06
For EELAT and BULK ERASE
STAB
PPROG
Set EELAT=1 & ERASE=1
STAB
EEPMSTR
Store in any EEPROM location
INCB
Set EEPGM bit
3b
STAB
PPROG
to begin programming
bf ac
JSR
ERASE
Wait 10ms (@ 2MHz)
* If EEPROM is not enabled then we can't check its
* erased - ACCA is still $FF
bf29 13 3f 01 0d
BRCLR
CONFIG $01 NOEE
bf2d ce 0d 00
LDX
#EEPMSTR
* Check the EEPROM is erased
bf30
LOOP
EQU
*
bf30 a1 00
CMPA
0,X
bf32 26 df
BNE
AGAIN
EEPROM not erased
bf34 08
INX
bf35 8c 10 00
CPX
#EEPMEND+1
All checked
bf38 26 f6
BNE
LOOP
bf3a
NOEE
EQU
*
*****************************************************************
* WRITE OVER ENTIRE RAM, EXCEPT LAST TWO BYTES WHICH
* ARE USED BY THE STACK AND RAMSTR WHICH IS LEFT
* INTACT. ACCA IS STILL $FF
bf3a
ERAM
EQU
*
bf3a ce 08 7d
LDX
#RAMEND-2
bf3d
LOP1
EQU
*
bf3d a7 00
STAA
0,X
bf3f 09
DEX
bf40 8c 00 7f
CPX
#RAMSTR-1 **** REVISION B
bf43 26 f8
BNE
LOP1
*****************************************************************
* NOW ERASE CONFIG REGISTER
bf45
ECONFG
EQU
*
bf45 5a
DECB
bf46 d7 3b
STAB
PPROG
B still = $06
bf48 d7 3f
STAB
CONFIG
BULK ERASE CONFIG
bf4a 5c
INCB
bf4b d7 3b
STAB
PPROG
bf4d bd bf ac
JSR
ERASE
bf19
bf1c
bf1e
bf20
bf23
bf24
bf26
7f
c6
d7
f7
5c
d7
bd
00 35
06
3b
0d 00
bf50
bf50 cc 03
bf53 dd 16
bf55 14 73
bf58 12 08
bf5c 15 73
*****************************************************************
* NON-SECURITY AND SECURITY MODES MEET HERE
*
NOSEC
EQU
*
56
LDD
#DELAYF
Delay for fast baud rates
STD
TOC1
Set as default delay
* Send BREAK to signal ready for download
01
BSET
SCCR2 $01
Set send break bit
01 fc
BRSET
PORTD $01 *
Wait for RxD pin to go low
01
BCLR
SCCR2 $01
Clear send break bit
bf5f 13 74 20 fc
bf63 96 77
BRCLR
SCSR1 $20 *
Wait for RDRF
LDAA
SCDRL
Read data
* Data will be $00 if BREAK or $00 received
EB422
MOTOROLA
29
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Freescale Semiconductor, Inc...
Engineering Bulletin
0220
0221
0222
0223
0224
0225
0226
0227
0228
0229
0230
0231
0232
0233
0234
0235
0236
0237
0238
0239
0240
0241
0242
0243
0244
0245
0246
0247
0248
0249
0250
0251
0252
0253
0254
0255
0256
0257
0258
0259
0260
0261
0262
0263
0264
0265
0266
0267
0268
0269
0270
0271
0272
0273
0274
0275
0276
0277
0278
0279
0280
0281
0282
0283
0284
0285
0286
0287
0288
0289
0290
0291
0292
0293
bf65 26 03
bf67 7e 0d 00
bf6a
bf6a 81 f0
bf6c 27 1d
bf6e c6 d0
bf70 81 80
bf72 27 10
bf74 c6 40
bf76 85 20
bf78 27 0a
bf7a
bf7c
bf7e
bf80
c6
d7
85
26
20
71
08
09
bf82 c6 24
bf84
bf84
bf86
bf89
bf8b
bf8b
bf8f
bf8f
bf91
bf91
bf95
bf96
bf98
bf9a
bf9a
bf9c
bf9f
bfa1
bfa3
bfa7
SLOBAUD
d7 71
cc 15 ab
dd 16
BAUDOK
18 ce 00 80
WAIT
de 16
WTLOOP
12 74 20 05
09
26 f9
20 0f
NEWONE
96
18
97
18
18
26
77
a7 00
77
08
8c 08 80
e6
bfa9
bfa9 7e 00 80
bfac
bfac
bfb0
bfb0
bfb2
bfb4
bfb7
BNE
NOTZERO
Bypass jump if not $00
JMP
EEPMSTR
Jump to EEPROM if $00
NOTZERO
EQU
*
* Check div by 26 (9600 baud at 2 MHz)
CMPA
#$F0
$F0 will be seen as $F0...
BEQ
BAUDOK
if baud was correct
* Check div by 208 (1200 baud at 2 MHz)
LDAB
#$D0
Initialize B for this rate
CMPA
#$80
$FF will be seen as $80...
BEQ
SLOBAUD
if baud was correct
* Check div by 64 (3906 baud at 2 MHz)
* (equals: 8192 baud at 4.2 MHz)
LDAB
#$40
Initialize B for this rate
BITA
#$20
$FD shows as bit 5 clear...
BEQ
SLOBAUD
if baud was correct
* Change to div by 32 (7812 baud at 2 MHz)
* (equals: 8192 baud at 2.1 MHz)
LDAB
#$20
Initialize B for this rate
STAB
SCBD+1
BITA
#$08
$FF shows as bit 3 set...
BNE
BAUDOK
if baud was correct
* Change to div by 36 (7777 baud at 640KHz x 14)
*
LDAB
#$24
By default
18 ce
18 09
26 fc
7f 00
39
EQU
STAB
LDD
STD
EQU
LDY
*
SCBD+1
#DELAYS
TOC1
*
#RAMSTR
EQU
LDX
EQU
BRSET
DEX
BNE
BRA
*
TOC1
Move delay constant to X
*
SCSR1 $20 NEWONE Exit loop if RDRF set
Decrement count
WTLOOP
Loop if not timed out
STAR
Quit download on timeout
EQU
LDAA
STAA
STAA
INY
CPY
BNE
*
SCDRL
$00,Y
SCDRL
#RAMEND+1
WAIT
Store baudrate
Switch to slower...
delay constant
Point to start of RAM
Get received data
Store to next RAM location
Transmit it for handshake
Point to next RAM location
See if past end
If not, get another
STAR
EQU
*
JMP
RAMSTR
** Exit to start of RAM **
*****************************************************************
* EEPROM ERASEDELAY
ERASE
EQU
*
0b b8
LDY
#3000
BK1
EQU
*
DEY
BNE
BK1
3b
CLR
PPROG
Clear
RTS
*****************************************************************
* Block fill unused bytes with zero
bfb8 00 00 00
bfbb 42
bfbc 00 00
BSZ
$BFBB-*
*****************************************************************
* Boot ROM revision level in ASCII
*
(ORG$BFBB)
FCC
"B"
*****************************************************************
* Mask set I.D. ($0000 for EPROM parts)
*
(ORG$BFBC)
FDB
$0000
*****************************************************************
EB422
30
MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Freescale Semiconductor, Inc...
Engineering Bulletin
Listing 10. MC68HC11PH8 Bootloader ROM Listing
0294
0295
0296
0297
0298
0299
0300
0301
0302
0303
0304
0305
0306
0307
0308
0309
0310
0311
0312
0313
0314
0315
0316
0317
0318
0319
0320
0321
0322
0323
0324
0325
0326
0327
0328
0329
0330
0331
0332
0333
0334
0335
0336
0337
0338
0339
0340
0341
0342
0343
0344
0345
0346
0347
0348
0349
0350
0351
0352
0353
0354
0355
0356
0357
0358
0359
0360
0361
0362
0363
0364
0365
0366
0367
*
*
*
*
*
*
*
*
*
bfbe 20 88
bfc0
bfc2
bfc4
bfc6
bfc8
bfca
bfcc
bfce
bfd0
bfd2
bfd4
bfd6
bfd8
bfda
bfdc
bfde
bfe0
bfe2
bfe4
bfe6
bfe8
bfea
bfec
bfee
bff0
bff2
bff4
bff6
bff8
bffa
bffc
bffe
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
bf
be40
00c4
087f
00c4
00f1
00f4
00f7
00fa
007e
004a
00
00
00
00
00
00
b5
b8
bb
be
c1
c4
c7
ca
cd
d0
d3
d6
d9
dc
df
e2
e5
e8
eb
ee
f1
f4
f7
fa
fd
00
11PH8 I.D. - can be used to determine MCU type
Bit 15 is a 0 if the part is ROM (or ROMless,
1 -> EPROM)
Bit 14 is a 0 if unsecured
Bits 13 - Bit 9 are lower 5 bits of first ASCII letter
Bits 8 - Bit 4 are lower 5 bits of second ASCII letter
Bits 3 - Bit 0 are last digit of part number
(note: $50 = P , $48 = H in ASCII)
(ORG$BFBE)
FDB
%0010000010001000
*****************************************************************
* VECTORS - point to RAM for pseudo-vector JUMPs
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
$0000
$0000
$0000
$0000
$0000
$0000
$100-75
$100-72
$100-69
$100-66
$100-63
$100-60
$100-57
$100-54
$100-51
$100-48
$100-45
$100-42
$100-39
$100-36
$100-33
$100-30
$100-27
$100-24
$100-21
$100-18
$100-15
$100-12
$100-9
$100-6
$100-3
BEGIN
reserved
reserved
reserved
reserved
reserved
reserved
BIT SYNC & LOCK
PORTH WOI
8 BIT TIMERS
SCI2
SPI2
SCI1
SPI1
PULSE ACCUM INPUT EDGE
PULSE ACCUM OVERFLOW
TIMER OVERFLOW
TIMER OUTPUT COMPARE 5
TIMER OUTPUT COMPARE 4
TIMER OUTPUT COMPARE 3
TIMER OUTPUT COMPARE 2
TIMER OUTPUT COMPARE 1
TIMER INPUT CAPTURE 3
TIMER INPUT CAPTURE 2
TIMER INPUT CAPTURE 1
REAL TIME INT
IRQ
XIRQ
SWI
ILLEGAL OP-CODE
COP FAIL
CLOCK MONITOR
RESET
*********************** TBRPH8.ASM 12/5/93 ***********************
*
Motorola Copyright 1993
*
MCU resident, Interrupt driven Communication routines for 68HC11
*
monitor.Provides low level memory and stack read/write operations.
*
*
This talker DOES NOT use XIRQ
*
-----------------------------*
* N.B. TBRPH8 is designed to work with the 68HC11PH8 or other
*
compatible MCU types. This version of the TALKER is designed to
*
execute from MC68HC11PH8 Boot ROM.
*
To initiate communication with TBRPH8, the standard bootloader
*
must be used to initialise the redirected vector table and then
*
cause a jump to USER START
*
This talker does NOT support SWI handling (trace and break)
*
* CONSTANTS
TALKBASE
equ $BE40 Start of RAM
BOOTVECT
equ $00C4 Start of bootstrap vector jump table.
STACK
equ $087F At end of this talker
*
JSCI
equ $00C4 SCI interrupt service
JXIRQ
equ $00F1 XIRQ interrupt service
JSWI
equ $00F4 SWI interrupt service
JILLOP
equ $00F7 Illegal opcode service
JCOP
equ $00FA COP timeout reset service
JMPEXT
equ $7E Mnemonic for jump extended instruction
BRKCODE
equ $4A Break point signal code to host.
*
*
*
*
*
*
*
*
*
*
*
*
*
EB422
MOTOROLA
31
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Freescale Semiconductor, Inc...
Engineering Bulletin
0368
0369
0370
0371
0372
0373
0374
0375
0376
0377
0378
0379
0380
0381
0382
0383
0384
0385
0386
0387
0388
0389
0390
0391
0392
0393
0394
0395
0396
0397
0398
0399
0400
0401
0402
0403
0404
0405
0406
0407
0408
0409
0410
0411
0412
0413
0414
0415
0416
0417
0418
0419
0420
0421
0422
0423
0424
0425
0426
0427
0428
0429
0430
0431
0432
0433
0434
0435
0436
0437
0438
0439
0440
0441
004a
0020
0080
be40
be40
be40
be42
be44
be47
be49
be49
be4c
be4f
be51
be53
be55
be57
be59
be5b
be5d
86
97
ce
df
7e
c4
be 61
c5
8e
cc
dd
86
97
97
c6
d7
86
06
08 7f
00 0d
70
00
72
76
2c
73
40
be5e 7e be 5e
be61
be61 13 74 20
be65
be65
be67
be68
be6a
be6c
be6e
be6f
be71
be72
be74
be75
be77
96
43
8d
2a
8d
8f
8d
17
8d
8f
81
26
77
be79
be79
be7b
be7d
be7e
be80
be81
be82
be83
be85
a6
8d
17
8d
16
08
5a
26
3b
00
28
3b
40
2c
29
26
fe
0d
1a
f4
be86
be86 81 be
be88 26 0f
be8a
be8b
be8b
be8d
be8f
be91
be93
be95
be96
be97
be99
be99
17
8d
e7
8d
e6
d7
08
4a
26
3b
0d
00
13
00
77
f2
BRKACK
equ $4A Break point acknowledge code fromhost.
*
* REGISTERS
RDRF
equ $20 Masks for checking
TDRE
equ $80 status of SCI
*
* PROGRAM
org
TALKBASE
*
TLKRSTART EQU
*
Initialise SCI interrupt
LDAA
#JMPEXT
STAA
JSCI
LDX
#SCISRV
STX
JSCI+1
USERSTART EQU
*
LDS
#STACK
Initialise stack
LDD
#13
STD
SCBD
Initialise SCI to 19200 baud (SCBDH=0)
LDAA
#0
STAA
SCCR1
No LOOPS,WOMS,parity. Idle line wake up+8 bits
STAA
SCDRH
No data in bit 8
LDAB
#$2C
STAB
SCCR2
and enable SCI Rx interrupt & Tx.
LDAA
#$40
Enable STOP, and I bit interrupts, disable XIRQ.
TAP
Set up CCR
*
IDLE
JMP
IDLE
Now hang around for SCI interrupt from host.
*
*A RESET from host changes above jump destination to start of user code.
*
SCISRV
EQU
*
On detecting interrupt,
fc BRCLR
SCSR1
#RDRF SCISRV
*
RXSRV
EQU
*
Talker code processes received data.
LDAA
SCDRL
Read command byte, & echo it as acknowledge
COMA
inverted
BSR
OUTSCI
to host.
BPL
INH1
If command bit 7 set, then process inherent command
BSR
INSCI
else read byte count from host into ACCB.(0=256)
XGDX
Save command and byte count.
BSR
INSCI
Read high address byte
TBA
into ACCA
BSR
INSCI
then low address byte into ACCB
XGDX
Restore command in ACCA,count in ACCB,address in X
CMPA
#$FE
BNE
RXSRV1
If command is not memory read then RXSRV1
*
TREADMEM
EQU
*
REPEAT
LDAA
,X
read required address
BSR
OUTSCI
send it to host
TBA
(save byte count)
BSR
INSCI
and wait for acknowledge
TAB
(restore byte count)
INX
Increment address
DECB
Decrement byte count
BNE
TREADMEM
UNTIL all done
RTI
*
RXSRV1
EQU
*
CMPA
#$BE
BNE
RXSRVEX
If command is memory write then
*
TBA
move byte count to ACCA
TWRITMEM
EQU
*
REPEAT
BSR
INSCI
Read next byte from host into ACCB,
STAB
,X
and store at required address.
BSR
EPRG
Dummy jump - used as hook for EPROM prog
LDAB
,X
Read stored byte and
STAB
SCDRL
echo it back to host,
INX
DECA
Decrement byte count
BNE
TWRITMEM
UNTIL all done
RXSRVEX
EQU
*
and return
NULLSRV
RTI
EB422
32
MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Freescale Semiconductor, Inc...
Engineering Bulletin
Listing 11. MC68HC711E20 Secured Bootloader ROM Listing
0442
0443
0444
0445
0446
0447
0448
0449
0450
0451
0452
0453
0454
0455
0456
0457
0458
0459
0460
0461
0462
0463
0464
0465
0466
0467
0468
0469
0470
0471
0472
0473
0474
0475
0476
0477
0478
0479
0480
0481
0482
be9a
be9a
be9e
bea2
bea4
12
13
d6
39
bea5
bea5 13
bea9 97
beab 39
*
INSCI
74 0a a2 BRSET
74 20 f8
77
EPRG
*
OUTSCI
74 80 fc OUTSCI1
77
beac
beac 81 7e
beae 26 0c
beb0
beb1
beb2
beb4
beb5
beb7
beb8
beba
30
8f
8d
17
8d
30
c6
20
*
INH1
*
INH1A
f1
ee
09
bd
bebc
bebc 81 3e
bebe 26 d9
*
INH2
EQU
SCSR1
BRCLR
LDAB
RTS
*
#$0A TLKRSTART
Restart talker if break detected
SCSR1 #RDRF INSCI Loop to INSCI if no character received
SCDRL
then read data received from host
and return with data in ACCB
EQU
BRCLR
STAA
RTS
*
Only register Y modified.
SCSR1 #$80 OUTSCI1Loop until set before storing next byte
SCDRL
Important - Updates CCR!
EQU
CMPA
BNE
*
#$7E
INH2
If command is read MCU registers then INH1A
else jump to INH2
OUTSCI
Move stack pointer to X
then to ACCD
send stack pointer to host (high byte first)
TSX
XGDX
BSR
TBA
BSR
TSX
LDAB
BRA
OUTSCI
#9
TREADMEM
then low byte
Restore X (=stack pointer)
then return 9 bytes on stack
i.e. CCR,ACCB,ACCA,IXH,IXL,IYH,IYL,PCH,PCL
EQU
CMPA
BNE
*
#$3E
RXSRVEX
If command is write MCU registers then don't jump
else quit processing
BSR
TBA
BSR
XGDX
TXS
LDAA
BRA
INSCI
get stack pointer from host (High byte first)
*
bec0
bec2
bec3
bec5
bec6
bec7
bec9
8d
17
8d
8f
35
86
20
d8
d5
09
c0
INSCI
#9
TWRITMEM
Move to X reg
and copy to stack pointer
Then put next 9 bytes from host on to stack
*
*****************************************************************
* Block fill unused bytes with zero
becb 00 00 00 00 00 00
00 00 00 00
0483
0484
0485
0486
0487
BSZ
$BED5-*
*****************************************************************
END
Listing 11. MC68HC711E20 Secured Bootloader ROM Listing
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 0008
0018 0009
**********************************************************************
* FIRMWARE FOR SECURED 68HC711E20 - 11 December 1992
*
**********************************************************************
* SECURED EPROM VERSION
*
* BASED ON SECURE 711E9 BOOTLOADER 09 MAY 92
* EXTENDED TO CHECK BOTH ROM BLOCKS OF E20
*
* THIS NEW VERSION ALLOWS VARIABLE LENGTH DOWNLOAD
* BY QUITTING RECEPTION OF CHARACTERS WHEN AN IDLE
* OF AT LEAST FOUR WORD TIMES OCCURS
*
* EQUATES FOR USE WITH INDEX OFFSET = $1000
*
*
PORTD
EQU
$08
DDRD
EQU
$09
EB422
MOTOROLA
33
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Freescale Semiconductor, Inc...
Engineering Bulletin
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0016
0028
002b
002c
002d
002e
002f
0035
003b
003e
003f
b600
b7ff
d000
ffff
9000
afff
0000
02ff
0db0
021b
bf00
bf00
bf00 8e 02 ff
bf03 ce 10 00
bf06 1c 28 20
bf09 cc a2 0c
bf0c a7 2b
bf0e e7 2d
bf10 1e 3f 08 5e
bf14
bf14 a6 2e
TOC1
EQU
$16
[STORAGE (POOR STYLE)]
SPCR
EQU
$28
(FOR DWOM BIT)
BAUD
EQU
$2B
SCCR1
EQU
$2C
SCCR2
EQU
$2D
SCSR
EQU
$2E
SCDAT
EQU
$2F
BPROT
EQU
$35
PPROG
EQU
$3B
TEST1
EQU
$3E
CONFIG
EQU
$3F
*
* MORE EQUATES
*
EEPSTR
EQU
$B600
START OF EEPROM
EEPEND
EQU
$B7FF
END OF EEPROM
*
EP1STR
EQU
$D000
START OF EPROM 1
EP1END
EQU
$FFFF
END OF EPROM 1
EP2STR
EQU
$9000
START OF EPROM 2
EP2END
EQU
$AFFF
END OF EPROM 2
*
RAMSTR
EQU
$0000
RAMEND
EQU
$02FF
*
DELAYS
EQU
3504
DELAY AT SLOW BAUD
DELAYF
EQU
539
DELAY AT FAST BAUD
*
********
* THIS BOOTSTRAP PROGRAM ALLOWS THE USER TO
* DOWNLOAD A PROGRAM OF 0 - 768 BYTES.
* THE PROGRAM MUST START AT $0000.
* EACH BYTE OF THE PROGRAM IS RECEIVED BY THE SCI.
* THE FIRST BYTE ESTABLISHES BAUD RATE.
* THEN THE PROGRAM IS DOWNLOADED STARTING WITH
* THE $0000 BYTE AND WORKING UP TOWARD THE $01FF
* A DELAY OF FOUR WORD TIMES (AT EITHER BAUD RATE)
* CAUSES THE RECEPTION OF CHARACTERS TO STOP AND
* A JUMP TO $0000.
*
* THE TRANSMITTER WILL BE USED FOR THE PURPOSE
* OF COMMUNICATION TO THE OUTSIDE WORLD.
*
*********************************************************************
ORG
$BF00
*
BEGIN
EQU
*
* INIT STACK
LDS
#RAMEND
* INIT X REG FOR INDEXED ACCESS TO REGISTERS
LDX
#$1000
********
* PUT PORT D IN WIRE OR MODE
BSET
SPCR,X $20
* INIT SCI AND RESTART BAUD DIVIDER CHAIN
LDD
#$A20C
DIV BY 16
STAA
BAUD,X
* RECEIVER & TRANSMITTER ENABLED
STAB
SCCR2,X
********
* TEST THE SECURITY BIT
BRSET
CONFIG,X $08 NOSEC
*********************************************************************
* WE ARE IN SECURITY MODE
*
* OUTPUT $FF ON TRANSMITTER
AGAIN
EQU
*
LDAA
SCSR,X
EB422
34
MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Freescale Semiconductor, Inc...
Engineering Bulletin
Listing 11. MC68HC711E20 Secured Bootloader ROM Listing
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131
0132
0133
0134
0135
0136
0137
0138
0139
0140
0141
0142
0143
0144
0145
0146
0147
0148
0149
0150
0151
0152
0153
0154
bf16 86 ff
bf18 a7 2f
bf1a 6f 35
bf1c
bf1d
bf1f
bf22
54
e7 3b
f7 b6 00
8d 34
bf24 1f 3f 01 11
bf28 18 ce b6 00
bf2c
bf2c 18 a1 00
bf2f
bf31
bf33
bf37
bf39
bf39
bf39
bf3a
bf3d
bf3d
bf3f
bf40
bf42
bf45
bf47
bf49
bf4c
bf4e
bf50
bf53
bf55
bf56
26
18
18
26
e3
08
8c b8 00
f3
3c
ce 02 fd
a7 00
09
26 fb
ce
8d
26
ce
a1
8d
8c
26
38
20
d0 00
1f
fc
90 00
00
16
b0 00
f7
14
LDAA
#$FF
STAA
SCDAT,X
* ACCA NOW IS SET FOR $FF
*
* ERASE EEPROM:
* TURN OFF BLOCK PROTECT
CLR
BPROT,X
* SET ERASE AND EELAT BITS BEFORE USING "ERASE"
LSRB
CHANGE $0C TO $06
STAB
PPROG,X
STAB
EEPSTR
WRITE EEPROM LOCATION
BSR
ERASE
* ACCB IS NOW SET FOR $06
*
********
* ERASE CYCLE IS COMPLETE
*
* IF THE EEPROM IS NOT ENABLED,
* WE CAN'T CHECK THAT THE EEPROM IS ERASED
BRCLR
CONFIG,X $01 NOEE
* EEPROM IS ON,
* NOW CHECK THAT THE EEPROM IS ERASED
LDY
#EEPSTR
LOOP
EQU
*
CMPA
0,Y
(A = $FF)
* ANY UNERASED BYTE SENDS US BACK TO ERASE AGAIN
BNE
AGAIN
INY
CPY
#EEPEND+1
BNE
LOOP
NOEE
EQU
*
*********************************************************************
* WRITE OVER ENTIRE RAM, EXCEPT LAST TWO BYTES
* WHICH ARE USED BY THE STACK & $0000 WHICH IS
* LEFT INTACT
*
ERAM
EQU
*
PSHX
LDX
#RAMEND-2
LOP1
EQU
*
STAA
$00,X
DEX
BNE
LOP1
*
PULX
<<<<
* DO NOT SEPARATE RAM AND EPROM ROUTINES WITHOUT
* FIXING THE STACK (PULX)
*********************************************************************
* CONFIRM THAT EPROM IS ERASED
*
LDX
#EP1STR
LOP2
BSR
TSTLP
BNE
LOP2
LDX
#EP2STR
LOP3
CMPA
0,X
(A=$FF)
BSR
TSTLP
CPX
#EP2END+1
BNE
LOP3
PULX
<<<<
BRA
ECONFG
*********************************************************************
* BOOTLOADER SUBROUTINES
*
* EEPROM ERASE SUBROUTINE
*
* ASSUMES CALLING ROUTINE HAS ALREADY SET ERASE
* AND EELAT BITS, AS WELL AS ACCESSED WHATEVER
* IS TO BE ERASED
EB422
MOTOROLA
35
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Freescale Semiconductor, Inc...
Engineering Bulletin
0155
0156
0157
0158
0159
0160
0161
0162
0163
0164
0165
0166
0167
0168
0169
0170
0171
0172
0173
0174
0175
0176
0177
0178
0179
0180
0181
0182
0183
0184
0185
0186
0187
0188
0189
0190
0191
0192
0193
0194
0195
0196
0197
0198
0199
0200
0201
0202
0203
0204
0205
0206
0207
0208
0209
0210
0211
0212
0213
0214
0215
0216
0217
0218
0219
0220
0221
0222
bf58
bf58 1c 3b 01
bf5b 18 ce 0b b8
bf5f 18 09
bf61 26 fc
bf63 6f 3b
bf65 39
bf66
bf68
bf6a
bf6b
a1 00
26 fe
08
39
bf6c
bf6c e7 3b
bf6e e7 3f
bf70 8d e6
bf72
bf72 cc 02 1b
bf75 ed 16
bf77 1c 2d 01
bf7a 1e 08 01 fc
bf7e 1d 2d 01
bf81 1f 2e 20 fc
bf85 a6 2f
bf87 26 03
bf89 7e b6 00
bf8c
bf8c 81 ff
bf8e 27 08
bf90 1c 2b 33
bf93 cc 0d b0
bf96 ed 16
bf98
bf98 18 ce 00 00
*
* ENTRY X=$1000
* EXIT X=$1000, Y=$0000
*
ERASE
EQU
*
* SET EEPGM BIT
BSET
PPROG,X $01
* 10 MILLISEC DELAY @ 2.1 MHZ
LDY
#3000
BK1
DEY
BNE
BK1
* TURN OFF ERASE AND EELAT BITS
CLR
PPROG,X
RTS
*
* EPROM TEST SUBROUTINE
*
TSTLP
CMPA
0,X
BNE
*
TSTOK
INX
RTS
(A=$FF)
*********************************************************************
* NOW ERASE CONFIG REGISTER
*
ECONFG
EQU
*
* SET ERASE AND EELAT BITS
STAB
PPROG,X
(B STILL = $06)
* WRITE CONFIG REGISTER LATCH IT FOR ERASURE
STAB
CONFIG,X
BSR
ERASE
********
* ERASE CYCLE IS COMPLETE
*
*********************************************************************
* NON-SECURITY AND SECURITY MODES MEET HERE
*
NOSEC
EQU
*
********
* SET UP DELAY FOR FASTEST BAUD RATE
LDD
#DELAYF
STD
TOC1,X
********
* SEND BREAK TO SIGNAL START OF DOWNLOAD
BSET
SCCR2,X $01
* CLEAR BREAK AS SOON AS START BIT IS DETECTED
BRSET
PORTD,X $01 *
BCLR
SCCR2,X $01
CLEAR BREAK
* WAIT FOR FIRST CHARACTER (USERS SEND $FF)
BRCLR
SCSR,X $20 *
WAIT FOR RDRF
LDAA
SCDAT,X
READ DATA
* IF DATA = $00 (BREAK OR $00), THEN JUMP TO EEPROM
BNE
NOTZERO
JMP
EEPSTR
NOTZERO
EQU
*
* IF DATA = $FF, THEN /16 IS CORRECT BAUD
CMPA
#$FF
BEQ
BAUDOK
* ELSE CHANGE TO /104 (/13 & /8) 1200 @ 2MHZ
BSET
BAUD,X $33
* SET UP DELAY FOR SLOWER BAUD RATE
LDD
#DELAYS
STD
TOC1,X
*
BAUDOK
EQU
*
LDY
#RAMSTR
PNTR TO START OF RAM
*
* TIME EACH BYTE
EB422
36
MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Freescale Semiconductor, Inc...
Engineering Bulletin
Listing 11. MC68HC711E20 Secured Bootloader ROM Listing
0223
0224
0225
0226
0227
0228
0229
0230
0231
0232
0233
0234
0235
0236
0237
0238
0239
0240
0241
0242
0243
0244
0245
0246
0247
0248
0249
0250
0251
0252
0253
0254
0255
0256
0257
0258
0259
0260
0261
0262
0263
0264
0265
0266
0267
0268
0269
0270
0271
0272
0273
0274
0275
0276
0277
0278
0279
0280
0281
0282
0283
0284
0285
0286
0287
0288
0289
0290
bf9c ec 16
bf9e
bfa2
bfa3
bfa4
bfa5
bfa7
1e 2e 20 07
8f
09
8f
26 f7
20 0f
bfa9
bfa9
bfab
bfae
bfb0
bfb2
bfb6
a6
18
a7
18
18
26
2f
a7 00
2f
08
8c 03 00
e4
bfb8
bfb8 7e 00 00
bfbb
bfbb 41
bfbc 00 00
bfbe cb f4
bfc0
bfc2
bfc4
bfc6
bfc8
bfca
bfcc
bfce
bfd0
bfd2
bfd4
bfd6
bfd8
bfda
bfdc
bfde
bfe0
bfe2
bfe4
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
c4
c7
ca
cd
d0
d3
d6
d9
WAIT
*
WTLOOP
LDD
TOC1,X
BRSET
XGDX
DEX
XGDX
BNE
BRA
SCSR,X $20 NEWONE
PUT DELAY TIME IN ACCD
DELAY INTO X
DECREMENT DELAY
RETURN DELAY TO ACCD
WTLOOP
STAR
* DID NOT TIME OUT
NEWONE
EQU
*
* READ IN BYTE AND PUT INTO RAM
LDAA
SCDAT,X
STAA
$00,Y
STAA
SCDAT,X
HANDSHAKE
INY
CPY
#RAMEND+1
BNE
WAIT
*********************************************************************
* START USER'S PROGRAM
*
STAR
EQU
*
JMP
RAMSTR
*********************************************************************
* FILL UNUSED BYTES WITH ZERO
*
BSZ
$BFBB-*
*
*********************************************************************
* REVISION LEVEL IN ASCII
*
(ORG
$BFB)
FCC
"A"
*********************************************************************
* MASK I.D. ($0000 FOR EPROM PARTS)
*
(ORG
$BFB)
FDB
$0000
*********************************************************************
* 711E20 I.D. - can be used to determine MCU type
* Bit 15 is a 0 if the part is ROM (or ROMless,
* 1 -> EPROM)
* Bit 14 is a 0 if unsecured
* Bits 13 - Bit 9 are lower 5 bits of 1st ASCII letter
* Bits 8 - Bit 5 are $F => last five bits are number
* Bits 4 - Bit 0 are last digit of part number
* (note: $45 = E in ASCII)
*
(ORG$BFB)
FDB
%1100101111110100
*********************************************************************
* VECTORS
($BDC0)
*
FDB
$0000
reserved
FDB
$0000
reserved
FDB
$0000
reserved
FDB
$0000
reserved
FDB
$0000
reserved
FDB
$0000
reserved
FDB
$0000
reserved
FDB
$0000
reserved
FDB
$0000
reserved
FDB
$0000
reserved
FDB
$0000
reserved
FDB
$100-60
SCI
FDB
$100-57
SPI
FDB
$100-54
PULSE ACCUM INPUT EDGE
FDB
$100-51
PULSE ACCUM OVERFLOW
FDB
$100-48
TIMER OVERFLOW
FDB
$100-45
TIMER OUTPUT COMPARE 5
FDB
$100-42
TIMER OUTPUT COMPARE 4
FDB
$100-39
TIMER OUTPUT COMPARE 3
EB422
MOTOROLA
37
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Freescale Semiconductor, Inc...
Engineering Bulletin
0291
0292
0293
0294
0295
0296
0297
0298
0299
0300
0301
0302
0303
0304
0305
0306
0307
0308
0309
0310
0311
0312
0313
0314
0315
0316
0317
0318
0319
0320
0321
0322
0323
0324
0325
0326
0327
0328
0329
0330
0331
0332
0333
0334
0335
0336
0337
0338
0339
0340
0341
0342
0343
0344
0345
0346
0347
0348
0349
0350
0351
0352
0353
0354
0355
0356
0357
0358
bfe6
bfe8
bfea
bfec
bfee
bff0
bff2
bff4
bff6
bff8
bffa
bffc
bffe
00
00
00
00
00
00
00
00
00
00
00
00
bf
dc
df
e2
e5
e8
eb
ee
f1
f4
f7
fa
fd
00
be40
00c4
02ff
1000
00c4
00f1
00f4
00f7
00fa
007e
004a
004a
002f
0020
0080
0008
0002
be40
be40
be40
be42
be44
be47
be49
be49
be4c
be4f
be51
be54
be56
86
97
ce
df
7e
c4
be 5e
c5
8e
ce
6f
cc
a7
e7
02 ff
10 00
2c
30 2c
2b
2d
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
FDB
$100-36
$100-33
$100-30
$100-27
$100-24
$100-21
$100-18
$100-15
$100-12
$100-9
$100-6
$100-3
BEGIN
TIMER OUTPUT COMPARE 2
TIMER OUTPUT COMPARE 1
TIMER INPUT CAPTURE 3
TIMER INPUT CAPTURE 2
TIMER INPUT CAPTURE 1
REAL TIME INT
IRQ
XIRQ
SWI
ILLEGAL OP-CODE
COP FAIL
CLOCK MONITOR
RESET
************************ TBRE20.ASC 31/8/92 **************************
* Motorola Copyright 1988,1990,1992
*
* MCU resident, Interrupt driven Communication routines for 68HC11
*
* monitor. Provides low level memory and stack read/write operations.*
*
*
*
This talker DOES NOT uses XIRQ
*
*
-----------------------------*
*
*
* N.B. TBRE20 is designed to work with the 68HC11E20 or other
*
*
compatible MCU types. This version of the TALKER is designed *
*
to execute from MC68HC711E20 Boot ROM.
*
*
To initiate communication with TBRE20, the standard bootloader*
*
must be used to initialise the redirected vector table and
*
*
then cause a jump to USERSTART
*
*
* CONSTANTS
TALKBASE
equ
$BE40
BOOTVECT
equ
$00C4
Start of boot vectors
STACK
equ
$02FF
User may alter this
REGBASE
equ
$1000
*
JSCI
equ
$00C4
JXIRQ
equ
$00F1
JSWI
equ
$00F4
JILLOP
equ
$00F7
JCOP
equ
$00FA
Mnemonic for jump ext
JMPEXT
equ
$7E
BRKCODE
equ
$4A
Break point code
BRKACK
equ
$4A
Break point ack
*
* REGISTERS
SCDR
equ
$2F
*
RDRF
equ
$20
TDRE
equ
$80
OR
equ
$08
FE
equ
$02
*
* PROGRAM
org TALKBASE
*
TLKRSTART
EQU
*
Initialise SCI int
LDAA
#JMPEXT
STAA
JSCI
LDX
#SCISRV
STX
JSCI+1
USERSTART
EQU
*
LDS
#STACK
LDX
#REGBASE
CLR
SCCR1,X
LDD
#$302C
Init SCI to 9600 baud,
STAA
BAUD,X
no parity, no int
STAB
SCCR2,X
& enable SCI tx & rx.
EB422
38
MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Freescale Semiconductor, Inc...
Engineering Bulletin
Listing 11. MC68HC711E20 Secured Bootloader ROM Listing
0359
0360
0361
0362
0363
0364
0365
0366
0367
0368
0369
0370
0371
0372
0373
0374
0375
0376
0377
0378
0379
0380
0381
0382
0383
0384
0385
0386
0387
0388
0389
0390
0391
0392
0393
0394
0395
0396
0397
0398
0399
0400
0401
0402
0403
0404
0405
0406
0407
0408
0409
0410
0411
0412
0413
0414
0415
0416
0417
0418
0419
0420
0421
0422
0423
0424
0425
0426
be58 86 40
be5a 06
be5b 7e be 5b
be5e
be5e b6 10 2e
be61 84 20
be63 27 f9
be65
be65
be68
be69
be6b
be6d
be6f
be70
be72
be73
be75
be76
be78
b6
43
8d
2a
8d
8f
8d
17
8d
8f
81
26
10 2f
be7a
be7a
be7c
be7e
be7f
be81
be82
be83
be84
be86
a6
8d
17
8d
16
08
5a
26
3b
00
33
46
51
33
30
2d
fe
0d
21
f4
be87
be87 81 be
be89 26 16
be8b
be8c
be8c
be8e
be90
be94
be96
be98
be9a
be9d
be9e
be9f
bea1
bea1
bea2
bea2
bea5
bea7
bea9
beab
bead
beb0
17
8d
e7
18
18
26
e6
f7
08
4a
26
14
00
ce 00 01
09
fc
00
10 2f
eb
3b
f6
c5
26
c4
27
f6
39
10 2e
00
97
20
f5
10 2f
beb1
beb1 18 8f
beb3 b6 10 2e
beb6 2a fb
LDAA
TAP
#$40
Enable STOP, and I bit
int, disable XIRQ.
*
Now hang around for
IDLE
JMP
IDLE
SCI int from host.
* A RESET from host changes above jump destination to
* start of user code.
SCISRV
EQU
*
On detecting int,
LDAA
SCSR+REGBASE
assume rx caused it.
ANDA
#RDRF
BEQ
SCISRV
otherwise loop here
*
RXSRV
EQU
*
Process received data.
LDAA
SCDR+REGBASE
Read cmd byte, & tx it
COMA
inverted
BSR
OUTSCI
as ack to host.
BPL
INH1
Bit 7 set? => inherent
BSR
INSCI
else B = byte count
XGDX
Save cmd and byte cnt.
BSR
INSCI
Read high address byte
TBA
into ACCA
BSR
INSCI
then B = low addr byte
XGDX
A=cmd; B=cnt; X=addr
CMPA
#$FE
BNE
RXSRV1
If cmd is mem read ...
*
TREADMEM
EQU
*
REPEAT
LDAA ,X
read required address
BSR OUTSCI send it to host
TBA
(save byte count)
BSR INSCI
and wait for ack
TAB
(restore byte count)
INX
Increment address
DECB
Decrement byte count
BNE TREADMEM UNTIL all done
RTI
& return
*
RXSRV1
EQU *
CMPA #$BE
BNE RXSRVEX If cmd is mem write ..
*
TBA
move byte count to A
TWRITMEM
EQU
*
REPEAT
BSR
INSCI
Read next byte into B
STAB
,X
and store at req addr
LDY
#$0001
Set up wait loop
WAITPOLL
DEY
BNE
WAITPOLL
LDAB
,X
Read stored byte and
STAB
SCDR+REGBASE
echo it back to host,
INX
DECA
Decrement byte count
BNE
TWRITMEM
UNTIL all done
RXSRVEX
EQU
*
and return
NULLSRV
RTI
*
INSCI
EQU *
LDAB
SCSR+REGBASE
Wait for RDRF=1
BITB
#(FE+OR)
If break detected then
BNE
TLKRSTART
restart talker.
ANDB
#RDRF
BEQ
INSCI
LDAB
SCDR+REGBASE
read data received
RTS
& return B = data
*
OUTSCI
EQU
*
Only Y modified.
XGDY
Enter with A = tx data
OUTSCI1
LDAA
SCSR+REGBASE
BPL
OUTSCI1
MS bit is TDRE flag
EB422
MOTOROLA
39
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Freescale Semiconductor, Inc...
Engineering Bulletin
0427
0428
0429
0430
0431
0432
0433
0434
0435
0436
0437
0438
0439
0440
0441
0442
0443
0444
0445
0446
0447
0448
0449
0450
0451
0452
0453
0454
0455
0456
0457
0458
0459
0460
0461
0462
0463
0464
0465
0466
0467
0468
0469
0470
0471
0472
0473
0474
0475
0476
0477
0478
0479
0480
0481
0482
0483
0484
0485
0486
beb8 18 8f
beba b7 10 2f
bebd 39
bebe
bebe 81 7e
bec0 26 0c
bec2
bec3
bec4
bec6
bec7
bec9
beca
becc
30
8f
8d
17
8d
30
c6
20
*
INH1
*
INH1A
eb
e8
09
ac
bece
bece 81 3e
bed0 26 12
*
INH2
XGDY
STAA
RTS
SCDR+REGBASE
Important: Updates CCR
EQU
CMPA
BNE
*
#$7E
INH2
If cmd is read regs ..
TSX
XGDX
BSR
TBA
BSR
TSX
LDAB
BRA
#9
TREADMEM
then low byte
Restore X (=SP)
Tx 9 bytes on stack
i.e. CCR,ACCB,ACCA,IXH
IXL,IYH,IYL,PCH,PLC
EQU
CMPA
BNE
*
#$3E
SWISRV1
If cmd is write regs..
BSR
TBA
BSR
XGDX
TXS
LDAA
BRA
INSCI
get SP High byte first
OUTSCI
OUTSCI
Move SP to X
then to ACCD
send SP high byte 1st
*
bed2
bed4
bed5
bed7
bed8
bed9
bedb
bedd
bedd
bedf
bee1
bee2
bee4
bee4
bee6
bee8
bee9
beeb
beec
beed
beef
bef1
bef2
bef4
bef7
bef9
8d
17
8d
8f
35
86
20
ce
cb
09
af
*
SWISRV
86 4a
8d d0
0e
20 fd
SWIIDLE
INSCI
#9
TWRITMEM
Move to X reg
and copy to SP
Then 9 bytes to stack
EQU
*
Breakpoints by SWI
LDAA
#BRKCODE
Force host to proc BR
BSR OUTSCI by sending it BREAK
CLI
BRA SWIIDLE then wait for response
*
SWISRV1
EQU *
CMPA #BRKACK If host acknowledges
BNE RXSRVEX
TSX
move SP to SWI stack &
09
LDAB #9
ABX
Send user code
TXS
breakpoint return
07
LDD 7,X
address to host
c0
BSR OUTSCI (high byte first)
TBA
bd
BSR OUTSCI (low byte next)
be e1
LDD #SWIIDLE force idle loop on
07
STD 7,X
return from breakpoint
c7
BRA INH1A but first return all
*
MCU registers to host
**********************************************************************
* FILL UNUSED BYTES WITH ZERO
*
befb 00 00 00 00 00
BSZ
$BF00-*
*
**********************************************************************
81
26
30
c6
3a
35
ec
8d
17
8d
cc
ed
20
4a
b9
END
EB422
40
MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Engineering Bulletin
Listing 12. MC68HC711E32 Secured Bootloader ROM Listing
Freescale Semiconductor, Inc...
Listing 12. MC68HC711E32 Secured Bootloader ROM Listing
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0008
0009
0016
0028
002b
002c
002d
002e
002f
0035
003b
003e
003f
b600
b7ff
c000
ffff
7000
afff
0000
07ff
0db0
021b
******************************************************************
* FIRMWARE FOR SECURED 68HC711E32 - 16 July 1993
*
******************************************************************
* SECURED EPROM VERSION
*
* Part I.D. at $BFBE is $CBE0. {7E32}
******************************************************************
* REVISION A
* BASED ON SECURE 711E20 BOOTLOADER 11 DECEMBER 92
* EXTENDED TO CHECK BOTH LARGER ROM BLOCKS OF E32
*
******************************************************************
* THIS NEW VERSION ALLOWS VARIABLE LENGTH DOWNLOAD
* BY QUITTING RECEPTION OF CHARACTERS WHEN AN IDLE
* OF AT LEAST FOUR WORD TIMES OCCURS
*
* EQUATES FOR USE WITH INDEX OFFSET = $1000
*
*
PORTD
EQU
$08
DDRD
EQU
$09
TOC1
EQU
$16
[STORAGE (POOR STYLE)]
SPCR
EQU
$28
(FOR DWOM BIT)
BAUD
EQU
$2B
SCCR1
EQU
$2C
SCCR2
EQU
$2D
SCSR
EQU
$2E
SCDAT
EQU
$2F
BPROT
EQU
$35
PPROG
EQU
$3B
TEST1
EQU
$3E
CONFIG
EQU
$3F
*
* MORE EQUATES
*
EEPSTR
EQU
$B600
START OF EEPROM
EEPEND
EQU
$B7FF
END OF EEPROM
*
EP1STR
EQU
$C000
START OF EPROM 1
EP1END
EQU
$FFFF
END OF EPROM 1
EP2STR
EQU
$7000
START OF EPROM 2
EP2END
EQU
$AFFF
END OF EPROM 2
*
RAMSTR
EQU
$0000
RAMEND
EQU
$07FF
*
DELAYS
EQU
3504
DELAY AT SLOW BAUD
DELAYF
EQU
539
DELAY AT FAST BAUD
*
********
* THIS BOOTSTRAP PROGRAM ALLOWS THE USER TO
* DOWNLOAD A PROGRAM OF 0 - 2048 BYTES.
* THE PROGRAM MUST START AT $0000.
* EACH BYTE OF THE PROGRAM IS RECEIVED BY THE SCI.
* THE FIRST BYTE ESTABLISHES BAUD RATE.
* THEN THE PROGRAM IS DOWNLOADED STARTING WITH
* THE $0000 BYTE AND WORKING UP TOWARD THE $03FF
* A DELAY OF FOUR WORD TIMES (AT EITHER BAUD RATE)
* CAUSES THE RECEPTION OF CHARACTERS TO STOP AND
* A JUMP TO $0000.
*
* THE TRANSMITTER WILL BE USED FOR THE PURPOSE
* OF COMMUNICATION TO THE OUTSIDE WORLD.
*
******************************************************************
EB422
MOTOROLA
41
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Freescale Semiconductor, Inc...
Engineering Bulletin
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131
0132
0133
0134
bf00
*
BEGIN
* INIT STACK
bf00
bf00 8e 07 ff
bf03 ce 10 00
bf06 1c 28 20
bf09 cc a2 0c
bf0c a7 2b
bf0e e7 2d
bf10 1e 3f 08 5e
bf14
bf14 a6 2e
bf16 86 ff
bf18 a7 2f
bf1a 6f 35
bf1c
bf1d
bf1f
bf22
54
e7 3b
f7 b6 00
8d 34
bf24 1f 3f 01 11
bf28 18 ce b6 00
bf2c
bf2c 18 a1 00
bf2f
bf31
bf33
bf37
bf39
bf39
bf39
bf3a
bf3d
bf3d
bf3f
bf40
26
18
18
26
e3
08
8c b8 00
f3
3c
ce 07 fd
a7 00
09
26 fb
ORG
$BF00
EQU
*
LDS
#RAMEND
* INIT X REG FOR INDEXED ACCESS TO REGISTERS
LDX
#$1000
********
* PUT PORT D IN WIRE OR MODE
BSET
SPCR,X $20
* INIT SCI AND RESTART BAUD DIVIDER CHAIN
LDD
#$A20C
DIV BY 16
STAA
BAUD,X
* RECEIVER & TRANSMITTER ENABLED
STAB
SCCR2,X
********
* TEST THE SECURITY BIT
BRSET
CONFIG,X $08 NOSEC
******************************************************************
* WE ARE IN SECURITY MODE
*
* OUTPUT $FF ON TRANSMITTER
AGAIN
EQU
*
LDAA
SCSR,X
LDAA
#$FF
STAA
SCDAT,X
* ACCA NOW IS SET FOR $FF
*
* ERASE EEPROM:
* TURN OFF BLOCK PROTECT
CLR
BPROT,X
* SET ERASE AND EELAT BITS BEFORE USING "ERASE"
LSRB
CHANGE $0C TO $06
STAB
PPROG,X
STAB
EEPSTR
WRITE EEPROM LOCATION
BSR
ERASE
* ACCB IS NOW SET FOR $06
*
********
* ERASE CYCLE IS COMPLETE
*
* IF THE EEPROM IS NOT ENABLED,
* WE CAN'T CHECK THAT THE EEPROM IS ERASED
BRCLR
CONFIG,X $01 NOEE
* EEPROM IS ON,
* NOW CHECK THAT THE EEPROM IS ERASED
LDY
#EEPSTR
LOOP
EQU
*
CMPA
0,Y
(A = $FF)
* ANY UNERASED BYTE SENDS US BACK TO ERASE AGAIN
BNE
AGAIN
INY
CPY
#EEPEND+1
BNE
LOOP
NOEE
EQU
*
******************************************************************
* WRITE OVER ENTIRE RAM, EXCEPT LAST TWO BYTES
* WHICH ARE USED BY THE STACK & $0000 WHICH IS
* LEFT INTACT
*
ERAM
EQU
*
PSHX
LDX
#RAMEND-2
LOP1
EQU
*
STAA
$00,X
DEX
BNE
LOP1
*
PULX
<<<<
EB422
42
MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Freescale Semiconductor, Inc...
Engineering Bulletin
Listing 12. MC68HC711E32 Secured Bootloader ROM Listing
0135
0136
0137
0138
0139
0140
0141
0142
0143
0144
0145
0146
0147
0148
0149
0150
0151
0152
0153
0154
0155
0156
0157
0158
0159
0160
0161
0162
0163
0164
0165
0166
0167
0168
0169
0170
0171
0172
0173
0174
0175
0176
0177
0178
0179
0180
0181
0182
0183
0184
0185
0186
0187
0188
0189
0190
0191
0192
0193
0194
0195
0196
0197
0198
0199
0200
0201
0202
0203
bf42
bf45
bf47
bf49
bf4c
bf4e
bf50
bf53
bf55
bf56
ce
8d
26
ce
a1
8d
8c
26
38
20
c0 00
1f
fc
70 00
00
16
b0 00
f7
14
bf58
bf58 1c 3b 01
bf5b 18 ce 0b b8
bf5f 18 09
bf61 26 fc
bf63 6f 3b
bf65 39
bf66
bf68
bf6a
bf6b
a1 00
26 fe
08
39
bf6c
bf6c e7 3b
bf6e e7 3f
bf70 8d e6
bf72
bf72 cc 02 1b
bf75 ed 16
bf77 1c 2d 01
* DO NOT SEPARATE RAM AND EPROM ROUTINES WITHOUT
* FIXING THE STACK (PULX)
******************************************************************
* CONFIRM THAT EPROM IS ERASED
*
LDX
#EP1STR
LOP2
BSR
TSTLP
BNE
LOP2
LDX
#EP2STR
LOP3
CMPA
0,X
(A=$FF)
BSR
TSTLP
CPX
#EP2END+1
BNE
LOP3
PULX
<<<<
BRA
ECONFG
******************************************************************
* BOOTLOADER SUBROUTINES
*
* EEPROM ERASE SUBROUTINE
*
* ASSUMES CALLING ROUTINE HAS ALREADY SET ERASE
* AND EELAT BITS, AS WELL AS ACCESSED WHATEVER
* IS TO BE ERASED
*
* ENTRY X=$1000
* EXIT X=$1000, Y=$0000
*
ERASE
EQU
*
* SET EEPGM BIT
BSET
PPROG,X $01
* 10 MILLISEC DELAY @ 2.1 MHZ
LDY
#3000
BK1
DEY
BNE
BK1
* TURN OFF ERASE AND EELAT BITS
CLR
PPROG,X
RTS
*
* EPROM TEST SUBROUTINE
*
TSTLP
CMPA
0,X
(A=$FF)
BNE
*
(Loop here forever)
TSTOK
INX
RTS
******************************************************************
* NOW ERASE CONFIG REGISTER
*
ECONFG
EQU
*
* SET ERASE AND EELAT BITS
STAB
PPROG,X
(B STILL = $06)
* WRITE CONFIG REGISTER LATCH IT FOR ERASURE
STAB
CONFIG,X
BSR
ERASE
********
* ERASE CYCLE IS COMPLETE
*
******************************************************************
* NON-SECURITY AND SECURITY MODES MEET HERE
*
NOSEC
EQU
*
********
* SET UP DELAY FOR FASTEST BAUD RATE
LDD
#DELAYF
STD
TOC1,X
********
* SEND BREAK TO SIGNAL START OF DOWNLOAD
BSET
SCCR2,X $01
EB422
MOTOROLA
43
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Freescale Semiconductor, Inc...
Engineering Bulletin
0204
0205
0206
0207
0208
0209
0210
0211
0212
0213
0214
0215
0216
0217
0218
0219
0220
0221
0222
0223
0224
0225
0226
0227
0228
0229
0230
0231
0232
0233
0234
0235
0236
0237
0238
0239
0240
0241
0242
0243
0244
0245
0246
0247
0248
0249
0250
0251
0252
0253
0254
0255
0256
0257
0258
0259
0260
0261
0262
0263
0264
0265
0266
0267
0268
0269
0270
0271
0272
bf7a 1e 08 01 fc
bf7e 1d 2d 01
bf81 1f 2e 20 fc
bf85 a6 2f
bf87 26 03
bf89 7e b6 00
bf8c
bf8c 81 ff
bf8e 27 08
bf90 1c 2b 33
bf93 cc 0d b0
bf96 ed 16
bf98
bf98 18 ce 00 00
bf9c ec 16
bf9e
bfa2
bfa3
bfa4
bfa5
bfa7
1e 2e 20 07
8f
09
8f
26 f7
20 0f
bfa9
bfa9
bfab
bfae
bfb0
bfb2
bfb6
a6
18
a7
18
18
26
2f
a7 00
2f
08
8c 08 00
e4
bfb8
bfb8 7e 00 00
bfbb
bfbb 41
bfbc 00 00
* CLEAR BREAK AS SOON AS START BIT IS DETECTED
BRSET
PORTD,X $01 *
BCLR
SCCR2,X $01
CLEAR BREAK
* WAIT FOR FIRST CHARACTER (USERS SEND $FF)
BRCLR
SCSR,X $20 *
WAIT FOR RDRF
LDAA
SCDAT,X
READ DATA
* IF DATA = $00 (BREAK OR $00), THEN JUMP TO EEPROM
BNE
NOTZERO
JMP
EEPSTR
NOTZERO
EQU
*
* IF DATA = $FF, THEN /16 IS CORRECT BAUD
CMPA
#$FF
BEQ
BAUDOK
* ELSE CHANGE TO /104 (/13 & /8) 1200 @ 2MHZ
BSET
BAUD,X $33
* SET UP DELAY FOR SLOWER BAUD RATE
LDD
#DELAYS
STD
TOC1,X
*
BAUDOK
EQU
*
LDY
#RAMSTR
PNTR TO START OF RAM
*
* TIME EACH BYTE
WAIT
LDD
TOC1,X
PUT DELAY TIME IN ACCD
*
WTLOOP
BRSET
SCSR,X $20 NEWONE
XGDX
DELAY INTO X
DEX
DECREMENT DELAY
XGDX
RETURN DELAY TO ACCD
BNE
WTLOOP
BRA
STAR
* DID NOT TIME OUT
NEWONE
EQU
*
* READ IN BYTE AND PUT INTO RAM
LDAA
SCDAT,X
STAA
$00,Y
STAA
SCDAT,X
HANDSHAKE
INY
CPY
#RAMEND+1
BNE
WAIT
******************************************************************
* START USER'S PROGRAM
*
STAR
EQU
*
JMP
RAMSTR
******************************************************************
* FILL UNUSED BYTES WITH ZERO
*
BSZ
$BFBB-*
*
******************************************************************
* REVISION LEVEL IN ASCII
*
(ORG
$BFBB)
FCC
"A"
******************************************************************
* MASK I.D. ($0000 FOR EPROM PARTS)
*
(ORG
$BFBC)
FDB
$0000
************************************************
* 711E32 I.D. - can be used to determine MCU type
* Bit 15 is a 0 if the part is ROM (or ROMless,
* 1 -> EPROM)
* Bit 14 is a 0 if unsecured
* Bits 13 - Bit 9 are lower 5 bits of 1st ASCII letter
* Bits 8 - Bit 6 are $7 => last six bits are number
* Bits 5 - Bit 0 are last digit of part number
* (note: $45 = E in ASCII)
*
*
15 14 13
9 8 6 5
0
EB422
44
MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Freescale Semiconductor, Inc...
Engineering Bulletin
Listing 12. MC68HC711E32 Secured Bootloader ROM Listing
0273
0274
0275
0276
0277
0278
0279
0280
0281
0282
0283
0284
0285
0286
0287
0288
0289
0290
0291
0292
0293
0294
0295
0296
0297
0298
0299
0300
0301
0302
0303
0304
0305
0306
0307
0308
0309
0310
0311
0312
0313
0314
0315
0316
0317
0318
0319
0320
0321
0322
0323
0324
0325
0326
0327
0328
0329
0330
0331
0332
0333
0334
0335
0336
0337
0338
0339
0340
0341
bfbe cb e0
bfc0
bfc2
bfc4
bfc6
bfc8
bfca
bfcc
bfce
bfd0
bfd2
bfd4
bfd6
bfd8
bfda
bfdc
bfde
bfe0
bfe2
bfe4
bfe6
bfe8
bfea
bfec
bfee
bff0
bff2
bff4
bff6
bff8
bffa
bffc
bffe
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
bf
be40
00c4
03ff
1000
00c4
00f1
00f4
00f7
00fa
007e
00
00
00
00
00
00
00
00
00
00
00
c4
c7
ca
cd
d0
d3
d6
d9
dc
df
e2
e5
e8
eb
ee
f1
f4
f7
fa
fd
00
* i.e. 1 1 00101 111 100000 (CBE0)
*
EP SEC 'E' nul
32
*
*
(ORG$BFBE)
FDB
%1100101111100000
******************************************************************
* VECTORS
($BDC0)
*
FDB
$0000
reserved
FDB
$0000
reserved
FDB
$0000
reserved
FDB
$0000
reserved
FDB
$0000
reserved
FDB
$0000
reserved
FDB
$0000
reserved
FDB
$0000
reserved
FDB
$0000
reserved
FDB
$0000
reserved
FDB
$0000
reserved
FDB
$100-60
SCI
FDB
$100-57
SPI
FDB
$100-54
PULSE ACCUM INPUT EDGE
FDB
$100-51
PULSE ACCUM OVERFLOW
FDB
$100-48
TIMER OVERFLOW
FDB
$100-45
TIMER OUTPUT COMPARE 5
FDB
$100-42
TIMER OUTPUT COMPARE 4
FDB
$100-39
TIMER OUTPUT COMPARE 3
FDB
$100-36
TIMER OUTPUT COMPARE 2
FDB
$100-33
TIMER OUTPUT COMPARE 1
FDB
$100-30
TIMER INPUT CAPTURE 3
FDB
$100-27
TIMER INPUT CAPTURE 2
FDB
$100-24
TIMER INPUT CAPTURE 1
FDB
$100-21
REAL TIME INT
FDB
$100-18
IRQ
FDB
$100-15
XIRQ
FDB
$100-12
SWI
FDB
$100-9
ILLEGAL OP-CODE
FDB
$100-6
COP FAIL
FDB
$100-3
CLOCK MONITOR
FDB
BEGIN
RESET
*********************** TBRE32.ASC 30/6/93 ***********************
* Motorola Copyright 1988,1990,1992,1993
* MCU resident, Interrupt driven Communication routines for 68HC11
* monitor.Provides low level memory & stack read/write operations
*
*
This talker DOES NOT use XIRQ
*
----------------------------*
* N.B. TBRE32 is designed to work with the 68HC11E32 or other
* compatible MCU types. This version of the TALKER is designed to
* execute from MC68HC711E32 Boot ROM.
* To initiate communication with TBRE32, the standard bootloader
* must be used to initialise the redirected vector table and the
* cause a jump to USERSTART
*
* CONSTANTS
TALKBASE
equ
$BE40
BOOTVECT
equ
$00C4
Start of boot vectors
STACK
equ
$03FF
User may alter this
REGBASE
equ
$1000
*
JSCI
equ
$00C4
JXIRQ
equ
$00F1
JSWI
equ
$00F4
JILLOP
equ
$00F7
JCOP
equ
$00FA
JMPEXT
equ
$7E
Mnemonic for jump ext
*
*
*
*
*
*
*
*
*
*
*
*
*
EB422
MOTOROLA
45
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Freescale Semiconductor, Inc...
Engineering Bulletin
0342
0343
0344
0345
0346
0347
0348
0349
0350
0351
0352
0353
0354
0355
0356
0357
0358
0359
0360
0361
0362
0363
0364
0365
0366
0367
0368
0369
0370
0371
0372
0373
0374
0375
0376
0377
0378
0379
0380
0381
0382
0383
0384
0385
0386
0387
0388
0389
0390
0391
0392
0393
0394
0395
0396
0397
0398
0399
0400
0401
0402
0403
0404
0405
0406
0407
0408
0409
0410
004a
004a
BRKCODE
BRKACK
*
* REGISTERS
SCDR
*
RDRF
TDRE
OR
FE
*
* PROGRAM
002f
0020
0080
0008
0002
be40
be40
be40
be42
be44
be47
be49
be49
be4c
be4f
be51
be54
be56
be58
be5a
*
TLKRSTART
86
97
ce
df
7e
c4
be 5e
c5
8e
ce
6f
cc
a7
e7
86
06
03 ff
10 00
2c
30 2c
2b
2d
40
USERSTART
be5b 7e be 5b
be5e
be5e b6 10 2e
be61 84 20
be63 27 f9
be65
be65
be68
be69
be6b
be6d
be6f
be70
be72
be73
be75
be76
be78
b6
43
8d
2a
8d
8f
8d
17
8d
8f
81
26
10 2f
be7a
be7a
be7c
be7e
be7f
be81
be82
be83
be84
be86
a6
8d
17
8d
16
08
5a
26
3b
00
2d
40
4b
2d
2a
27
fe
0d
1b
f4
be87
be87 81 be
be89 26 10
be8b 17
be8c
be8c 8d 0e
equ
equ
$4A
$4A
equ
$2F
equ
equ
equ
equ
$20
$80
$08
$02
org
TALKBASE
EQU
LDAA
STAA
LDX
STX
EQU
LDS
LDX
CLR
LDD
STAA
STAB
LDAA
TAP
*
#JMPEXT
JSCI
#SCISRV
JSCI+1
*
#STACK
#REGBASE
SCCR1,X
#$302C
BAUD,X
SCCR2,X
#$40
Break point code
Break point ack
Initialise SCI int
Init SCI to 9600 baud,
no parity, no int
& enable SCI tx & rx.
Enable STOP, and I bit
int, disable XIRQ.
*
Now hang around for
IDLE
JMP
IDLE
SCI int from host.
* A RESET from host changes above jump destination to
* start of user code.
SCISRV
EQU
*
On detecting int
LDAA
SCSR+REGBASE
assume rx caused it.
ANDA
#RDRF
BEQ
SCISRV
otherwise loop here
*
RXSRV
EQU
*
Process received data.
LDAA
SCDR+REGBASE
Read cmd byte, & tx it
COMA
inverted
BSR
OUTSCI
as ack to host.
BPL
INH1
Bit 7 set? => inherent
BSR
INSCI
else B = byte count
XGDX
Save cmd and byte cnt.
BSR
INSCI
Read high address byte
TBA
into ACCA
BSR
INSCI
then B = low addr byte
XGDX
A=cmd; B=cnt; X=addr
CMPA
#$FE
BNE
RXSRV1
If cmd is mem read ...
*
TREADMEM
EQU
*
REPEAT
LDAA
,X
read required address
BSR
OUTSCI
send it to host
TBA
(save byte count)
BSR
INSCI
and wait for acknowledge
TAB
(restore byte count)
INX
Increment address
DECB
Decrement byte count
BNE
TREADMEM
UNTIL all done
RTI
& return
*
RXSRV1
EQU *
CMPA
#$BE
BNE
RXSRVEX
If cmd is mem write...
*
TBA
move byte count to A
TWRITMEM
EQU
*
REPEAT
BSR
INSCI
Read next byte into B
EB422
46
MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Freescale Semiconductor, Inc...
Engineering Bulletin
Listing 12. MC68HC711E32 Secured Bootloader ROM Listing
0411
0412
0413
0414
0415
0416
0417
0418
0419
0420
0421
0422
0423
0424
0425
0426
0427
0428
0429
0430
0431
0432
0433
0434
0435
0436
0437
0438
0439
0440
0441
0442
0443
0444
0445
0446
0447
0448
0449
0450
0451
0452
0453
0454
0455
0456
0457
0458
0459
0460
0461
0462
0463
0464
0465
0466
0467
0468
0469
0470
0471
0472
0473
0474
0475
0476
0477
0478
0479
be8e
be90
be92
be94
be97
be98
be99
be9b
be9b
e7
8d
e6
f7
08
4a
26
00
18
00
10 2f
f1
RXSRVEX
NULLSRV
*
INSCI
3b
be9c
be9c
be9f
bea1
bea3
bea5
bea7
beaa
f6
c5
26
c4
27
f6
39
10 2e
00
9d
20
f5
10 2f
beab
beab
bead
beb0
beb2
beb4
beb7
18
b6
2a
18
b7
39
8f
10 2e
fb
8f
10 2f
EPRG
*
OUTSCI
beb8
beb8 81 7e
beba 26 0c
bebc
bebd
bebe
bec0
bec1
bec3
bec4
bec6
30
8f
8d
17
8d
30
c6
20
OUTSCI1
*
INH1
*
INH1A
eb
e8
09
b2
bec8
bec8 81 3e
beca 26 12
*
INH2
STAB
BSR
LDAB
STAB
INX
DECA
BNE
EQU
RTI
,X
EPRG
,X
SCDR+REGBASE
EQU
LDAB
BITB
BNE
ANDB
BEQ
LDAB
RTS
*
SCSR+REGBASE
#(FE+OR)
TLKRSTART
#RDRF
INSCI
SCDR+REGBASE
EQU
XGDY
LDAA
BPL
XGDY
STAA
RTS
*
EQU
CMPA
BNE
TSX
XGDX
BSR
TBA
BSR
TSX
LDAB
BRA
TWRITMEM
*
and store at req addr
Read stored byte and
echo it back to host,
Decrement byte count
UNTIL all done
and return
Wait for RDRF=1
If break detected then
restart talker.
read data received
& return B = data
Only Y modified.
Enter with A = tx data
SCSR+REGBASE
OUTSCI1
MS bit is TDRE flag
SCDR+REGBASE
Important: Updates CCR
*
#$7E
INH2
If cmd is read regs ..
OUTSCI
OUTSCI
#9
TREADMEM
Move SP to X
then to ACCD
send SP high byte 1st
then low byte
Restore X (=SP)
Tx 9 bytes on stack
i.e.CCR,ACCB,ACCA,IXH
,IXL,IYH,IYL,PCH,PCL
EQU
CMPA
BNE
*
#$3E
SWISRV1
If cmd is write regs..
BSR
TBA
BSR
XGDX
TXS
LDAA
BRA
INSCI
Get SP High byte first
EQU
LDAA
BSR
CLI
BRA
*
#BRKCODE
OUTSCI
Breakpoints by SWI
Force host to proc BR
by sending it BREAK
SWIIDLE
then wait for response
EQU
CMPA
BNE
TSX
LDAB
ABX
TXS
LDD
BSR
TBA
BSR
*
#BRKACK
RXSRVEX
If host acknowledges
*
becc
bece
becf
bed1
bed2
bed3
bed5
bed7
bed7
bed9
bedb
bedc
bede
bede
bee0
bee2
bee3
bee5
bee6
bee7
bee9
beeb
beec
8d
17
8d
8f
35
86
20
ce
cb
09
b5
*
SWISRV
86 4a
8d d0
0e
20 fd
SWIIDLE
*
SWISRV1
81
26
30
c6
3a
35
ec
8d
17
8d
4a
b9
09
07
c0
bd
INSCI
#9
TWRITMEM
Move to X reg
and copy to SP
Then 9 bytes to stack
move SP to SWI stack &
#9
7,X
OUTSCI
Send user code
breakpoint return
address to host
(high byte first)
OUTSCI
(low byte next)
EB422
MOTOROLA
47
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Engineering Bulletin
0480
0481
0482
0483
0484
0485
0486
0487
beee cc be db
bef1 ed 07
bef3 20 c7
bef5 00 00 00 00 00 00
00 00 00 00 00
Freescale Semiconductor, Inc...
0488
0489
0490
0491
0492
0493
LDD
STD
BRA
#SWIIDLE
7,X
INH1A
force idle loop on
return from breakpoint
but first return all
*
MCU registers to host
******************************************************************
* FILL UNUSED BYTES WITH ZERO
*
BSZ
$BF00-*
*
******************************************************************
END
Listing 13. MC68HC11E32 Secured Bootloader ROM Listing
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0008
0009
0016
0028
002b
002c
002d
002e
002f
0035
003b
003e
003f
b600
b7ff
0000
07ff
0db0
021b
******************************************************************
* FIRMWARE FOR SECURED 68HC11E32 - 24 SEPT 1993
*
******************************************************************
* SECURED EPROM VERSION
*
* Part I.D. at $BFBE is $4BE0. {E32}
******************************************************************
* REVISION A 24 SEPT 1993
* BASED ON SECURE 711E32 BOOTLOADER 16 JULY 93
* REMOVED CHECK ON EPROM
*
******************************************************************
* THIS NEW VERSION ALLOWS VARIABLE LENGTH DOWNLOAD
* BY QUITTING RECEPTION OF CHARACTERS WHEN AN IDLE
* OF AT LEAST FOUR WORD TIMES OCCURS
*
* EQUATES FOR USE WITH INDEX OFFSET = $1000
*
*
PORTD
EQU
$08
DDRD
EQU
$09
TOC1
EQU
$16
[STORAGE (POOR STYLE)]
SPCR
EQU
$28
(FOR DWOM BIT)
BAUD
EQU
$2B
SCCR1
EQU
$2C
SCCR2
EQU
$2D
SCSR
EQU
$2E
SCDAT
EQU
$2F
BPROT
EQU
$35
PPROG
EQU
$3B
TEST1
EQU
$3E
CONFIG
EQU
$3F
*
* MORE EQUATES
*
EEPSTR
EQU
$B600
START OF EEPROM
EEPEND
EQU
$B7FF
END OF EEPROM
*
RAMSTR
EQU
$0000
RAMEND
EQU
$07FF
*
DELAYS
EQU
3504
DELAY AT SLOW BAUD
DELAYF
EQU
539
DELAY AT FAST BAUD
*
EB422
48
MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Freescale Semiconductor, Inc...
Engineering Bulletin
Listing 13. MC68HC11E32 Secured Bootloader ROM Listing
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
bf00
bf00
bf00 8e 07 ff
bf03 ce 10 00
bf06 1c 28 20
bf09 cc a2 0c
bf0c a7 2b
bf0e e7 2d
bf10 1e 3f 08 45
bf14
bf14 a6 2e
bf16 86 ff
bf18 a7 2f
bf1a 6f 35
bf1c
bf1d
bf1f
bf22
54
e7 3b
f7 b6 00
8d 21
bf24 1f 3f 01 11
bf28 18 ce b6 00
bf2c
bf2c 18 a1 00
bf2f 26 e3
bf31 18 08
bf33 18 8c b8 00
********
* THIS BOOTSTRAP PROGRAM ALLOWS THE USER TO
* DOWNLOAD A PROGRAM OF 0 - 2048 BYTES.
* THE PROGRAM MUST START AT $0000.
* EACH BYTE OF THE PROGRAM IS RECEIVED BY THE SCI.
* THE FIRST BYTE ESTABLISHES BAUD RATE.
* THEN THE PROGRAM IS DOWNLOADED STARTING WITH
* THE $0000 BYTE AND WORKING UP TOWARD THE END OF RAM
* A DELAY OF FOUR WORD TIMES (AT EITHER BAUD RATE)
* CAUSES THE RECEPTION OF CHARACTERS TO STOP AND
* A JUMP TO $0000.
*
* THE TRANSMITTER WILL BE USED FOR THE PURPOSE
* OF COMMUNICATION TO THE OUTSIDE WORLD.
*
******************************************************************
ORG
$BF00
*
BEGIN
EQU
*
* INIT STACK
LDS
#RAMEND
* INIT X REG FOR INDEXED ACCESS TO REGISTERS
LDX
#$1000
********
* PUT PORT D IN WIRE OR MODE
BSET
SPCR,X $20
* INIT SCI AND RESTART BAUD DIVIDER CHAIN
LDD
#$A20C
DIV BY 16
STAA
BAUD,X
* RECEIVER & TRANSMITTER ENABLED
STAB
SCCR2,X
********
* TEST THE SECURITY BIT
BRSET CONFIG,X $08 NOSEC
******************************************************************
* WE ARE IN SECURITY MODE
*
* OUTPUT $FF ON TRANSMITTER
AGAIN
EQU
*
LDAA
SCSR,X
LDAA
#$FF
STAA
SCDAT,X
* ACCA NOW IS SET FOR $FF
*
* ERASE EEPROM:
* TURN OFF BLOCK PROTECT
CLR
BPROT,X
* SET ERASE AND EELAT BITS BEFORE USING "ERASE"
LSRB
CHANGE $0C TO $06
STAB
PPROG,X
STAB
EEPSTR
WRITE EEPROM LOCATION
BSR
ERASE
* ACCB IS NOW SET FOR $06
*
********
* ERASE CYCLE IS COMPLETE
*
* IF THE EEPROM IS NOT ENABLED,
* WE CAN'T CHECK THAT THE EEPROM IS ERASED
BRCLR CONFIG,X $01 NOEE
* EEPROM IS ON,
* NOW CHECK THAT THE EEPROM IS ERASED
LDY
#EEPSTR
LOOP
EQU
*
CMPA
0,Y
(A = $FF)
* ANY UNERASED BYTE SENDS US BACK TO ERASE AGAIN
BNE
AGAIN
INY
CPY
#EEPEND+1
EB422
MOTOROLA
49
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Freescale Semiconductor, Inc...
Engineering Bulletin
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131
0132
0133
0134
0135
0136
0137
0138
0139
0140
0141
0142
0143
0144
0145
0146
0147
0148
0149
0150
0151
0152
0153
0154
0155
0156
0157
0158
0159
0160
0161
0162
0163
0164
0165
0166
0167
0168
0169
0170
0171
0172
0173
0174
0175
0176
0177
0178
0179
0180
0181
0182
0183
bf37 26 f3
bf39
bf39
bf39
bf3a
bf3d
bf3d
bf3f
bf40
bf42
bf43
3c
ce 07 fd
a7 00
09
26 fb
38
20 0e
bf45
bf45 1c 3b 01
bf48 18 ce 0b b8
bf4c 18 09
bf4e 26 fc
bf50 6f 3b
bf52 39
bf53
bf53 e7 3b
bf55 e7 3f
bf57 8d ec
bf59
bf59 cc 02 1b
bf5c ed 16
bf5e 1c 2d 01
bf61 1e 08 01 fc
bf65 1d 2d 01
bf68 1f 2e 20 fc
bf6c a6 2f
BNE
LOOP
NOEE
EQU
*
******************************************************************
* WRITE OVER ENTIRE RAM, EXCEPT LAST TWO BYTES
* WHICH ARE USED BY THE STACK & $0000 WHICH IS
* LEFT INTACT
*
ERAM
EQU
*
PSHX
LDX
#RAMEND-2
LOP1
EQU
*
STAA
$00,X
DEX
BNE
LOP1
PULX
BRA
ECONFG
******************************************************************
* BOOTLOADER SUBROUTINES
*
* EEPROM ERASE SUBROUTINE
*
* ASSUMES CALLING ROUTINE HAS ALREADY SET ERASE
* AND EELAT BITS, AS WELL AS ACCESSED WHATEVER
* IS TO BE ERASED
*
* ENTRY X=$1000
* EXIT X=$1000, Y=$0000
*
ERASE
EQU
*
* SET EEPGM BIT
BSET
PPROG,X $01
* 10 MILLISEC DELAY @ 2.1 MHZ
LDY
#3000
BK1
DEY
BNE
BK1
* TURN OFF ERASE AND EELAT BITS
CLR
PPROG,X
RTS
******************************************************************
* NOW ERASE CONFIG REGISTER
*
ECONFG
EQU
*
* SET ERASE AND EELAT BITS
STAB
PPROG,X
(B STILL = $06)
* WRITE CONFIG REGISTER LATCH IT FOR ERASURE
STAB
CONFIG,X
BSR
ERASE
********
* ERASE CYCLE IS COMPLETE
*
******************************************************************
* NON-SECURITY AND SECURITY MODES MEET HERE
*
NOSEC
EQU
*
********
* SET UP DELAY FOR FASTEST BAUD RATE
LDD
#DELAYF
STD
TOC1,X
********
* SEND BREAK TO SIGNAL START OF DOWNLOAD
BSET
SCCR2,X $01
* CLEAR BREAK AS SOON AS START BIT IS DETECTED
BRSET PORTD,X $01 *
BCLR
SCCR2,X $01
CLEAR BREAK
* WAIT FOR FIRST CHARACTER (USERS SEND $FF)
BRCLR SCSR,X $20 *
WAIT FOR RDRF
LDAA
SCDAT,X
READ DATA
EB422
50
MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Freescale Semiconductor, Inc...
Engineering Bulletin
Listing 13. MC68HC11E32 Secured Bootloader ROM Listing
0184
0185
0186
0187
0188
0189
0190
0191
0192
0193
0194
0195
0196
0197
0198
0199
0200
0201
0202
0203
0204
0205
0206
0207
0208
0209
0210
0211
0212
0213
0214
0215
0216
0217
0218
0219
0220
0221
0222
0223
0224
0225
0226
* IF DATA = $00 (BREAK OR $00), THEN JUMP TO EEPROM
BNE
NOTZERO
JMP
EEPSTR
NOTZERO EQU
*
* IF DATA = $FF, THEN /16 IS CORRECT BAUD
CMPA
#$FF
BEQ
BAUDOK
* ELSE CHANGE TO /104 (/13 & /8) 1200 @ 2MHZ
BSET
BAUD,X $33
* SET UP DELAY FOR SLOWER BAUD RATE
LDD
#DELAYS
STD
TOC1,X
*
BAUDOK
EQU
*
LDY
#RAMSTR
PNTR TO START OF RAM
*
* TIME EACH BYTE
WAIT
LDD
TOC1,X
PUT DELAY TIME IN ACCD
*
WTLOOP
BRSET SCSR,X $20 NEWONE
XGDX
DELAY INTO X
DEX
DECREMENT DELAY
XGDX
RETURN DELAY TO ACCD
BNE
WTLOOP
BRA
STAR
* DID NOT TIME OUT
NEWONE
EQU
*
* READ IN BYTE AND PUT INTO RAM
LDAA
SCDAT,X
STAA
$00,Y
STAA
SCDAT,X
HANDSHAKE
INY
CPY
#RAMEND+1
BNE
WAIT
******************************************************************
* START USER'S PROGRAM
*
STAR
EQU
*
JMP
RAMSTR
******************************************************************
* FILL UNUSED BYTES WITH ZERO
*
00 00
BSZ
$BFBB-*
bf6e 26 03
bf70 7e b6 00
bf73
bf73 81 ff
bf75 27 08
bf77 1c 2b 33
bf7a cc 0d b0
bf7d ed 16
bf7f
bf7f 18 ce 00 00
bf83 ec 16
bf85
bf89
bf8a
bf8b
bf8c
bf8e
1e 2e 20 07
8f
09
8f
26 f7
20 0f
bf90
bf90
bf92
bf95
bf97
bf99
bf9d
a6
18
a7
18
18
26
2f
a7 00
2f
08
8c 08 00
e4
bf9f
bf9f 7e 00 00
bfa2 00 00 00 00
00 00 00 00 00 00
00 00 00 00 00 00
00 00 00 00 00 00
00
0227
0228
0229
0230
0231 bfbb 41
0232
0233
0234
0235 bfbc 00 00
0236
0237
0238
0239
0240
0241
0242
0243
0244
0245
0246
0247
0248
*
******************************************************************
* REVISION LEVEL IN ASCII
*
(ORG
$BFB)
FCC
"A"
******************************************************************
* MASK I.D. ($0000 FOR EPROM PARTS)
*
(ORG
$BFB)
FDB
$0000
******************************************************************
* 11E32 I.D. - can be used to determine MCU type
* Bit 15 is a 0 if the part is ROM (or ROMless,
* 1 -> EPROM)
* Bit 14 is a 0 if unsecured
* Bits 13 - Bit 9 are lower 5 bits of 1st ASCII letter
* Bits 8 - Bit 6 are $7 => last six bits are number
* Bits 5 - Bit 0 are last digit of part number
* (note: $45 = E in ASCII)
*
*
15 14 13
9 8 6 5
0
* i.e. 0 1 00101 111 100000
(4BE0)
*
ROM SEC 'E' nul
32
EB422
MOTOROLA
51
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Freescale Semiconductor, Inc...
Engineering Bulletin
0249
0250
0251
0252
0253
0254
0255
0256
0257
0258
0259
0260
0261
0262
0263
0264
0265
0266
0267
0268
0269
0270
0271
0272
0273
0274
0275
0276
0277
0278
0279
0280
0281
0282
0283
0284
0285
0286
0287
0288
0289
0290
0291
0292
0293
0294
0295
0296
0297
0298
0299
0300
0301
0302
0303
0304
0305
0306
0307
0308
0309
0310
0311
0312
0313
0314
0315
0316
0317
*
*
bfbe 4b e0
bfc0
bfc2
bfc4
bfc6
bfc8
bfca
bfcc
bfce
bfd0
bfd2
bfd4
bfd6
bfd8
bfda
bfdc
bfde
bfe0
bfe2
bfe4
bfe6
bfe8
bfea
bfec
bfee
bff0
bff2
bff4
bff6
bff8
bffa
bffc
bffe
be40
00c4
03ff
1000
00c4
00f1
00f4
00f7
00fa
007e
004a
004a
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
00
bf
00
00
00
00
00
00
00
00
00
00
00
c4
c7
ca
cd
d0
d3
d6
d9
dc
df
e2
e5
e8
eb
ee
f1
f4
f7
fa
fd
00
(ORG
$BFB)
FDB
%0100101111100000
******************************************************************
* VECTORS ($BDC0)
*
FDB
$0000
reserved
FDB
$0000
reserved
FDB
$0000
reserved
FDB
$0000
reserved
FDB
$0000
reserved
FDB
$0000
reserved
FDB
$0000
reserved
FDB
$0000
reserved
FDB
$0000
reserved
FDB
$0000
reserved
FDB
$0000
reserved
FDB
$100-60
SCI
FDB
$100-57
SPI
FDB
$100-54
PULSE ACCUM INPUT EDGE
FDB
$100-51
PULSE ACCUM OVERFLOW
FDB
$100-48
TIMER OVERFLOW
FDB
$100-45
TIMER OUTPUT COMPARE 5
FDB
$100-42
TIMER OUTPUT COMPARE 4
FDB
$100-39
TIMER OUTPUT COMPARE 3
FDB
$100-36
TIMER OUTPUT COMPARE 2
FDB
$100-33
TIMER OUTPUT COMPARE 1
FDB
$100-30
TIMER INPUT CAPTURE 3
FDB
$100-27
TIMER INPUT CAPTURE 2
FDB
$100-24
TIMER INPUT CAPTURE 1
FDB
$100-21
REAL TIME INT
FDB
$100-18
IRQ
FDB
$100-15
XIRQ
FDB
$100-12
SWI
FDB
$100-9
ILLEGAL OP-CODE
FDB
$100-6
COP FAIL
FDB
$100-3
CLOCK MONITOR
FDB
BEGIN
RESET
*********************** TBRE32.ASC 30/6/93 ************************
* Motorola Copyright 1988,1990,1992,1993
* MCU resident,InterruptdrivenCommunicationroutines for 68HC11 mon* itor.Provides low level memory and stack read/write operations.
*
*
This talker DOES NOT use XIRQ
*
----------------------------*
* N.B.TBRE32 is designed to work with the 68HC11E32 or other
*
compatible MCU types.This version of the TALKER is designed to
*
execute from MC68HC11E32 Boot ROM.
*
To initiate communication with TBRE32,the standard bootloader
*
must be used to initialise the redirected vector table and then
*
cause a jump to USERSTART
*
* CONSTANTS
TALKBASE
equ
$BE40
BOOTVECT
equ
$00C4
Start of boot vectors
STACK
equ
$03FF
User may alter this
REGBASE
equ
$1000
*
JSCI
equ
$00C4
JXIRQ
equ
$00F1
JSWI
equ
$00F4
JILLOP
equ
$00F7
JCOP
equ
$00FA
JMPEXT
equ
$7E
Mnemonic for jump ext
BRKCODE
equ
$4A
Break point code
BRKACK
equ
$4A
Break point ack
*
*
*
*
*
*
*
*
*
*
*
*
*
EB422
52
MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Freescale Semiconductor, Inc...
Engineering Bulletin
Listing 13. MC68HC11E32 Secured Bootloader ROM Listing
0318
0319
0320
0321
0322
0323
0324
0325
0326
0327
0328
0329
0330
0331
0332
0333
0334
0335
0336
0337
0338
0339
0340
0341
0342
0343
0344
0345
0346
0347
0348
0349
0350
0351
0352
0353
0354
0355
0356
0357
0358
0359
0360
0361
0362
0363
0364
0365
0366
0367
0368
0369
0370
0371
0372
0373
0374
0375
0376
0377
0378
0379
0380
0381
0382
0383
0384
0385
0386
*
* REGISTERS
SCDR
*
RDRF
TDRE
OR
FE
*
* PROGRAM
002f
0020
0080
0008
0002
be40
be40
be40
be42
be44
be47
be49
be49
be4c
be4f
be51
be54
be56
be58
be5a
86
97
ce
df
7e
c4
be 5e
c5
8e
ce
6f
cc
a7
e7
86
06
03 ff
10 00
2c
30 2c
2b
2d
40
be5b 7e be 5b
be5e
be5e b6 10 2e
be61 84 20
be63 27 f9
be65
be65
be68
be69
be6b
be6d
be6f
be70
be72
be73
be75
be76
be78
b6
43
8d
2a
8d
8f
8d
17
8d
8f
81
26
10 2f
be7a
be7a
be7c
be7e
be7f
be81
be82
be83
be84
be86
a6
8d
17
8d
16
08
5a
26
3b
00
2d
40
4b
2d
2a
27
fe
0d
1b
f4
be87
be87 81 be
be89 26 10
be8b
be8c
be8c
be8e
be90
17
8d 0e
e7 00
8d 18
equ
$2F
equ
equ
equ
equ
$20
$80
$08
$02
org
TALKBASE
*
TLKRSTART EQU *
Initialise SCI int
LDAA
#JMPEXT
STAA
JSCI
LDX
#SCISRV
STX
JSCI+1
USERSTART
EQU*
LDS
#STACK
LDX
#REGBASE
CLR
SCCR1,X
LDD
#$302C
Init SCI to 9600 baud,
STAA
BAUD,X
no parity, no int
STAB
SCCR2,X
& enable SCI tx & rx.
LDAA
#$40
Enable STOP, and I bit
TAP
int, disable XIRQ.
*
Now hang around for
IDLE
JMP
IDLE
SCI int from host.
* A RESET from host changes above jump destination to
* start of user code.
SCISRV
EQU
*
On detecting int
LDAA
SCSR+REGBASE
assume rx caused it.
ANDA
#RDRF
BEQ
SCISRV
otherwise loop here
*
RXSRV
EQU
*
Process received data.
LDAA
SCDR+REGBASE
Read cmd byte, & tx it
COMA
inverted
BSR
OUTSCI
as ack to host.
BPL
INH1
Bit 7 set? => inherent
BSR
INSCI
else B = byte count
XGDX
Save cmd and byte cnt.
BSR
INSCI
Read high address byte
TBA
into ACCA
BSR
INSCI
then B = low addr byte
XGDX
A=cmd; B=cnt; X=addr
CMPA
#$FE
BNE
RXSRV1
If cmd is mem read ...
*
TREADMEM
EQU
*
REPEAT
LDAA
,X
read required address
BSR
OUTSCI
send it to host
TBA
(save byte count)
BSR
INSCI
and wait for acknowledge
TAB
(restore byte count)
INX
Increment address
DECB
Decrement byte count
BNE
TREADMEM
UNTIL all done
RTI
& return
*
RXSRV1
EQU
*
CMPA
#$BE
BNE
RXSRVEX
If cmd is mem write...
*
TBA
move byte count to A
TWRITMEM
EQU
*
REPEAT
BSR
INSCI
Read next byte into B
STAB
,X
and store at req addr
BSR
EPRG
EB422
MOTOROLA
53
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Freescale Semiconductor, Inc...
Engineering Bulletin
0387
0388
0389
0390
0391
0392
0393
0394
0395
0396
0397
0398
0399
0400
0401
0402
0403
0404
0405
0406
0407
0408
0409
0410
0411
0412
0413
0414
0415
0416
0417
0418
0419
0420
0421
0422
0423
0424
0425
0426
0427
0428
0429
0430
0431
0432
0433
0434
0435
0436
0437
0438
0439
0440
0441
0442
be92
be94
be97
be98
be99
be9b
be9b
0443
0444
0445
0446
0447
0448
0449
0450
0451
0452
0453
0454
bede
bede
bee0
bee2
bee3
bee5
bee6
bee7
bee9
beeb
beec
beee
e6 00
f7 10 2f
08
4a
26 f1
RXSRVEX
NULLSRV
*
INSCI
3b
be9c
be9c
be9f
bea1
bea3
bea5
bea7
beaa
f6
c5
26
c4
27
f6
39
10 2e
00
9d
20
f5
10 2f
beab
beab
bead
beb0
beb2
beb4
beb7
18
b6
2a
18
b7
39
8f
10 2e
fb
8f
10 2f
EPRG
*
OUTSCI
beb8
beb8 81 7e
beba 26 0c
bebc
bebd
bebe
bec0
bec1
bec3
bec4
bec6
30
8f
8d
17
8d
30
c6
20
OUTSCI1
*
INH1
*
INH1A
eb
e8
09
b2
bec8
bec8 81 3e
beca 26 12
*
INH2
LDAB
STAB
INX
DECA
BNE
EQU
RTI
,X
SCDR+REGBASE
EQU
LDAB
BITB
BNE
ANDB
BEQ
LDAB
RTS
*
SCSR+REGBASE
#(FE+OR)
TLKRSTART
#RDRF
INSCI
SCDR+REGBASE
EQU
XGDY
LDAA
BPL
XGDY
STAA
RTS
*
EQU
CMPA
BNE
TSX
XGDX
BSR
TBA
BSR
TSX
LDAB
BRA
TWRITMEM
*
Read stored byte and
echo it back to host,
Decrement byte count
UNTIL all done
and return
Wait for RDRF=1
If break detected then
restart talker.
read data received
& return B = data
Only Y modified.
Enter with A = tx data
SCSR+REGBASE
OUTSCI1
MS bit is TDRE flag
SCDR+REGBASE
Important: Updates CCR
*
#$7E
INH2
If cmd is read regs ..
OUTSCI
OUTSCI
#9
TREADMEM
Move SP to X
then to ACCD
send SP high byte 1st
then low byte
Restore X (=SP)
Tx 9 bytes on stack
i.e. CCR,ACCB,ACCA,IXH
,IXL,IYH,IYL,PCH,PCL
EQU
CMPA
BNE
*
#$3E
SWISRV1
If cmd is write regs..
BSR
TBA
BSR
XGDX
TXS
LDAA
BRA
INSCI
Get SP High byte first
EQU
LDAA
BSR
CLI
BRA
*
#BRKCODE
OUTSCI
Breakpoints by SWI
Force host to proc BR
by sending it BREAK
SWIIDLE
40
then wait for response
*
becc
bece
becf
bed1
bed2
bed3
bed5
bed7
bed7
bed9
bedb
bedc
8d
17
8d
8f
35
86
20
ce
cb
09
b5
*
SWISRV
86 4a
8d d0
0e
20 fd
SWIIDLE
*
SWISRV1
81
26
30
c6
3a
35
ec
8d
17
8d
cc
4a
b9
09
07
c0
bd
be db
EQU
CMPA
BNE
TSX
LDAB
ABX
TXS
LDD
BSR
TBA
BSR
LDD
INSCI
#9
TWRITMEM
*
#BRKACK
RXSRVEX
Move to X reg
and copy to SP
Then 9 bytes to stack
If host acknowledges
move SP to SWI stack &
#9
7,X
OUTSCI
Send user code
breakpoint return
address to host
(high byte first)
OUTSCI
#SWIIDLE
(low byte next)
force idle loop on
EB422
54
MOTOROLA
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
Engineering Bulletin
Listing 13. MC68HC11E32 Secured Bootloader ROM Listing
STD
BRA
7,X
INH1A
return from breakpoint
but first return all
*
MCU registers to host
*************************************************************
* FILL UNUSED BYTES WITH ZERO
*
BSZ
$BF00-*
*
*************************************************************
END
Freescale Semiconductor, Inc...
0455 bef1 ed 07
0456 bef3 20 c7
0457
0458
0459
0460
0461 bef5 00 00 00 00 00 00
00 00 00 00 00
0462
0463
0464
0465
0466
0467
EB422
MOTOROLA
55
For More Information On This Product,
Go to: www.freescale.com
Freescale Semiconductor, Inc.
N O N - D I S C L O S U R E
Freescale Semiconductor, Inc...
A G R E E M E N T
R E Q U I R E D
Engineering Bulletin
Motorola reserves the right to make changes without further notice to any products herein. Motorola makes no warranty, representation or guarantee regarding the suitability of its
products for any particular purpose, nor does Motorola assume any liability arising out of the application or use of any product or circuit, and specifically disclaims any and all liability,
including without limitation consequential or incidental damages. "Typical" parameters which may be provided in Motorola data sheets and/or specifications can and do vary in different
applications and actual performance may vary over time. All operating parameters, including "Typicals" must be validated for each customer application by customer's technical experts.
Motorola does not convey any license under its patent rights nor the rights of others. Motorola products are not designed, intended, or authorized for use as components in systems
intended for surgical implant into the body, or other applications intended to support or sustain life, or for any other application in which the failure of the Motorola product could create a
situation where personal injury or death may occur. Should Buyer purchase or use Motorola products for any such unintended or unauthorized application, Buyer shall indemnify and hold
Motorola and its officers, employees, subsidiaries, affiliates, and distributors harmless against all claims, costs, damages, and expenses, and reasonable attorney fees arising out of,
directly or indirectly, any claim of personal injury or death associated with such unintended or unauthorized use, even if such claim alleges that Motorola was negligent regarding the
design or manufacture of the part. Motorola and
are registered trademarks of Motorola, Inc. Motorola, Inc. is an Equal Opportunity/Affirmative Action Employer.
How to reach us:
USA/EUROPE/Locations Not Listed: Motorola Literature Distribution, P.O. Box 5405, Denver, Colorado 80217, 1-303-675-2140
or 1-800-441-2447. Customer Focus Center, 1-800-521-6274
JAPAN: Motorola Japan Ltd.; SPS, Technical Information Center, 3-20-1, Minami-Azabu, Minato-ku, Tokyo, 106-8573 Japan.
81-3-3440-8573
ASIA/PACIFIC: Motorola Semiconductors H.K. Ltd.; Silicon Harbour Centre, 2 Dai King Street, Tai Po Industrial Estate,
Tai Po, N.T., Hong Kong. 852-26668334
Mfax™, Motorola Fax Back System: [email protected]; http://sps.motorola.com/mfax/;
TOUCHTONE, 1-602-244-6609; US and Canada ONLY, 1-800-774-1848
HOME PAGE: http://motorola.com/sps/
Mfax is a trademark of Motorola, Inc.
© Motorola, Ltd., 1995, 2000
EB422/D
For More Information On This Product,
Go to: www.freescale.com