/*
Common part of the linker scripts for STR71x devices
Copyright RAISONANCE 2005
You can use, modify and distribute thisfile freely, but without any waranty.
*/


/* Registers mapping */

FLASHR_BASE     = 0x40100000 ;
FLASHPR_BASE    = 0x4010DFB0 ;

EXTMEM_BASE     = 0x60000000 ;
RCCU_BASE       = 0xA0000000 ;
PCU_BASE        = 0xA0000040 ;
APB1_BASE       = 0xC0000000 ;
APB2_BASE       = 0xE0000000 ;
EIC_BASE        = 0xFFFFF800 ;

PROVIDE( _I2C0  = (APB1_BASE + 0x1000) );
PROVIDE( _I2C1  = (APB1_BASE + 0x2000) );
PROVIDE( _UART0 = (APB1_BASE + 0x4000) );
PROVIDE( _UART1 = (APB1_BASE + 0x5000) );
PROVIDE( _UART2 = (APB1_BASE + 0x6000) );
PROVIDE( _UART3 = (APB1_BASE + 0x7000) );
PROVIDE( _CAN   = (APB1_BASE + 0x9000) );
PROVIDE( _BSPI0 = (APB1_BASE + 0xA000) );
PROVIDE( _BSPI1 = (APB1_BASE + 0xB000) );
PROVIDE( _USB   = (APB1_BASE + 0x8800) );

PROVIDE( _XTI   = (APB2_BASE + 0x101C) );
PROVIDE( _GPIO0 = (APB2_BASE + 0x3000) );
PROVIDE( _GPIO1 = (APB2_BASE + 0x4000) );
PROVIDE( _GPIO2 = (APB2_BASE + 0x5000) );
PROVIDE( _ADC12 = (APB2_BASE + 0x7000) );
PROVIDE( _TIM0  = (APB2_BASE + 0x9000) );
PROVIDE( _TIM1  = (APB2_BASE + 0xA000) );
PROVIDE( _TIM2  = (APB2_BASE + 0xB000) );
PROVIDE( _TIM3  = (APB2_BASE + 0xC000) );
PROVIDE( _RTC   = (APB2_BASE + 0xD000) );
PROVIDE( _WDG   = (APB2_BASE + 0xE000) );

PROVIDE( _EMI   = (EXTMEM_BASE + 0x0C000000) );

PROVIDE( _RCCU   = (RCCU_BASE) );

PROVIDE( _PCU   = (PCU_BASE) );


/* default stack sizes. 

These are used by the startup in order to allocate stacks for the different modes.
*/

__SVC_Stack_Size = 256 ;
__IRQ_Stack_Size = 1024 ;
__USR_Stack_Size = 1024 ;
__FIQ_Stack_Size = 256 ;
__ABT_Stack_Size = 256 ;
__UND_Stack_Size = 256 ;

__SVC_Stack_Init = _estack ;
__IRQ_Stack_Init = __SVC_Stack_Init - __SVC_Stack_Size ;
__USR_Stack_Init = __IRQ_Stack_Init - __IRQ_Stack_Size ;
__FIQ_Stack_Init = __USR_Stack_Init - __USR_Stack_Size ;
__ABT_Stack_Init = __FIQ_Stack_Init - __FIQ_Stack_Size ;
__UND_Stack_Init = __ABT_Stack_Init - __ABT_Stack_Size ;

/*"PROVIDE" allows to easily override these values from an object file or the commmand line.*/
PROVIDE ( _SVC_Stack_Init = __SVC_Stack_Init ) ;
PROVIDE ( _IRQ_Stack_Init = __IRQ_Stack_Init ) ;
PROVIDE ( _USR_Stack_Init = __USR_Stack_Init ) ;
PROVIDE ( _FIQ_Stack_Init = __FIQ_Stack_Init ) ;
PROVIDE ( _ABT_Stack_Init = __ABT_Stack_Init ) ;
PROVIDE ( _UND_Stack_Init = __UND_Stack_Init ) ;

/*
the user mode stack is an exception because we want it at the end of the RAM.
therefore, we just check against a minimum.
The value below is the minimum memory required for ALL THE STACKS.
There will be a link error if there is not this amount of RAM free at the end.
*/
_Minimum_Stack_Size = 0xC00 ;



/* default ISR addresses. 

The startup needs these addresses defined from another object file.
In case they are not, these PROVIDEs redirect them to the Reset.

_start must be defined, usually in the startup.
*/

PROVIDE( Undefined_Handler = _start );
PROVIDE( SWI_Handler = _start );
PROVIDE( Prefetch_Handler = _start );
PROVIDE( Abort_Handler = _start );
PROVIDE( FIQ_Handler = _start );
PROVIDE( T0TIMI_IRQHandler = _start );
PROVIDE( FLASH_IRQHandler = _start );
PROVIDE( RCCU_IRQHandler = _start );
PROVIDE( RTC_IRQHandler = _start );
PROVIDE( WDG_IRQHandler = _start );
PROVIDE( XTI_IRQHandler = _start );
PROVIDE( USBHP_IRQHandler = _start );
PROVIDE( I2C0ITERR_IRQHandler = _start );
PROVIDE( I2C1ITERR_IRQHandler = _start );
PROVIDE( UART0_IRQHandler = _start );
PROVIDE( UART1_IRQHandler = _start );
PROVIDE( UART2_IRQHandler = _start );
PROVIDE( UART3_IRQHandler = _start );
PROVIDE( BSPI0_IRQHandler = _start );
PROVIDE( BSPI1_IRQHandler = _start );
PROVIDE( I2C0_IRQHandler = _start );
PROVIDE( I2C1_IRQHandler = _start );
PROVIDE( CAN_IRQHandler = _start );
PROVIDE( ADC12_IRQHandler = _start );
PROVIDE( T1TIMI_IRQHandler = _start );
PROVIDE( T2TIMI_IRQHandler = _start );
PROVIDE( T3TIMI_IRQHandler = _start );
PROVIDE( HDLC_IRQHandler = _start );
PROVIDE( USBLP_IRQHandler = _start );
PROVIDE( T0TOI_IRQHandler = _start );
PROVIDE( T0OC1_IRQHandler = _start );
PROVIDE( T0OC2_IRQHandler = _start );



