TMS320C31 Boot Loader Source Code
B-5
TMS320C31 Boot Loader Source Code
NOP
*AR1++(1)
; jump last half word from mem. word
LDI
sub_h,AR3
; half word size subroutine
; address –> AR3
LSH
1,R1
; test bit 4 of mem. width word
BN
load0
; if ’1’ start PGM loading
; (16 bits width)
LDI
sub_b,AR3
; byte size subroutine address –> AR3
ADDI
2,AR1
; jump last 2 bytes from mem. word
load0
CALLU
AR3
; load new word
; according to mem. width
STI
R1,*+AR0(64h)
; set primary bus control
load2
CALLU
AR3
; load new word according to
; mem. width
LDI
R1,RC
; set block size for repeat loop
CMPI
0,RC
; if 0 block size start PGM
BZ
AR2
SUBI
1,RC
; block size –1
CALLU
AR3
; load new word according to
; mem. width
LDI
R1,AR4
; set destination address
LDI
R0,R0
; test start address loaded flag
LDIZ
R1,AR2
; load start address if flag off
LDI
–1,R0
; set start & dest. address flag on
SUBI
1,AR3
; sub address with loop
CALLUAR3
; load new word according to
; mem. width
LDI
1,R0
; set dest. address flag off
ADDI
1,AR3
; sub address without loop
BR
load2
; jump to load a new block
; when loop completed
.space 1
serial
LDI
sub_s,AR3
; serial words subroutine
; address –> AR3
LDI
111h,R1
; R1 = 0000111h
STI
R1,*+AR0(43h)
; set CLKR,DR,FSR as serial port pins
LDI
0A30h,R2
LSH
16,R2
; R2 = A300000h
STI
R2,*+AR0(40h)
; set serial port global
; ctrl. register
BR
load2
; jump to load 1st block
.space 29
loop_s
RPTB
load_s
; PGM load loop
sub_s
TSTB
20h,IF
BZ
sub_s
; wait for receive buffer full
AND
0FDFh,IF
; reset interrupt flag