AN2295 Freescale Semiconductor / Motorola, AN2295 Datasheet - Page 38

no-image

AN2295

Manufacturer Part Number
AN2295
Description
Developers Serial Bootloader for M68HC08 and HCS08 MCUs
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
MCU Slave Software
FLASH Programming Routines
The main code is similar to the previous implementation with the calibration phase omitted. The FLASH
programming by the bootloader is shown in
Because the flow is straight-forward, no flowchart is provided. Basically the sequence of events is
executed according to FLASH erasing/programming specifications.
;*******************************************************************************************
CPY_PRG:
CPY_PRG_L1:
;*******************************************************************************************
ERASE_ALG:
ERASE_ALG_END:
;*******************************************************************************************
38
CPY_PRG — copies the selected routine into RAM
ERASE_ALG — whole FLASH erase routine
WR_ALG — whole WRITE erase routine
TSX
STHX
LDHX
TXS
RTS
LDA
STA
LDA
D_US
LDA
LDA
CLRA
LDHX
TXS
LDHX
PULA
STA
AIX
DBNZ
LDHX
STA
STA
D_MS
STA
D_US
STA
D_US
JMP
STACK
SOURCE
#PRG
X
#1
STAT,CPY_PRG_L1
STACK
#%00000010
FLCR
FLBPR
ADRS
X
#T10US
#%00001010
FLCR
#T1MS
#%00001000
FLCR
#T5US
FLCR
#T1US
SUCC
Developer’s Serial Bootloader for M68HC08 and HCS08 MCUs, Rev. 6
;
; copy stack for later re-call
; LOAD WRITE ALGORITHM TO RAM
; restore stack
; ERASE bit on
; dummy read FLBPR
; write anything
; to desired range
; wait 10us
; set HVEN, keep ERASE
; wait 1ms
; HVEN off
; wait 1us
; finish with ACK
; keep HVEN, ERASE off
; wait 5us
Figure
26. Three main subroutines are defined:
Freescale Semiconductor

Related parts for AN2295