@ -33,62 +33,47 @@
rte;
# if d e f i n e d ( C O N F I G _ S E R I A L _ B O O T )
# define A S M _ D R A M I N I T ( a s m _ d r a m _ i n i t - C O N F I G _ S Y S _ T E X T _ B A S E + C O N F I G _ S Y S _ I N I T _ R A M _ A D D R )
# define A S M _ D R A M I N I T ( a s m _ d r a m _ i n i t - C O N F I G _ S Y S _ T E X T _ B A S E + \
CONFIG_ S Y S _ I N I T _ R A M _ A D D R )
# define A S M _ D R A M I N I T _ N ( a s m _ d r a m _ i n i t - C O N F I G _ S Y S _ T E X T _ B A S E )
# define A S M _ S B F _ I M G _ H D R ( a s m _ s b f _ i m g _ h d r - C O N F I G _ S Y S _ T E X T _ B A S E + C O N F I G _ S Y S _ I N I T _ R A M _ A D D R )
# define A S M _ S B F _ I M G _ H D R ( a s m _ s b f _ i m g _ h d r - C O N F I G _ S Y S _ T E X T _ B A S E + \
CONFIG_ S Y S _ I N I T _ R A M _ A D D R )
# endif
.text
/ *
* Vector t a b l e . T h i s i s u s e d f o r i n i t i a l p l a t f o r m s t a r t u p .
* These v e c t o r s a r e t o c a t c h a n y u n - i n t e n d e d t r a p s .
* Vector t a b l e . T h i s i s u s e d f o r i n i t i a l p l a t f o r m s t a r t u p .
* These v e c t o r s a r e t o c a t c h a n y u n - i n t e n d e d t r a p s .
* /
_vectors :
# if d e f i n e d ( C O N F I G _ S E R I A L _ B O O T )
INITSP : .long 0 /* Initial SP */
INITSP : .long 0 /* Initial SP */
# ifdef C O N F I G _ C F _ S B F
INITPC : .long A S M _ D R A M I N I T / * I n i t i a l P C * /
INITPC : .long A S M _ D R A M I N I T / * I n i t i a l P C * /
# endif
# ifdef C O N F I G _ S Y S _ N A N D _ B O O T
INITPC : .long A S M _ D R A M I N I T _ N / * I n i t i a l P C * /
INITPC : .long A S M _ D R A M I N I T _ N / * I n i t i a l P C * /
# endif
# else
INITSP : .long 0 /* Initial SP */
INITPC : .long _ S T A R T / * I n i t i a l P C * /
INITSP : .long 0 /* Initial SP */
INITPC : .long _ S T A R T / * I n i t i a l P C * /
# endif
vector02 : .long _ F A U L T / * A c c e s s E r r o r * /
vector03 : .long _ F A U L T / * A d d r e s s E r r o r * /
vector04 : .long _ F A U L T / * I l l e g a l I n s t r u c t i o n * /
vector05 : .long _ F A U L T / * R e s e r v e d * /
vector06 : .long _ F A U L T / * R e s e r v e d * /
vector07 : .long _ F A U L T / * R e s e r v e d * /
vector08 : .long _ F A U L T / * P r i v i l e g e V i o l a t i o n * /
vector09 : .long _ F A U L T / * T r a c e * /
vector0A : .long _ F A U L T / * U n i m p l e m e n t e d A - L i n e * /
vector0B : .long _ F A U L T / * U n i m p l e m e n t e d F - L i n e * /
vector0C : .long _ F A U L T / * D e b u g I n t e r r u p t * /
vector0D : .long _ F A U L T / * R e s e r v e d * /
vector0E : .long _ F A U L T / * F o r m a t E r r o r * /
vector0F : .long _ F A U L T / * U n i t i a l i z e d I n t . * /
vector02_0F :
.long _ FAULT, _ F A U L T , _ F A U L T , _ F A U L T , _ F A U L T , _ F A U L T
.long _ FAULT, _ F A U L T , _ F A U L T , _ F A U L T , _ F A U L T , _ F A U L T , _ F A U L T , _ F A U L T
/* Reserved */
vector10_17 :
.long _ FAULT, _ F A U L T , _ F A U L T , _ F A U L T , _ F A U L T , _ F A U L T , _ F A U L T , _ F A U L T
vector18 : .long _ F A U L T / * S p u r i o u s I n t e r r u p t * /
vector19 : .long _ F A U L T / * A u t o v e c t o r L e v e l 1 * /
vector1A : .long _ F A U L T / * A u t o v e c t o r L e v e l 2 * /
vector1B : .long _ F A U L T / * A u t o v e c t o r L e v e l 3 * /
vector1C : .long _ F A U L T / * A u t o v e c t o r L e v e l 4 * /
vector1D : .long _ F A U L T / * A u t o v e c t o r L e v e l 5 * /
vector1E : .long _ F A U L T / * A u t o v e c t o r L e v e l 6 * /
vector1F : .long _ F A U L T / * A u t o v e c t o r L e v e l 7 * /
vector18_1F :
.long _ FAULT, _ F A U L T , _ F A U L T , _ F A U L T , _ F A U L T , _ F A U L T , _ F A U L T , _ F A U L T
# if ! d e f i n e d ( C O N F I G _ S E R I A L _ B O O T )
@ -136,12 +121,12 @@ vector192_255:
# if d e f i n e d ( C O N F I G _ S E R I A L _ B O O T )
/* Image header: chksum 4 bytes, len 4 bytes, img dest 4 bytes */
asm_sbf_img_hdr :
.long 0x00000000 /* checksum, not yet implemented */
.long 0x00040000 /* image length */
.long 0x00000000 /* checksum, not yet implemented */
.long 0x00040000 /* image length */
.long CONFIG_SYS_TEXT_BASE /* image to be relocated at */
asm_dram_init :
move. w #0x2700 ,% s r / * M a s k o f f I n t e r r u p t * /
move. w #0x2700 ,% s r / * M a s k o f f I n t e r r u p t * /
# ifdef C O N F I G _ S Y S _ N A N D _ B O O T
/* for assembly stack */
@ -149,7 +134,7 @@ asm_dram_init:
movec % d0 , % R A M B A R 1
move. l #( C O N F I G _ S Y S _ I N I T _ R A M _ A D D R + C O N F I G _ S Y S _ I N I T _ S P _ O F F S E T ) , % s p
clr. l % s p @-
clr. l % s p @-
# endif
# ifdef C O N F I G _ C F _ S B F
@ -160,11 +145,11 @@ asm_dram_init:
movec % d0 , % R A M B A R 1
/* initialize general use internal ram */
move. l #0 , % d0
move. l #( I C A C H E _ S T A T U S ) , % a 1 / * i c a c h e * /
move. l #( D C A C H E _ S T A T U S ) , % a 2 / * d c a c h e * /
move. l % d0 , ( % a1 )
move. l % d0 , ( % a2 )
move. l #0 , % d0
move. l #( I C A C H E _ S T A T U S ) , % a 1 / * i c a c h e * /
move. l #( D C A C H E _ S T A T U S ) , % a 2 / * d c a c h e * /
move. l % d0 , ( % a1 )
move. l % d0 , ( % a2 )
/* invalidate and disable cache */
move. l #( C O N F I G _ S Y S _ I C A C H E _ I N V + C O N F I G _ S Y S _ D C A C H E _ I N V ) , % d 0
@ -176,7 +161,7 @@ asm_dram_init:
movec % d0 , % A C R 3
move. l #( C O N F I G _ S Y S _ I N I T _ R A M _ A D D R + C O N F I G _ S Y S _ I N I T _ S P _ O F F S E T ) , % s p
clr. l % s p @-
clr. l % s p @-
/* Must disable global address */
move. l #0xFC008000 , % a1
@ -185,7 +170,7 @@ asm_dram_init:
move. l #( C O N F I G _ S Y S _ C S 0 _ C T R L ) , ( % a1 )
move. l #0xFC008004 , % a1
move. l #( C O N F I G _ S Y S _ C S 0 _ M A S K ) , ( % a1 )
# endif / * C O N F I G _ C F _ S B F * /
# endif / * C O N F I G _ C F _ S B F * /
# ifdef C O N F I G _ M C F 5 4 4 1 x
/ * TC : enable a l l p e r i p h e r a l s ,
@ -193,9 +178,9 @@ asm_dram_init:
move. l #0xFC04002D , % a1
# if d e f i n e d ( C O N F I G _ C F _ S B F )
move. b #23 , ( % a1 ) / * d s p i * /
move. b #23 , ( % a1 ) / * d s p i * /
# endif
move. b #46 , ( % a1 ) / * D D R * /
move. b #46 , ( % a1 ) / * D D R * /
/* slew settings */
move. l #0xEC094060 , % a1
@ -365,7 +350,7 @@ dramsz_loop:
move. l #2000 , % d1
jsr a s m _ d e l a y
# endif / * C O N F I G _ M C F 5 4 4 5 x * /
# endif / * C O N F I G _ M C F 5 4 4 5 x * /
# ifdef C O N F I G _ C F _ S B F
/ *
@ -484,7 +469,7 @@ asm_dspi_rd_status:
move. b ( % a3 ) , % d1
rts
# endif / * C O N F I G _ C F _ S B F * /
# endif / * C O N F I G _ C F _ S B F * /
# ifdef C O N F I G _ S Y S _ N A N D _ B O O T
/* copy 4 boot pages to dram as soon as possible */
@ -509,13 +494,13 @@ asm_nand_init:
move. l % d1 , ( % a1 )
/* initialize general use internal ram */
move. l #0 , % d0
move. l #( C A C R _ S T A T U S ) , % a 1 / * C A C R * /
move. l #( I C A C H E _ S T A T U S ) , % a 2 / * i c a c h e * /
move. l #( D C A C H E _ S T A T U S ) , % a 3 / * d c a c h e * /
move. l % d0 , ( % a1 )
move. l % d0 , ( % a2 )
move. l % d0 , ( % a3 )
move. l #0 , % d0
move. l #( C A C R _ S T A T U S ) , % a 1 / * C A C R * /
move. l #( I C A C H E _ S T A T U S ) , % a 2 / * i c a c h e * /
move. l #( D C A C H E _ S T A T U S ) , % a 3 / * d c a c h e * /
move. l % d0 , ( % a1 )
move. l % d0 , ( % a2 )
move. l % d0 , ( % a3 )
/* invalidate and disable cache */
move. l #0x01004100 , % d0 / * I n v a l i d a t e c a c h e c m d * /
@ -571,7 +556,7 @@ asm_nand_init:
move. l #4 , % d2 / * s t a r t a t 4 * /
move. l #0xFC0FFF04 , % a0 / * c m d2 * /
move. l #0xFC0FFF0C , % a1 / * r a r * /
move. l #( C O N F I G _ S Y S _ T E X T _ B A S E + 0xF80 ) , % a2 / * d s t * /
move. l #( C O N F I G _ S Y S _ T E X T _ B A S E + 0xF80 ) , % a2
asm_nand_read :
move. l #0x11000000 , % d0 / * r a r * /
@ -621,14 +606,14 @@ asm_delay:
rts
# endif / * C O N F I G _ C F _ S B F | | C O N F I G _ N A N D _ U _ B O O T * /
.text
.text
. = 0 x4 0 0
.globl _start
.globl _start
_start :
# if ! d e f i n e d ( C O N F I G _ S E R I A L _ B O O T )
nop
nop
move. w #0x2700 ,% s r / * M a s k o f f I n t e r r u p t * /
move. w #0x2700 ,% s r / * M a s k o f f I n t e r r u p t * /
/* Set vector base register at the beginning of the Flash */
move. l #C O N F I G _ S Y S _ F L A S H _ B A S E , % d 0
@ -638,11 +623,11 @@ _start:
movec % d0 , % R A M B A R 1
/* initialize general use internal ram */
move. l #0 , % d0
move. l #( I C A C H E _ S T A T U S ) , % a 1 / * i c a c h e * /
move. l #( D C A C H E _ S T A T U S ) , % a 2 / * d c a c h e * /
move. l % d0 , ( % a1 )
move. l % d0 , ( % a2 )
move. l #0 , % d0
move. l #( I C A C H E _ S T A T U S ) , % a 1 / * i c a c h e * /
move. l #( D C A C H E _ S T A T U S ) , % a 2 / * d c a c h e * /
move. l % d0 , ( % a1 )
move. l % d0 , ( % a2 )
/* invalidate and disable cache */
move. l #( C O N F I G _ S Y S _ I C A C H E _ I N V + C O N F I G _ S Y S _ D C A C H E _ I N V ) , % d 0
@ -658,10 +643,10 @@ _start:
# endif
/* put relocation table address to a5 */
move. l #_ _ g o t _ s t a r t , % a 5
move. l #_ _ g o t _ s t a r t , % a 5
/* setup stack initially on top of internal static ram */
move. l #( C O N F I G _ S Y S _ I N I T _ R A M _ A D D R + C O N F I G _ S Y S _ I N I T _ R A M _ S I Z E ) , % s p
move. l #( C O N F I G _ S Y S _ I N I T _ R A M _ A D D R + C O N F I G _ S Y S _ I N I T _ R A M _ S I Z E ) , % s p
/ *
* if c o n f i g u r e d , m a l l o c _ f a r e n a w i l l b e r e s e r v e d f i r s t ,
@ -672,25 +657,26 @@ _start:
jsr ( % a1 )
/* update stack and frame-pointers */
move. l % d0 , % s p
move. l % s p , % f p
move. l % d0 , % s p
move. l % s p , % f p
/* initialize reserved area */
move. l % d0 , - ( % s p )
move. l % d0 , - ( % s p )
move. l #b o a r d _ i n i t _ f _ i n i t _ r e s e r v e , % a 1
jsr ( % a1 )
/* run low-level CPU init code (from flash) */
move. l #c p u _ i n i t _ f , % a 1
jsr ( % a1 )
move. l #c p u _ i n i t _ f , % a 1
jsr ( % a1 )
/* run low-level board init code (from flash) */
clr. l % s p @-
move. l #b o a r d _ i n i t _ f , % a 1
jsr ( % a1 )
move. l #b o a r d _ i n i t _ f , % a 1
jsr ( % a1 )
/* board_init_f() does not return */
/*------------------------------------------------------------------------------ */
/***************************************************************************** */
/ *
* void r e l o c a t e _ c o d e ( a d d r _ s p , g d , a d d r _ m o n i )
@ -703,23 +689,23 @@ _start:
* r5 = l e n g t h i n b y t e s
* r6 = c a c h e l i n e s i z e
* /
.globl relocate_code
.globl relocate_code
relocate_code :
link. w % a6 ,#0
move. l 8 ( % a6 ) , % s p / * s e t n e w s t a c k p o i n t e r * /
link. w % a6 ,#0
move. l 8 ( % a6 ) , % s p / * s e t n e w s t a c k p o i n t e r * /
move. l 1 2 ( % a6 ) , % d0 / * S a v e c o p y o f G l o b a l D a t a p o i n t e r * /
move. l 1 6 ( % a6 ) , % a0 / * S a v e c o p y o f D e s t i n a t i o n A d d r e s s * /
move. l 1 2 ( % a6 ) , % d0 / * S a v e c o p y o f G l o b a l D a t a p o i n t e r * /
move. l 1 6 ( % a6 ) , % a0 / * S a v e c o p y o f D e s t i n a t i o n A d d r e s s * /
move. l #C O N F I G _ S Y S _ M O N I T O R _ B A S E , % a 1
move. l #_ _ i n i t _ e n d , % a 2
move. l % a0 , % a3
move. l #C O N F I G _ S Y S _ M O N I T O R _ B A S E , % a 1
move. l #_ _ i n i t _ e n d , % a 2
move. l % a0 , % a3
/* copy the code to RAM */
1 :
move. l ( % a1 ) + , ( % a3 ) +
cmp. l % a1 ,% a2
bgt. s 1 b
move. l ( % a1 ) + , ( % a3 ) +
cmp. l % a1 ,% a2
bgt. s 1 b
/ *
* We a r e d o n e . D o n o t r e t u r n , i n s t e a d b r a n c h t o s e c o n d p a r t o f b o a r d
@ -749,7 +735,7 @@ clear_bss:
* /
move. l % a0 , % a1
add. l #( _ _ g o t _ s t a r t - C O N F I G _ S Y S _ M O N I T O R _ B A S E ) , % a 1
move. l % a1 ,% a5 / * * f i x g o t p o i n t e r r e g i s t e r a5 * /
move. l % a1 ,% a5 / * f i x g o t p o i n t e r r e g i s t e r a5 * /
move. l % a0 , % a2
add. l #( _ _ g o t _ e n d - C O N F I G _ S Y S _ M O N I T O R _ B A S E ) , % a 2
@ -763,39 +749,40 @@ clear_bss:
bne 7 b
/* calculate relative jump to board_init_r in ram */
move. l % a0 , % a1
add. l #( b o a r d _ i n i t _ r - C O N F I G _ S Y S _ M O N I T O R _ B A S E ) , % a 1
move. l % a0 , % a1
add. l #( b o a r d _ i n i t _ r - C O N F I G _ S Y S _ M O N I T O R _ B A S E ) , % a 1
/* set parameters for board_init_r */
move. l % a0 ,- ( % s p ) / * d e s t _ a d d r * /
move. l % d0 ,- ( % s p ) / * g d * /
move. l % a0 ,- ( % s p ) / * d e s t _ a d d r * /
move. l % d0 ,- ( % s p ) / * g d * /
jsr ( % a1 )
/*------------------------------------------------------------------------------*/
/******************************************************************************/
/* exception code */
.globl _fault
.globl _fault
_fault :
bra _ f a u l t
.globl _exc_handler
bra _ f a u l t
.globl _exc_handler
_exc_handler :
SAVE_ A L L
movel % s p ,% s p @-
bsr e x c _ h a n d l e r
bsr e x c _ h a n d l e r
addql #4 ,% s p
RESTORE_ A L L
.globl _int_handler
.globl _int_handler
_int_handler :
SAVE_ A L L
movel % s p ,% s p @-
bsr i n t _ h a n d l e r
bsr i n t _ h a n d l e r
addql #4 ,% s p
RESTORE_ A L L
/*------------------------------------------------------------------------------ */
/***************************************************************************** */
.globl version_string
.globl version_string
version_string :
.ascii U_ B O O T _ V E R S I O N _ S T R I N G , " \ 0 "
.align 4
.ascii U_ B O O T _ V E R S I O N _ S T R I N G , " \ 0 "
.align 4