Hi Jeff,
In case you don't find it anywhere else, you can paste and copy from
PDF. You loose formatting info. Still better than to hack..
Paul
------------------------
00000000 RegBase: equ $0000
;
opt lis
;
M offset: macro
M PCSave: set *
M org $:0
M endm
;
M switch: macro
M ifc '.text',':0'
M org PCSave
M endif
M endm
;
007A1200 OscClk: equ 8000000 ; oscillator clock frequency.
016E3600 fEclock: equ 24000000 ; final E-clock frequency (PLL).
007A1200 RefClock: equ 8000000 ; reference clock used by the PLL.
00000000 REFDVVal: equ (OscClk/RefClock)-1 ; value for the REFDV register.
00000002 SYNRVal: equ (fEclock/RefClock)-1 ; value for the SYNR register.
00000000 if OscClk>12800000
FCLKDIVVal: equ (OscClk/200000/8)+FDIV8 ; value for the FCLKDIV register.
else
00000028 FCLKDIVVal: equ (OscClk/200000) ; value for the FCLKDIV register.
endif
;
0000000D Baud115200: equ fEclock/16/115200 ; baud register value for
115,200 baud.
0000001A Baud57600: equ fEclock/16/57600 ; baud register value for
57,600 baud.
00000027 Baud38400: equ fEclock/16/38400 ; baud register value for
38,400 baud.
0000009C Baud9600: equ fEclock/16/9600 ; baud register value for 9,600 baud.
;
00008000 FlashStart: equ $8000 ; start address of the flash window.
00001000 BootBlkSize: equ 4096 ; Erase protected bootblock size.
00001000 RAMStart: equ $1000 ; default RAM base address.
0000FF80 StackTop: equ $ff80 ; stack location after RAM is moved.
00003000 RAMBoot: equ $3000 ; starting RAM address where the bootloader
; will be copied.
00000200 SectorSize: equ 512 ; size of a Flash Sector.
00004000 PPAGESize: equ 16384 ; size of the PPAGE window ($8000 - $BFFF).
;
000C0000 SRecLow: equ $c0000 ; lowest S-Record load address accepted
; by the bootloader.
000FF000 SRecHi: equ $ff000 ; highest S-Record load address + 1
; accepted by the bootloader.
;
Application Note
AN2153
40 MOTOROLA
00000030 S0RecType: equ '0'
00000031 S1RecType: equ '1'
00000032 S2RecType: equ '2'
00000038 S8RecType: equ '8'
00000039 S9RecType: equ '9'
;
00000001 FEraseError: equ 1 ; Flash failed to erase.
00000002 SRecRngErr: equ 2 ; S-Record out of range.
00000003 FlashPrgErr: equ 3 ; Flash programming error.
00000004 SRecDataErr: equ 4 ; Received S-Record contained an odd number
; of data bytes.
00000005 SRecAddrErr: equ 5 ; S-Record Address is odd.
00000006 SRecLenErr: equ 6 ; S-Record is too long.
;
;*************************************************************************************************************
;
;
0000F000 org $f000
;
;
0000F000 1F02514004 BootStart: brclr PTIM,#$40,Boot ; execute the
bootloader?
0000F005 05FBFFF5 jmp [Reset-BootBlkSize,pcr] ; no. jump to the program
pointed to by the
; secondary reset vector.
;
0000F009 79003C Boot: clr COPCTL ; keep watchdog disabled.
;
0000F00C CFFF80 BootCopy: lds #StackTop ; initialize the stack pointer
0000F00F CEF000 ldx #BootStart ; point to the start of the Flash
bootloader in Flash.
0000F012 CD3000 ldy #RAMBoot ; point to the start of on-chip RAM.
0000F015 CCF59A ldd #BootLoadEnd ; calculate the size of the bootloader
code.
0000F018 83F000 subd #BootStart
0000F01B 180A3070 MoveMore: movb 1,x+,1,y+ ; move a byte of the
bootloader into RAM.
0000F01F 0434F9 dbne d,MoveMore ; dec byte count, move till done.
;
0000F022 C6C1 ldab #$c0+RAMHAL ; write to the INITRM register to overlay
the Flash
; bootblock with RAM.
;
00000000 if *&$0001<>0 ; PC currently at an odd byte boundary?
endif
;
0000F024 7B0010 stab >INITRM ; this instruction MUST use extended
addressing an be
; aligned to an even byte boundary.
;
0000F027 C600 ldab #REFDVVal ; set the REFDV register.
0000F029 5B35 stab REFDV
0000F02B C602 ldab #SYNRVal ; set the SYNR register.
0000F02D 5B34 stab SYNR
0000F02F A7 nop ; nops required for bug in initial silicon.
0000F030 A7 nop
0000F031 A7 nop
AN2153
MOTOROLA 41
Application Note
Code Listing
0000F032 A7 nop
0000F033 4F3708FC brclr CRGFLG,#LOCK,* ; wait here till the PLL is locked.
0000F037 4C3980 bset CLKSEL,#PLLSEL ; switch the bus clock to the PLL.
;
0000F03A C628 ldab #FCLKDIVVal ; value for the Flash clock divider register.
0000F03C 7B0100 stab FCLKDIV
;
0000F03F CC009C ldd #Baud9600 ; set SCI to 9600 baud.
0000F042 15FA046F jsr SCIInit,pcr ; go initialize the SCI.
0000F046 10EF cli
;
0000F048 1AFA0055 leax SignOn,pcr ; get the bootloader signon message
0000F04C 15FA0422 jsr OutStr,pcr ; send it to the terminal.
0000F050 69FA0546 CmdLoop: clr ErrorFlag,pcr ; clear the global error flag.
0000F054 1AFA0064 leax BLPrompt,pcr ; get the bootloader prompt
0000F058 072A bsr PromptResp ; go display the prompt & get a 1 character
response.
0000F05A C161 cmpb #$61 ; do a range check. less than 'a'?
0000F05C 25F2 blo CmdLoop ; yes. just re-display the prompt.
0000F05E C163 cmpb #$63 ; greater than 'c'?
0000F060 22EE bhi CmdLoop ; yes. just re-display the prompt.
0000F062 C40F andb #$0f ; no. mask off the upper nybble.
0000F064 53 decb ; reduce by 1 for indexing into the command offset table.
0000F065 58 lslb ; mult by 2 as each cmd table entry is a 2 byte address.
0000F066 1AFA0031 leax CmdTable,pcr ; point to the command table.
0000F06A ECE5 ldd b,x ; get offset from the beginning of the table to
the cmd.
0000F06C 15E6 jsr d,x ; execute the command.
0000F06E E6FA0528 ldab ErrorFlag,pcr ; error executing the command?
0000F072 27DC beq CmdLoop ; no. go display the prompt, wait for entered
command.
0000F074 53 decb ; subtract 1 from the error number for indexing.
0000F075 58 lslb ; mult by 2 because each address in the table is 2 bytes.
0000F076 1AFA00CC leax ErrorTable,pcr ; yes. point to the error table.
0000F07A ECE5 ldd b,x ; get offset from the start of the table to the
string.
0000F07C 1AE6 leax d,x ; calc the address of the error string from the
table.
0000F07E 15FA03F0 jsr OutStr,pcr ; send error message to the terminal.
0000F082 20CC bra CmdLoop ; go display the prompt.
;
;*************************************************************************************************************
;
0000F084 15FA03EA PromptResp: jsr OutStr,pcr ; send prompt to the terminal.
0000F088 15FA04B8 jsr getchar,pcr ; go get the user's choice.
0000F08C 15FA04E9 jsr putchar,pcr ; echo it.
0000F090 37 pshb ; save it.
0000F091 1AFA0060 leax CrLfStr,pcr ; go to the next line.
0000F095 15FA03D9 jsr OutStr,pcr
0000F099 33 pulb ; restore the entered character.
0000F09A 3D rts
;
;*************************************************************************************************************
;
Application Note
AN2153
42 MOTOROLA
0000F09B 0288 CmdTable: dc.w EraseFlash-CmdTable ; cmd table entry for
'Erase Flash' command.
0000F09D 01A7 dc.w ProgFlash-CmdTable ; cmd table entry for 'Program
Flash' command.
0000F09F 0169 dc.w SetBaud-CmdTable ; cmd table entry for 'Set Baud
Rate' command.
;
0000F0A1 0D0A4D433953 SignOn: dc.b $0d,$0a,"MC9S12DP256
Bootloader",$0d,$0a,0
;
0000F0BC 0D0A61292045 BLPrompt: dc.b $0d,$0a,"a) Erase
Flash",$0d,$0a
0000F0CE 62292050726F dc.b "b) Program Flash",$0d,$0a
0000F0E0 632920536574 dc.b "c) Set Baud Rate",$0d,$0a
0000F0F2 3F2000 dc.b "? ",0
;
0000F0F5 0D0A00 CrLfStr: dc.b $0d,$0a,0
;
0000F0F8 0D0A31292039 BaudPrompt: dc.b $0d,$0a,"1) 9600",$0d,$0a
0000F103 322920333834 dc.b "2) 38400",$0d,$0a
0000F10D 332920353736 dc.b "3) 57600",$0d,$0a
0000F117 342920313135 dc.b "4) 115200",$0d,$0a
0000F122 3F2000 dc.b "? ",0
;
0000F125 4368616E6765 BaudChgPrompt: dc.b "Change Terminal BR, Press
Return",0
;
0000F146 000C ErrorTable: dc.w FNotErasedStr-ErrorTable
0000F148 0021 dc.w SRecRngStr-ErrorTable
0000F14A 003B dc.w FlashPrgErrStr-ErrorTable
0000F14C 0057 dc.w SRecDataErrStr-ErrorTable
0000F14E 007C dc.w SRecAddrErrStr-ErrorTable
0000F150 0098 dc.w SRecLenErrStr-ErrorTable
;
0000F152 0D0A466C6173 FNotErasedStr: dc.b $0d,$0a,"Flash Not
Erased",$0d,$0a,0
0000F167 0D0A532D5265 SRecRngStr: dc.b $0d,$0a,"S-Record out of
Range",$0d,$0a,0
0000F181 0D0A466C6173 FlashPrgErrStr: dc.b $0d,$0a,"Flash Programming
Error",$0d,$0a,0
0000F19D 0D0A532D5265 SRecDataErrStr: dc.b $0d,$0a,"S-Record code/data
length is odd",$0d,$0a,0
0000F1C2 0D0A532D5265 SRecAddrErrStr: dc.b $0d,$0a,"S-Record Address is
odd",$0d,$0a,0
0000F1DE 0D0A532D5265 SRecLenErrStr: dc.b $0d,$0a,"S-Record Code/Data
Field Too Long",$0d,$0a,0
;
;*************************************************************************************************************
;
0000F204 SetBaud: equ *
0000F204 1AFAFEF0 leax BaudPrompt,pcr ; get the baud rate change prompt
0000F208 15FAFE78 jsr PromptResp,pcr ; go display the prompt & get a 1
character response.
0000F20C C131 cmpb #$31 ; do a range check. less than '1'?
0000F20E 25F4 blo SetBaud ; yes. just re-display the prompt.
0000F210 C134 cmpb #$34 ; greater than '4'?
0000F212 22F0 bhi SetBaud ; yes. just re-display the prompt.
0000F214 C40F andb #$0f ; no. mask off the upper nybble.
0000F216 53 decb ; subtract 1 for table indexing.
0000F217 58 lslb ; multiply by 2 because each table entry is 2 bytes.
0000F218 1AFA001E leax BaudTable,pcr ; point to the start of the table.
0000F21C ECE5 ldd b,x ; get the SCI0BD value from the table.
0000F21E 3B pshd ; save the value.
AN2153
MOTOROLA 43
Application Note
Code Listing
0000F21F 1AF903 leax BaudChgPrompt,pcr ; prompt the user to change the
terminal baud rate.
0000F222 15FA024C jsr OutStr,pcr ; send it to the terminal.
0000F226 4FCC40FC brclr SCI0SR1,#TC,* ; wait until the last character is
sent until we change
; the baud rate.
0000F22A 3A puld ; restore the SCI0BD value from the stack.
0000F22B 5CC8 std SCI0BD ; change the baud rate.
0000F22D 15FA0313 jsr getchar,pcr ; go wait for the user to change the
baud rate.
0000F231 1AFAFEC0 leax CrLfStr,pcr ; go to the next line.
0000F235 15FA0239 jsr OutStr,pcr
0000F239 3D rts ; return.
;
0000F23A 009C BaudTable: dc.w Baud9600 ; SCI0BD value for 9600 baud.
0000F23C 0027 dc.w Baud38400 ; SCI0BD value for 38400 baud.
0000F23E 001A dc.w Baud57600 ; SCI0BD value for 57600 baud.
0000F240 000D dc.w Baud115200 ; SCI0BD value for 115200 baud.
;
;*************************************************************************************************************
;
0000F242 ProgFlash: equ *
0000F242 C630 ldab #PVIOL+ACCERR ; if either the PVIOL or ACCERR bit is
set from a
0000F244 7B0105 stab FSTAT ; previous error, reset them so we can
program the Flash.
0000F247 2006 bra FSkipFirst ; don't send the progress character the
first time.
0000F249 C62A FSendPace: ldab #'*' ; the ascii asterisk is the
progress
character.
0000F24B 15FA032A jsr putchar,pcr ; let the user know we've processed an
S-Record.
0000F24F 15FA0174 FSkipFirst: jsr GetSRecord,pcr ; go get an S-Record.
0000F253 267D bne ProgDone ; non-zero condition means there was an error
0000F255 0FFA03410104 brclr DataBytes,pcr,#$01,DataLOK ; is the received
S-Record length even?
0000F25B 8604 ldaa #SRecDataErr ; no. report the error.
0000F25D 2073 bra ProgDone ; stop programming.
0000F25F 0FFA033C0104 DataLOK: brclr LoadAddr+2,pcr,#$01,SRecOK ; is the
received S-Record address even?
0000F265 8605 ldaa #SRecAddrErr ; no. report the error.
0000F267 2069 bra ProgDone ; stop programming.
;
0000F269 E6FA032E SRecOK: ldab RecType,pcr ; check the record type.
0000F26D C131 cmpb #S1RecType ; S1 record received?
0000F26F 2604 bne ChckNext ; no. check for S0, S2, S8 & S9 records.
0000F271 8602 ldaa #SRecRngErr ; yes. only S2 records w/ load addresses
$C0000 - $FEFFF
; allowed.
0000F273 205D bra ProgDone ; save error & return.
;
0000F275 C139 ChckNext: cmpb #S9RecType ; was it an S9 record?
0000F277 275D beq ProgRtn ; yes. we're done.
0000F279 C138 cmpb #S8RecType ; was it an S8 record?
0000F27B 2759 beq ProgRtn ; yes. we're done.
0000F27D C130 cmpb #S0RecType ; no. was it an S0 record?
0000F27F 27C8 beq FSendPace ; yes. just ignore it.
;
0000F281 E6FA031A ldab LoadAddr,pcr ; was an S2 record. Get high byte of
the 24-bit address.
0000F285 C10C cmpb #SRecLow>>16 ; less than $c0000?
0000F287 2404 bhs ChkHiLimit ; no. check the upper limit.
Application Note
AN2153
44 MOTOROLA
0000F289 8602 BadSRecRng: ldaa #SRecRngErr ; yes. S-Record out of range.
0000F28B 2045 bra ProgDone ; save the error code & return.
;
0000F28D E6FA030B ChkHiLimit: ldab DataBytes,pcr ; get the number of
bytes in the S-Record.
0000F291 87 clra ; zero extend it.
0000F292 E3FA030A addd LoadAddr+1,pcr ; add in the lower 16-bits of the
24-bit address.
0000F296 B745 tfr d,x ; save rthe result in X.
0000F298 E6FA0303 ldab LoadAddr,pcr ; get the upper 8-bits of the 24-bit
address.
0000F29C C900 adcb #$00 ; add in possible carry from lower 16-bits.
0000F29E C10F cmpb #SRecHi>>16 ; greater than $0fxxxx?
0000F2A0 2505 blo AddrOK ; no. S-Record within range.
0000F2A2 8EF000 cpx #SRecHi&$ffff ; yes. check the lower 16- bits. Out
of range?
0000F2A5 22E2 bhi BadSRecRng ; yes. S-Record out of range.
;
0000F2A7 E6FA02F4 AddrOK: ldab LoadAddr,pcr ; get upper 8-bits of 24-bit
load address.
0000F2AB B796 exg b,y ; zero extend b into y for the 32-bit divide
0000F2AD ECFA02EF ldd LoadAddr+1,pcr ; get the lower 16-bits of 24-bit
load address.
0000F2B1 CE4000 ldx #PPAGESize ; divide the load address by the PPAGE
window size.
0000F2B4 11 ediv
0000F2B5 C38000 addd #FlashStart ; add the PPAGE window start address to
the remainder
; (this gives the PPAGE window load address).
0000F2B8 B7C6 exg d,y ; lower byte of the quotent is the PPAGE value.
0000F2BA 5B30 stab PPAGE
0000F2BC 54 lsrb ; calculate the value of the block select bits based
0000F2BD 54 lsrb ; on bits 3:2 of the PPAGE register value.
0000F2BE 51 comb
0000F2BF C403 andb #$03 ; mask off all but the lower 2 bits.
0000F2C1 7B0103 stab FCNFG ; select the block to erase.
0000F2C4 6DFA02D5 sty PPAGEWAddr,pcr ; save the PPAGE window address.
0000F2C8 15FA000B jsr ProgFBlock,pcr ; go program the data into Flash.
0000F2CC 1827FF79 lbeq FSendPace ; zero condition means all went ok.
0000F2D0 8603 ldaa #FlashPrgErr
0000F2D2 6AFA02C4 ProgDone: staa ErrorFlag,pcr ; put error code where
pod can access it.
0000F2D6 3D ProgRtn: rts ; if we fall through, we automatically return a
non-zero condition.
;
;*************************************************************************************************************
;
0000F2D7 offset 0
0000F2D7 PCSave: set *
00000000 org $0
;
00000000 NumWords: ds 1
00000001 LocalSize: set *
;
00000001 switch .text
00000001 ifc '.text','.text'
0000F2D7 org PCSave
endif
;
0000F2D7 E6FA02C1 ProgFBlock: ldab DataBytes,pcr ; get the block size.
AN2153
MOTOROLA 45
Application Note
Code Listing
0000F2DB 54 lsrb ; divide the byte count by 2 since we program a word
; at a time.
0000F2DC 37 pshb ; allocate the local.
0000F2DD EEFA02BC ldx PPAGEWAddr,pcr ; get the PPAGE window Flash address.
0000F2E1 19FA02BD leay SRecData,pcr ; point to the received S-Record data.
0000F2E5 EC71 ProgLoop: ldd 2,y+ ; get a word from the buffer.
0000F2E7 6C31 std 2,x+ ; latch the address & data into the Flash
; program/erase buffers.
0000F2E9 C620 ldab #PROG ; get the program command.
0000F2EB 7B0106 stab FCMD ; write it to the command register.
0000F2EE C680 ldab #CBEIF ; start the command by writing a 1 to CBEIF.
0000F2F0 7B0105 stab FSTAT
0000F2F3 F60105 ldab FSTAT ; check to see if there was a problem executing
; the command.
0000F2F6 C530 bitb #PVIOL+ACCERR ; if either the PVIOL or ACCERR bit is set,
0000F2F8 2627 bne Return ; return.
0000F2FA 1F010580FB brclr FSTAT,#CBEIF,* ; wait here till the command
buffer is empty.
0000F2FF 6380 dec NumWords,sp ; any more words to program?
0000F301 26E2 bne ProgLoop ; yes. continue until done.
0000F303 1F010540FB brclr FSTAT,#CCIF,* ; no. wait until all commands
complete.
;
0000F308 E6FA0290 ldab DataBytes,pcr ; get the block size.
0000F30C 54 lsrb ; divide the byte count by 2 since we verify a
; word at a time.
0000F30D 6B80 stab NumWords,sp
0000F30F EEFA028A ldx PPAGEWAddr,pcr ; get the PPAGE window Flash address.
0000F313 19FA028B leay SRecData,pcr ; point to the received S-Record data.
0000F317 EC71 VerfLoop: ldd 2,y+ ; get a word from the buffer.
0000F319 AC31 cpd 2,x+ ; same as the word in Flash?
0000F31B 2604 bne Return ; no. return w/ an error (!= condition).
0000F31D 6380 dec NumWords,sp ; yes. done comparing all words?
0000F31F 26F6 bne VerfLoop ; no. compare some more.
;
0000F321 33 Return: pulb ; deallocate the local.
0000F322 3D rts ; return.
;
;
;*************************************************************************************************************
;
0000F323 offset 0
0000F323 PCSave: set *
00000000 org $0
;
00000000 BlockCnt: ds.b 1 ; number of 64K blocks to erase.
;
00000001 LocalSize: set *
;
00000001 switch .text
00000001 ifc '.text','.text'
0000F323 org PCSave
Application Note
AN2153
46 MOTOROLA
endif
;
0000F323 C603 EraseFlash: ldab #$03
0000F325 37 pshb
0000F326 C630 ldab #$30
0000F328 5B30 EraseLoop: stab PPAGE ; write the PPAGE register to allow
writes to the
; proper Flash block.
0000F32A 54 lsrb ; calculate the value of the block select bits based
0000F32B 54 lsrb ; on bits 3:2 of the PPAGE register.
0000F32C 51 comb
0000F32D C403 andb #$03 ; mask off all but the lower 2 bits.
0000F32F 7B0103 stab FCNFG ; select the block to erase.
0000F332 CE8000 ldx #FlashStart ; latch address for erase command
0000F335 C641 ldab #ERASE+MASS ; perform a bulk erase.
0000F337 0760 bsr EraseCmd
0000F339 2621 bne SaveError ; if CCR Z=0, an error occurred.
0000F33B C605 ldab #ERVER+MASS ; perform an erase verify.
0000F33D 075A bsr EraseCmd
0000F33F 1F010540FB VerfCmdOK: brclr FSTAT,#CCIF,* ; wait until the
command has completed.
0000F344 1E01050404 brset FSTAT,#BLANK,Erased ; flag a not erased error
if the BLANK bit did not set.
0000F349 8601 ldaa #FEraseError
0000F34B 200F bra SaveError
0000F34D C604 Erased: ldab #BLANK ; clear the BLANK status bit.
0000F34F 7B0105 stab FSTAT
0000F352 D630 ldab PPAGE ; get the current PPAGE value.
0000F354 CB04 addb #$04 ; add 4 to select the next 64K Flash block.
0000F356 6380 dec BlockCnt,sp ; done with 3 of the 64K blocks?
0000F358 26CE bne EraseLoop ; no.
0000F35A 0706 bsr EraseBlk0 ; block 0 must be erased seperately because it
; contains the bootblock.
0000F35C 6AFA023A SaveError: staa ErrorFlag,pcr ; put error code where
pod can access it.
0000F360 33 FEEDone: pulb
0000F361 3D rts ; return.
;
;EraseBlk0 erases Flash block 0 a sector (512 bytes) at a time because
the bootblock is protected.
;
0000F362 offset 0
0000F362 PCSave: set *
00000000 org $0
;
00000000 PPAGECnt: ds.b 1 ; number of 16K PPAGE windows that will be
; completely erased.
;
00000001 LocalSize: set *
;
00000001 switch .text
00000001 ifc '.text','.text'
0000F362 org PCSave
endif
;
AN2153
MOTOROLA 47
Application Note
Code Listing
0000F362 1808AF03 EraseBlk0: movb #3,1,-sp ; 3 16K PPAGE windows will be
completely erased.
0000F366 5B30 stab PPAGE ; PPAGE for first 16K page of block 0
; (passed in the B accumulator).
0000F368 790103 clr FCNFG ; set block select bits to 0.
0000F36B CE8000 EraseBlk0Loop: ldx #FlashStart ; point to the start of
the PPAGE window.
0000F36E C620 ldab #PPAGESize/SectorSize ; number of sectors in a PPAGE
window.
0000F370 0712 bsr EraseSectors ; go erase the PPAGE window a sector at a
time.
0000F372 260E bne BadBlk0 ; non-zero value returned in A indiciates a sector
; didn't erase.
0000F374 720030 inc PPAGE ; go to the next PPAGE.
0000F377 6380 dec PPAGECnt,sp ; done with all full PPAGE blocks?
0000F379 26F0 bne EraseBlk0Loop ; no. erase more blocks.
0000F37B CE8000 ldx #FlashStart ; yes. point to the start of the PPAGE
window.
0000F37E C618 ldab #(PPAGESize-BootBlkSize)/SectorSize ; number of
sectors in PPAGE $3F
; minus the bootblock.
0000F380 0702 bsr EraseSectors ; erase all sectors outside the bootblock.
0000F382 33 BadBlk0: pulb ; remove the page count from the stack.
0000F383 3D rts
;
;Erases 'b' (accumulator) sectors beginning at address 'x'
(index register)
;
0000F384 B796 EraseSectors: exg b,y ; put the sector count in y.
0000F386 C640 EraseSectLoop: ldab #ERASE ; perform a sector erase.
0000F388 070F bsr EraseCmd
0000F38A 2701 beq DoEraseVerf ; if no problem with the erase command, do
a verify.
0000F38C 3D Rtn: rts ; if problem, return with an error code in a.
0000F38D 0723 DoEraseVerf: bsr VerfSector
0000F38F 26FB bne Rtn ; if problem, return with an error code in a.
0000F391 1AE20200 leax SectorSize,x ; point to the next sector.
0000F395 0436EE dbne y,EraseSectLoop ; continue to erase remaining sectors.
0000F398 3D rts ; done. return.
;
;Erases a block or sector of Flash
;
0000F399 6C00 EraseCmd: std 0,x ; latch address for erase command.
0000F39B 7B0106 stab FCMD
0000F39E C680 ldab #CBEIF
0000F3A0 7B0105 stab FSTAT ; initiate the erase command.
0000F3A3 1F01053003 brclr FSTAT,#PVIOL+ACCERR,EraseCmdOK ; continue if
the privliage violation &
; Access error flags are clear.
0000F3A8 8601 ldaa #FEraseError
0000F3AA 3D rts
0000F3AB 1F010540FB EraseCmdOK: brclr FSTAT,#CCIF,* ; wait until the
command has completed.
0000F3B0 87 clra
0000F3B1 3D rts
;
;Verify that a sector was properly erased
;Must verify a word at a time because the built in verify command only
works on a block (64K)
;
Application Note
AN2153
48 MOTOROLA
0000F3B2 34 VerfSector: pshx ; save the base address of the sector.
0000F3B3 35 pshy ; save the sector count.
0000F3B4 CD0100 ldy #SectorSize/2 ; we'll check 2 bytes at a time.
0000F3B7 EC31 VerfSectLoop: ldd 2,x+ ; get a byte from the sector.
0000F3B9 048404 ibeq d,WordOK
0000F3BC 8601 ldaa #FEraseError
0000F3BE 2004 bra SectRtn
0000F3C0 0436F4 WordOK: dbne y,VerfSectLoop ; yes. dec the sector word
count.
0000F3C3 87 clra
0000F3C4 31 SectRtn: puly ; restore the sector count.
0000F3C5 30 pulx ; restore the base address of the sector.
0000F3C6 3D rts ; return.
;
;*************************************************************************************************************
;
0000F3C7 offset 0
0000F3C7 PCSave: set *
00000000 org $0
;
00000000 SRecBytes: ds.b 1 ; number of bytes in the address, data &
checksum fields.
00000001 CheckSum: ds.b 1 ; used for calculated checksum.
;
00000002 LocalSize: set *
;
00000002 switch .text
00000001 ifc '.text','.text'
0000F3C7 org PCSave
endif
;
0000F3C7 GetSRecord: equ *
0000F3C7 1B9E leas -LocalSize,sp ; allocate stack space for variables.
0000F3C9 1AFA01D2 leax LoadAddr,pcr ; point to the code/data buffer.
0000F3CD 6900 clr 0,x ; clear the upper byte of the 24 bit address
; (in case we receive a 16-bit address).
0000F3CF 15FA0171 LookForSOR: jsr getchar,pcr ; get a character from the
receiver.
0000F3D3 C153 cmpb #'S' ; start-of-record character?
0000F3D5 26F8 bne LookForSOR ; no. go back & get another character.
0000F3D7 15FA0169 jsr getchar,pcr ; yes. we found the start-of-record
character (ASCII 'S')
0000F3DB C130 cmpb #S0RecType ; found an S0 (header) record?
0000F3DD 2602 bne CheckForS9 ; no. go check for an S9 record.
0000F3DF 200A bra Addr16 ; yes. go receive the S0 record. (16-bit load
address)
;
0000F3E1 C139 CheckForS9: cmpb #S9RecType ; found an S9 (end) record?
(16-bit load address)
0000F3E3 2602 bne ChkForS1 ; no. go check for an S1 record.
0000F3E5 2004 bra Addr16 ; go receive the S9 record.
;
0000F3E7 C131 ChkForS1: cmpb #S1RecType ; found an S1 record? (16-bit
load address)
0000F3E9 2609 bne ChkForS2 ; no. false start-of-record character received.
; go check for another.
0000F3EB 08 Addr16: inx ; adjust the storage pointer to compensate for
AN2153
MOTOROLA 49
Application Note
Code Listing
; a 2 byte load address.
0000F3EC 8603 ldaa #3 ; 2 address bytes plus the checksum.
0000F3EE 6AFA01AA staa DataBytes,pcr
0000F3F2 2010 bra SaveRecType ; go receive the S9 record.
;
0000F3F4 C132 ChkForS2: cmpb #S2RecType ; S2 record? (24-bit load address)
0000F3F6 2602 bne ChkForS8
0000F3F8 2004 bra Addr24 ; go receive the S9 record.
;
0000F3FA C138 ChkForS8: cmpb #S8RecType ; no. s8 record? (24-bit
transfer address)
0000F3FC 26D1 bne LookForSOR ; no. go look for next Start of Record.
0000F3FE 8604 Addr24: ldaa #4 ; 3 address bytes plus the checksum.
0000F400 6AFA0198 staa DataBytes,pcr
0000F404 6BFA0193 SaveRecType: stab RecType,pcr ; yes. save the record type.
;
0000F408 15FA003E RcvSRec: jsr GetHexByte,pcr ; get the S-Record length
byte.
0000F40C 2626 bne BadSRec ; return if there was an error.
0000F40E 6B80 stab SRecBytes,sp ; save the total number of S-Record bytes we
; are to receive.
0000F410 6B81 stab CheckSum,sp ; initialize the checksum calculation
with the
; data byte count
0000F412 E0FA0186 subb DataBytes,pcr ; subtract the load address &
checksum field
; length from the data field count.
0000F416 6BFA0182 stab DataBytes,pcr ; save the code/data field size.
0000F41A C140 cmpb #64 ; is the code/data field <= 64?
0000F41C 2304 bls RcvData ; yes. it can be received.
0000F41E 8606 ldaa #SRecLenErr ; no. the code/data field is limited to
64 bytes.
0000F420 2012 bra BadSRec ; return with the error code in a.
0000F422 15FA0024 RcvData: jsr GetHexByte,pcr ; get an S-Record data byte.
0000F426 260C bne BadSRec ; return if there was an error.
0000F428 6B30 stab 1,x+ ; save the byte in the data buffer.
0000F42A EB81 addb CheckSum,sp ; add the byte into the checksum.
0000F42C 6B81 stab CheckSum,sp ; save the result.
0000F42E 6380 dec SRecBytes,sp ; received all the S-Record bytes?
0000F430 26F0 bne RcvData ; no. go get some more.
0000F432 6281 inc CheckSum,sp ; if checksum was ok, the result will be zero.
0000F434 1B82 BadSRec: leas LocalSize,sp
0000F436 3D rts
;
;*************************************************************************************************************
;
0000F437 IsHex: equ *
0000F437 C130 cmpb #'0' ; less than ascii hex zero?
0000F439 250E blo NotHex ; yes. character is not hex. return a non-zero
; ccr indication.
0000F43B C139 cmpb #'9' ; less than or equal to ascii hex nine?
0000F43D 2308 bls IsHex1 ; yes. character is hex. return a zero ccr
indication.
0000F43F C141 cmpb #'A' ; less than ascii hex 'A'?
0000F441 2506 blo NotHex ; yes. character is not hex. return a non-zero
; ccr indication.
Application Note
AN2153
50 MOTOROLA
0000F443 C146 cmpb #'F' ; less than or equal to ascii hex
'F'?
0000F445 2202 bhi NotHex ; yes. character is hex. return a non-zero
; ccr indication.
0000F447 1404 IsHex1: orcc #$04 ; no. return a zero ccr indication.
0000F449 3D NotHex: rts
;
;*************************************************************************************************************
;
0000F44A GetHexByte: equ *
0000F44A 15FA00F6 jsr getchar,pcr ; get the upper nybble from the SCI.
0000F44E 07E7 bsr IsHex ; valid hex character?
0000F450 2701 beq OK1 ; yes. go convert it to binary.
0000F452 3D rts ; no. return with a non-zero ccr indication.
0000F453 0714 OK1: bsr CvtHex ; convert the ascii-hex character to binary.
0000F455 8610 ldaa #16 ; shift it to the upper 4-bits.
0000F457 12 mul
0000F458 37 pshb ; save it on the stack.
0000F459 15FA00E7 jsr getchar,pcr ; get the lower nybble from the SCI.
0000F45D 07D8 bsr IsHex ; valid hex character?
0000F45F 2702 beq OK2 ; yes. go convert it to binary.
0000F461 33 pulb ; remove saved upper byte from the stack.
0000F462 3D rts ; no. return with a non-zero ccr indication.
0000F463 0704 OK2: bsr CvtHex ; convert the ascii-hex character to binary.
0000F465 EBB0 addb 1,sp+ ; add it to the upper nybble.
0000F467 87 clra ; simple way to set the Z ccr bit.
0000F468 3D rts ; return.
;
;*************************************************************************************************************
;
0000F469 C030 CvtHex: subb #'0' ; subtract ascii '0' from
the hex character.
0000F46B C109 cmpb #$09 ; was it a decimal digit?
0000F46D 2302 bls CvtHexRtn ; yes. ok as is.
0000F46F C007 subb #$07 ; no. it was an ascii hex letter ('A' -
'F').
0000F471 3D CvtHexRtn: rts
;
;*************************************************************************************************************
;
0000F472 OutStr: equ * ; send a null terminated string to the display.
0000F472 E630 ldab 1,x+ ; get a character, advance pointer, null?
0000F474 2706 beq OutStrDone ; yes. return.
0000F476 15FA00FF jsr putchar,pcr ; no. send it out the SCI.
0000F47A 20F6 bra OutStr ; go get the next character.
0000F47C 3D OutStrDone: rts
;
;
;*************************************************************************************************************
;
00000020 RxBufSize: equ 32 ; receive queue size.
00000010 TxBufSize: equ 16 ; transmit queue size.
;
AN2153
MOTOROLA 51
Application Note
Code Listing
00000018 XOnCount: equ RxBufSize-8 ; number of bytes avail. in the Rx queue
; before an XOn can be sent.
0000000A XOffCount: equ 10 ; number of bytes remaining in the Rx queue
; when an XOff is sent.
;
00000011 XOn: equ $11 ; ASCII DC1
00000013 XOff: equ $13 ; ASCII DC3
;
0000F47D 000000000000 RxBuff: dcb RxBufSize,0 ; receive queue.
0000F49D 000000000000 TxBuff: dcb TxBufSize,0 ; transmit queue.
0000F4AD 00 RxIn: dc.b 0 ; next available location in the Rx queue.
0000F4AE 00 RxOut: dc.b 0 ; next character to be removed from the Rx queue.
0000F4AF 00 TxIn: dc.b 0 ; next available location in the Tx queue
0000F4B0 00 TxOut: dc.b 0 ; next character to be sent from the Tx queue.
0000F4B1 20 RxBAvail: dc.b RxBufSize ; number of bytes left in the Rx queue.
0000F4B2 10 TxBAvail: dc.b TxBufSize ; number of bytes left in the Tx queue.
0000F4B3 00 XOffSent: dc.b 0 ; if != 0, an XOff has been sent.
0000F4B4 00 SendXOff: dc.b 0 ; request to TX ISR to send an XOff to the
host if != 0.
;
;
;*************************************************************************************************************
;
0000F4B5 5CC8 SCIInit: std SCI0BD ; initialize the baud rate register.
0000F4B7 C62C ldab #TE+RE+RIE ; get bit mask for Tx, Rx & Rx interrupt.
0000F4B9 5BCB stab SCI0CR2 ; enable Tx & Rx & Rx interrupts.
0000F4BB 1AFA0004 leax SCIISR,pcr ; setup SCI0 interrupt vector to point
to the
0000F4BF 7EFFD6 stx SCI0 ; bootloader's SCI interrupt service routine.
0000F4C2 3D rts ; done.
;
;*************************************************************************************************************
;
0000F4C3 4FCB2004 SCIISR: brclr SCI0CR2,#RIE,ChkRxInts ; Rx interrupts
enabled?
0000F4C7 4ECC2009 brset SCI0SR1,#RDRF,RxIRQ ; yes. if RDRF flag set,
service Rx interrupt.
0000F4CB 4FCB8004 ChkRxInts: brclr SCI0CR2,#TIE,NoSCIInt ; Tx interrupts
enabled?
0000F4CF 4ECC8035 brset SCI0SR1,#TDRE,TxIRQ ; Yes. if TDRE is set,
service Tx interrupt
0000F4D3 0B NoSCIInt: rti ; return w/o any action.
;
;*************************************************************************************************************
;
0000F4D4 E7F9DC RxIRQ: tst XOffSent,pcr ; was an XOff previously sent to
the host?
0000F4D7 2610 bne AlreadySent ; yes. go place the received char in the
Rx queue.
0000F4D9 A6F9D5 ldaa RxBAvail,pcr ; no. get the number of bytes
available in the Rx queue.
0000F4DC 810A cmpa #XOffCount ; more than enough space to receive a FIFO
full
; of data from the host?
0000F4DE 2209 bhi AlreadySent ; yes. go place the received byte in the
Rx queue.
0000F4E0 72F4B4 inc SendXOff ; set flag so that XOff will be sent by the
Tx ISR.
0000F4E3 4CCB80 bset SCI0CR2,#TIE ; enable transmitter interrupts.
0000F4E6 62F9CA inc XOffSent,pcr ; set the 'XOff Sent' flag
;
Application Note
AN2153
52 MOTOROLA
0000F4E9 E7F9C5 AlreadySent: tst RxBAvail,pcr ; any room left in the Rx
queue?
0000F4EC 2717 beq Buffull ; no. just throw the character away.
0000F4EE 63F9C0 dec RxBAvail,pcr ; yes. there'll be one less now.
0000F4F1 1AF989 leax RxBuff,pcr ; point to the physical start of the Rx
queue.
0000F4F4 A6F9B6 ldaa RxIn,pcr ; get the index for the next available
queue location.
0000F4F7 D6CF ldab SCI0DRL ; get the received character.
0000F4F9 6BE4 stab a,x ; place it in the queue.
0000F4FB 42 inca ; next available queue location.
0000F4FC 8120 cmpa #RxBufSize ; wrap around to start of queue?
0000F4FE 2501 blo NoRxWrap ; no. just update the index.
0000F500 87 clra ; yes. start at begining of queue.
0000F501 6AF9A9 NoRxWrap: staa RxIn,pcr ; update the next available
queue location index.
0000F504 0B rti ; return from the SCI Rx interrupt.
;
0000F505 D6CF Buffull: ldab SCI0DRL ; the queue was full. get character
& throw it away.
0000F507 0B rti ; return.
;
;*************************************************************************************************************
;
0000F508 F7F4B4 TxIRQ: tst SendXOff ; request to send an XOff.
0000F50B 2712 beq NoSendXOff ; no. go send a character from the Tx queue.
0000F50D 69F9A4 clr SendXOff,pcr ; yes. clear the request flag.
0000F510 C613 ldab #XOff ; get the XOff character.
0000F512 5BCF stab SCI0DRL ; send it.
0000F514 E6F99B ldab TxBAvail,pcr ; any other characters in the Tx queue?
0000F517 C110 cmpb #TxBufSize
0000F519 2622 bne TxRTI ; yes. just return & let the next interrupt
; send the character.
0000F51B 4DCB80 bclr SCI0CR2,#TIE ; no. disable Tx interrupts.
0000F51E 0B rti ; return.
;
0000F51F 1AF97B NoSendXOff: leax TxBuff,pcr ; point to the physical
start of the Tx queue.
0000F522 A6F98B ldaa TxOut,pcr ; get the index for the next character to
send.
0000F525 E6E4 ldab a,x ; get the data.
0000F527 5BCF stab SCI0DRL ; send it.
0000F529 42 inca ; advance to next character to send.
0000F52A 8110 cmpa #TxBufSize ; reached the end of the queue?
0000F52C 2501 blo NoTxWrap ; no.
0000F52E 87 clra ; yes. wrap to the start.
0000F52F 6AF97E NoTxWrap: staa TxOut,pcr ; update the queue index.
0000F532 62F97D inc TxBAvail,pcr ; one more byte available in the queue.
0000F535 A1F977 cmpa TxIn,pcr ; TxIn = TxOut?
0000F538 2603 bne TxRTI ; no. more characters to send.
0000F53A 4DCB80 bclr SCI0CR2,#TIE ; yes. queue is empty turn off TDRE
interrupts.
0000F53D 0B TxRTI: rti ; return.
;
;*************************************************************************************************************
;
0000F53E C620 SCIGetBuf: ldab #RxBufSize ; are there any characters in
the Rx queue?
0000F540 E0F96E subb RxBAvail,pcr
AN2153
MOTOROLA 53
Application Note
Code Listing
0000F543 3D rts ; return number available.
;
;*************************************************************************************************************
;
0000F544 34 getchar: pshx ; save the registers we'll use.
0000F545 36 psha
0000F546 C620 RxChk: ldab #RxBufSize ; any characters available?
0000F548 E0F966 subb RxBAvail,pcr
0000F54B 27F9 beq RxChk ; no. just wait until some are.
0000F54D 1AF92D leax RxBuff,pcr ; point to the physical start of the Rx
queue.
0000F550 A6F95B ldaa RxOut,pcr ; get the index to the next available
character
; in the Rx queue.
0000F553 E6E4 ldab a,x ; get the character.
0000F555 42 inca ; point to the next location in the queue.
0000F556 8120 cmpa #RxBufSize ; reached the end of the queue?
0000F558 2501 blo NogcWrap ; no.
0000F55A 87 clra ; yes. wrap to the start.
0000F55B 6AF950 NogcWrap: staa RxOut,pcr ; update the queue index.
0000F55E 62F950 inc RxBAvail,pcr ; we removed a character from the
queue, there's
; 1 more available.
0000F561 E7F94F tst XOffSent,pcr ; was an XOff character previously sent
by the RX ISR?
0000F564 2710 beq gcReturn ; no. just return.
0000F566 A6F948 ldaa RxBAvail,pcr ; yes. get the number of bytes
available in the Rx queue.
0000F569 8118 cmpa #XOnCount ; enough space available to receive more?
0000F56B 2409 bhs gcReturn ; no. just return.
0000F56D 37 pshb ; yes. save the character we retrieved from the Rx queue.
0000F56E C611 ldab #XOn ; send an XOn character to the host.
0000F570 0707 bsr putchar
0000F572 69F93E clr XOffSent,pcr ; clear the XOff flag.
0000F575 33 pulb ; restore the character we retrieved from the Rx queue.
0000F576 32 gcReturn: pula ; restore what we saved.
0000F577 30 pulx
0000F578 3D rts ; return.
;
;*************************************************************************************************************
;
0000F579 34 putchar: pshx ; save the registers we'll use.
0000F57A 36 psha
0000F57B E7F934 TxChk: tst TxBAvail,pcr ; Any room left in the Tx queue?
0000F57E 27FB beq TxChk ; no. just wait here till it is.
0000F580 1AF91A leax TxBuff,pcr ; point to the physical start of the Tx
queue.
0000F583 A6F929 ldaa TxIn,pcr ; get the index to the next available spot.
0000F586 6BE4 stab a,x ; put the character in.
0000F588 42 inca ; point to the next available spot.
0000F589 8110 cmpa #TxBufSize ; go past the end of the queue?
0000F58B 2501 blo NopcWrap ; no.
0000F58D 87 clra ; yes. wrap around to the start.
0000F58E 6AF91E NopcWrap: staa TxIn,pcr ; update the queue index
0000F591 63F91E dec TxBAvail,pcr ; one less byte available in the Tx queue.
0000F594 4CCB80 bset SCI0CR2,#TIE ; enable transmitter interrupts.
Application Note
AN2153
54 MOTOROLA
0000F597 32 pula ; restore what we saved.
0000F598 30 pulx
0000F599 3D rts ; return
;
;
0000F59A BootLoadEnd: equ *
;
;
;
;Global Variable declarations
;
;
0000F59A ErrorFlag: ds.b 1 ; error code stored by various routines.
0000F59B RecType: ds.b 1 ; received record type. '0' = S0;
'1' = S1; '2'
= S2;
; '8' = S8; '9' = S9
0000F59C DataBytes: ds.b 1 ; number of data bytes in the S-Record.
0000F59D PPAGEWAddr: ds.b 2 ; PPAGE window address ($8000 - $BFFF)
0000F59F LoadAddr: ds.b 3 ; load address of the S-Record.
0000F5A2 SRecData: ds.b 65 ; S-Record data storage. (handle 64-byte
S-Records
; + received checksum)
;
;
;*************************************************************************************************************
;
; This is the jump table that is used to access the secondary interrupt
vector table. Each one
; of the actual interrupt vectors, begining at $ff8c, points to an entry
in this table. Each jmp
; instruction uses indexed indirect program counter relative (pcr)
addressing to access the
; secondary interrupt vector table that is located just below the bootblock.
;
;*************************************************************************************************************
;
0000F5E3 05FBF9A5 JPWMEShutdown: jmp [PWMEShutdown-BootBlkSize,pcr]
0000F5E7 05FBF9A3 JPortPInt: jmp [PortPInt-BootBlkSize,pcr]
0000F5EB 05FBF9A1 JMSCAN4Tx: jmp [MSCAN4Tx-BootBlkSize,pcr]
0000F5EF 05FBF99F JMSCAN4Rx: jmp [MSCAN4Rx-BootBlkSize,pcr]
0000F5F3 05FBF99D JMSCAN4Errs: jmp [MSCAN4Errs-BootBlkSize,pcr]
0000F5F7 05FBF99B JMSCAN4WakeUp: jmp [MSCAN4WakeUp-BootBlkSize,pcr]
0000F5FB 05FBF999 JMSCAN3Tx: jmp [MSCAN3Tx-BootBlkSize,pcr]
0000F5FF 05FBF997 JMSCAN3Rx: jmp [MSCAN3Rx-BootBlkSize,pcr]
0000F603 05FBF995 JMSCAN3Errs: jmp [MSCAN3Errs-BootBlkSize,pcr]
0000F607 05FBF993 JMSCAN3WakeUp: jmp [MSCAN3WakeUp-BootBlkSize,pcr]
0000F60B 05FBF991 JMSCAN2Tx: jmp [MSCAN2Tx-BootBlkSize,pcr]
0000F60F 05FBF98F JMSCAN2Rx: jmp [MSCAN2Rx-BootBlkSize,pcr]
0000F613 05FBF98D JMSCAN2Errs: jmp [MSCAN2Errs-BootBlkSize,pcr]
0000F617 05FBF98B JMSCAN2WakeUp: jmp [MSCAN2WakeUp-BootBlkSize,pcr]
0000F61B 05FBF989 JMSCAN1Tx: jmp [MSCAN1Tx-BootBlkSize,pcr]
0000F61F 05FBF987 JMSCAN1Rx: jmp [MSCAN1Rx-BootBlkSize,pcr]
0000F623 05FBF985 JMSCAN1Errs: jmp [MSCAN1Errs-BootBlkSize,pcr]
0000F627 05FBF983 JMSCAN1WakeUp: jmp [MSCAN1WakeUp-BootBlkSize,pcr]
0000F62B 05FBF981 JMSCAN0Tx: jmp [MSCAN0Tx-BootBlkSize,pcr]
AN2153
MOTOROLA 55
Application Note
Code Listing
0000F62F 05FBF97F JMSCAN0Rx: jmp [MSCAN0Rx-BootBlkSize,pcr]
0000F633 05FBF97D JMSCAN0Errs: jmp [MSCAN0Errs-BootBlkSize,pcr]
0000F637 05FBF97B JMSCAN0WakeUp: jmp [MSCAN0WakeUp-BootBlkSize,pcr]
0000F63B 05FBF979 JFlash: jmp [Flash-BootBlkSize,pcr]
0000F63F 05FBF977 JEEPROM: jmp [EEPROM-BootBlkSize,pcr]
0000F643 05FBF975 JSPI2: jmp [SPI2-BootBlkSize,pcr]
0000F647 05FBF973 JSPI1: jmp [SPI1-BootBlkSize,pcr]
0000F64B 05FBF971 JIICBus: jmp [IICBus-BootBlkSize,pcr]
0000F64F 05FBF96F JDLC: jmp [DLC-BootBlkSize,pcr]
0000F653 05FBF96D JSCME: jmp [SCMEVect-BootBlkSize,pcr]
0000F657 05FBF96B JCRGLock: jmp [CRGLock-BootBlkSize,pcr]
0000F65B 05FBF969 JPACCBOv: jmp [PACCBOv-BootBlkSize,pcr]
0000F65F 05FBF967 JModDnCtr: jmp [ModDnCtr-BootBlkSize,pcr]
0000F663 05FBF965 JPortHInt: jmp [PortHInt-BootBlkSize,pcr]
0000F667 05FBF963 JPortJInt: jmp [PortJInt-BootBlkSize,pcr]
0000F66B 05FBF961 JATD1: jmp [ATD1-BootBlkSize,pcr]
0000F66F 05FBF95F JATD0: jmp [ATD0-BootBlkSize,pcr]
0000F673 05FBF95D JSCI1: jmp [SCI1-BootBlkSize,pcr]
0000F677 05FBF95B JSCI0: jmp [SCI0-BootBlkSize,pcr]
0000F67B 05FBF959 JSPI0: jmp [SPI0-BootBlkSize,pcr]
0000F67F 05FBF957 JPACCAEdge: jmp [PACCAEdge-BootBlkSize,pcr]
0000F683 05FBF955 JPACCAOv: jmp [PACCAOv-BootBlkSize,pcr]
0000F687 05FBF953 JTimerOv: jmp [TimerOv-BootBlkSize,pcr]
0000F68B 05FBF951 JTimerCh7: jmp [TimerCh7-BootBlkSize,pcr]
0000F68F 05FBF94F JTimerCh6: jmp [TimerCh6-BootBlkSize,pcr]
0000F693 05FBF94D JTimerCh5: jmp [TimerCh5-BootBlkSize,pcr]
0000F697 05FBF94B JTimerCh4: jmp [TimerCh4-BootBlkSize,pcr]
0000F69B 05FBF949 JTimerCh3: jmp [TimerCh3-BootBlkSize,pcr]
0000F69F 05FBF947 JTimerCh2: jmp [TimerCh2-BootBlkSize,pcr]
0000F6A3 05FBF945 JTimerCh1: jmp [TimerCh1-BootBlkSize,pcr]
0000F6A7 05FBF943 JTimerCh0: jmp [TimerCh0-BootBlkSize,pcr]
0000F6AB 05FBF941 JRTI: jmp [RTI-BootBlkSize,pcr]
0000F6AF 05FBF93F JIRQ: jmp [IRQ-BootBlkSize,pcr]
0000F6B3 05FBF93D JXIRQ jmp [XIRQ-BootBlkSize,pcr]
0000F6B7 05FBF93B JSWI: jmp [SWI-BootBlkSize,pcr]
0000F6BB 05FBF939 JIllop: jmp [Illop-BootBlkSize,pcr]
0000F6BF 05FBF937 JCOPFail: jmp [COPFail-BootBlkSize,pcr]
0000F6C3 05FBF935 JClockFail: jmp [ClockFail-BootBlkSize,pcr]
;
0000FF0D org $ff0d
;
0000FF0D CF dc.b $cf ; setup a 4K bootblock in Flash block 0.
;
0000FF0F org $ff0f ; location of security byte.
;
0000FF0F FE dc.b $fe ; value of security byte for unsecured state.
;
0000FF8C org $ff8c
;
0000FF8C F5E3 PWMEShutdown: dc.w JPWMEShutdown
Application Note
AN2153
56 MOTOROLA
0000FF8E F5E7 PortPInt: dc.w JPortPInt
0000FF90 F5EB MSCAN4Tx: dc.w JMSCAN4Tx
0000FF92 F5EF MSCAN4Rx: dc.w JMSCAN4Rx
0000FF94 F5F3 MSCAN4Errs: dc.w JMSCAN4Errs
0000FF96 F5F7 MSCAN4WakeUp: dc.w JMSCAN4WakeUp
0000FF98 F5FB MSCAN3Tx: dc.w JMSCAN3Tx
0000FF9A F5FF MSCAN3Rx: dc.w JMSCAN3Rx
0000FF9C F603 MSCAN3Errs: dc.w JMSCAN3Errs
0000FF9E F607 MSCAN3WakeUp: dc.w JMSCAN3WakeUp
0000FFA0 F60B MSCAN2Tx: dc.w JMSCAN2Tx
0000FFA2 F60F MSCAN2Rx: dc.w JMSCAN2Rx
0000FFA4 F613 MSCAN2Errs: dc.w JMSCAN2Errs
0000FFA6 F617 MSCAN2WakeUp: dc.w JMSCAN2WakeUp
0000FFA8 F61B MSCAN1Tx: dc.w JMSCAN1Tx
0000FFAA F61F MSCAN1Rx: dc.w JMSCAN1Rx
0000FFAC F623 MSCAN1Errs: dc.w JMSCAN1Errs
0000FFAE F627 MSCAN1WakeUp: dc.w JMSCAN1WakeUp
0000FFB0 F62B MSCAN0Tx: dc.w JMSCAN0Tx
0000FFB2 F62F MSCAN0Rx: dc.w JMSCAN0Rx
0000FFB4 F633 MSCAN0Errs: dc.w JMSCAN0Errs
0000FFB6 F637 MSCAN0WakeUp: dc.w JMSCAN0WakeUp
0000FFB8 F63B Flash: dc.w JFlash
0000FFBA F63F EEPROM: dc.w JEEPROM
0000FFBC F643 SPI2: dc.w JSPI2
0000FFBE F647 SPI1: dc.w JSPI1
0000FFC0 F64B IICBus: dc.w JIICBus
0000FFC2 F64F DLC: dc.w JDLC
0000FFC4 F653 SCMEVect: dc.w JSCME
0000FFC6 F657 CRGLock: dc.w JCRGLock
0000FFC8 F65B PACCBOv: dc.w JPACCBOv
0000FFCA F65F ModDnCtr: dc.w JModDnCtr
0000FFCC F663 PortHInt: dc.w JPortHInt
0000FFCE F667 PortJInt: dc.w JPortJInt
0000FFD0 F66B ATD1: dc.w JATD1
0000FFD2 F66F ATD0: dc.w JATD0
0000FFD4 F673 SCI1: dc.w JSCI1
0000FFD6 F677 SCI0: dc.w JSCI0
0000FFD8 F67B SPI0: dc.w JSPI0
0000FFDA F67F PACCAEdge: dc.w JPACCAEdge
0000FFDC F683 PACCAOv: dc.w JPACCAOv
0000FFDE F687 TimerOv: dc.w JTimerOv
0000FFE0 F68B TimerCh7: dc.w JTimerCh7
0000FFE2 F68F TimerCh6: dc.w JTimerCh6
0000FFE4 F693 TimerCh5: dc.w JTimerCh5
0000FFE6 F697 TimerCh4: dc.w JTimerCh4
0000FFE8 F69B TimerCh3: dc.w JTimerCh3
0000FFEA F69F TimerCh2: dc.w JTimerCh2
0000FFEC F6A3 TimerCh1: dc.w JTimerCh1
0000FFEE F6A7 TimerCh0: dc.w JTimerCh0
0000FFF0 F6AB RTI: dc.w JRTI
AN2153
MOTOROLA 57
Application Note
Code Listing
0000FFF2 F6AF IRQ: dc.w JIRQ
0000FFF4 F6B3 XIRQ: dc.w JXIRQ
0000FFF6 F6B7 SWI: dc.w JSWI
0000FFF8 F6BB Illop: dc.w JIllop
0000FFFA F6BF COPFail: dc.w JCOPFail
0000FFFC F6C3 ClockFail: dc.w JClockFail
0000FFFE F000 Reset: dc.w BootStart
Errors: None
Labels: 472
Last Program Address: $0000FFFF
Last Storage Address: $FFFFFFFF
Program Bytes: $000006F4 1780
Storage Bytes: $0000004E 78
Application Note
AN2153
58 MOTOROLA
Jeff McKnight wrote:
>Can a text file of the code listing in AN2153 for
the serial
>bootloader be downloaded anywhere ? I can seem to find
>it. Only PDF format.
>Thanks
>
|