;****************************************************************************************************************************************** 
; 文件名称:    system_SWM120.s
; 功能说明:    SWM120单片机的启动文件
; 技术支持:    http://www.synwit.com.cn/e/tool/gbook/?bid=1
; 注意事项:
; 版本日期: V1.0.0        2012年10月30日
; 升级记录: 
;
;
;******************************************************************************************************************************************
; @attention
;
; THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH CODING INFORMATION 
; REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS A RESULT, SYNWIT SHALL NOT BE HELD LIABLE 
; FOR ANY DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT 
; OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION CONTAINED HEREIN IN CONN-
; -ECTION WITH THEIR PRODUCTS.
;
; COPYRIGHT 2012 Synwit Technology
;******************************************************************************************************************************************


; Sram Switch Configuration
;             Code Size (in Bytes)          Sram Size (in Bytes)
;    0            16k    (0x0-0x3FFF)            2k (0x20000000-0x200007FF)
;    1            14k    (0x0-0x37FF)            4k (0x20000000-0x20000FFF)
;    2            12k    (0x0-0x2FFF)            6k (0x20000000-0x200017FF)
;    3          17.5k (0x0-0x45FF)          0.5k (0x20000000-0x200001FF)
;    other        16k                            2k 

SRAM_SWITCH        EQU     1;    

; Encryption Configuration
;   0xABCD1234    :   SWD cannot be used    
;    other            SWD can be used

ENCRYPT_FLAG    EQU     0;



        MODULE  ?cstartup

        ;; Forward declaration of sections.
        SECTION CSTACK:DATA:NOROOT(3)

        SECTION .intvec:CODE:NOROOT(2)

        EXTERN  __iar_program_start
        PUBLIC  __vector_table

        DATA
__vector_table
        DCD     sfe(CSTACK)
        DCD     Reset_Handler             ; Reset Handler
        DCD     NMI_Handler               ; NMI Handler
        DCD     HardFault_Handler         ; Hard Fault Handler
        DCD     0                         ; Reserved
        DCD     0                         ; Reserved
        DCD     0                         ; Reserved
        DCD     ENCRYPT_FLAG              ; Encryption flag
        DCD     0                          ; Reserved
        DCD     0                         ; Reserved
        DCD     SRAM_SWITCH               ; Switch sram
        DCD     SVC_Handler               ; SVCall Handler
        DCD     0                         ; Reserved
        DCD     0                         ; Reserved
        DCD     PendSV_Handler            ; PendSV Handler
        DCD     SysTick_Handler           ; SysTick Handler

        ; External Interrupts
        DCD     GPIO0_Handler           
        DCD     GPIO1_Handler           
        DCD     BOD_Handler             
        DCD     WDT_Handler          
        DCD     TIMER0_Handler          
        DCD     PWM_Handler             
        DCD     ADC_Handler             
        DCD     Default_Handler         
        DCD     UART_Handler            
        DCD     SSI_Handler             
        DCD     Default_Handler       
        DCD     TIMER1_Handler        
        DCD     GPIO2_Handler         
        DCD     GPIO3_Handler         
        DCD     GPIO4_Handler         
        DCD     GPIO5_Handler         
        DCD     GPIO6_Handler         
        DCD     GPIO7_Handler         
        DCD     TIMER2_Handler        
        DCD     TIMER3_Handler        
        DCD     Default_Handler       
        DCD     Default_Handler       
        DCD     GPIO8_Handler         
        DCD     GPIO9_Handler         
        DCD     GPIO10_Handler        
        DCD     GPIO11_Handler        
        DCD     Default_Handler       
        DCD     Default_Handler       
        DCD     Default_Handler       
        DCD     Default_Handler       
        DCD     PID_Handler           



        THUMB

        PUBWEAK Reset_Handler
        SECTION .text:CODE:REORDER:NOROOT(2)
Reset_Handler
        LDR     R0, =__iar_program_start
        BX      R0
        
        PUBWEAK NMI_Handler
        SECTION .text:CODE:REORDER:NOROOT(1)
NMI_Handler
        B NMI_Handler

        PUBWEAK HardFault_Handler
        SECTION .text:CODE:REORDER:NOROOT(1)
HardFault_Handler
        B HardFault_Handler

        PUBWEAK SVC_Handler
        SECTION .text:CODE:REORDER:NOROOT(1)
SVC_Handler
        B SVC_Handler

        PUBWEAK PendSV_Handler
        SECTION .text:CODE:REORDER:NOROOT(1)
PendSV_Handler
        B PendSV_Handler

        PUBWEAK SysTick_Handler
        SECTION .text:CODE:REORDER:NOROOT(1)
SysTick_Handler
        B SysTick_Handler

        PUBWEAK GPIO0_Handler
        SECTION .text:CODE:REORDER:NOROOT(1)
GPIO0_Handler
        B GPIO0_Handler

        PUBWEAK GPIO1_Handler
        SECTION .text:CODE:REORDER:NOROOT(1)
GPIO1_Handler
        B GPIO1_Handler

        PUBWEAK BOD_Handler
        SECTION .text:CODE:REORDER:NOROOT(1)
BOD_Handler
        B BOD_Handler

        PUBWEAK WDT_Handler
        SECTION .text:CODE:REORDER:NOROOT(1)
WDT_Handler
        B WDT_Handler

        PUBWEAK TIMER0_Handler
        SECTION .text:CODE:REORDER:NOROOT(1)
TIMER0_Handler
        B TIMER0_Handler

        PUBWEAK PWM_Handler
        SECTION .text:CODE:REORDER:NOROOT(1)
PWM_Handler
        B PWM_Handler

        PUBWEAK ADC_Handler
        SECTION .text:CODE:REORDER:NOROOT(1)
ADC_Handler
        B ADC_Handler

        PUBWEAK UART_Handler
        SECTION .text:CODE:REORDER:NOROOT(1)
UART_Handler
        B UART_Handler

        PUBWEAK SSI_Handler
        SECTION .text:CODE:REORDER:NOROOT(1)
SSI_Handler
        B SSI_Handler

        PUBWEAK TIMER1_Handler
        SECTION .text:CODE:REORDER:NOROOT(1)
TIMER1_Handler
        B TIMER1_Handler

        PUBWEAK GPIO2_Handler
        SECTION .text:CODE:REORDER:NOROOT(1)
GPIO2_Handler
        B GPIO2_Handler

        PUBWEAK GPIO3_Handler
        SECTION .text:CODE:REORDER:NOROOT(1)
GPIO3_Handler
        B GPIO3_Handler

        PUBWEAK GPIO4_Handler
        SECTION .text:CODE:REORDER:NOROOT(1)
GPIO4_Handler
        B GPIO4_Handler

        PUBWEAK GPIO5_Handler
        SECTION .text:CODE:REORDER:NOROOT(1)
GPIO5_Handler
        B GPIO5_Handler

        PUBWEAK GPIO6_Handler
        SECTION .text:CODE:REORDER:NOROOT(1)
GPIO6_Handler
        B GPIO6_Handler

        PUBWEAK GPIO7_Handler
        SECTION .text:CODE:REORDER:NOROOT(1)
GPIO7_Handler
        B GPIO7_Handler

        PUBWEAK TIMER2_Handler
        SECTION .text:CODE:REORDER:NOROOT(1)
TIMER2_Handler
        B TIMER2_Handler

        PUBWEAK TIMER3_Handler
        SECTION .text:CODE:REORDER:NOROOT(1)
TIMER3_Handler
        B TIMER3_Handler

        PUBWEAK GPIO8_Handler
        SECTION .text:CODE:REORDER:NOROOT(1)
GPIO8_Handler
        B GPIO8_Handler

        PUBWEAK GPIO9_Handler
        SECTION .text:CODE:REORDER:NOROOT(1)
GPIO9_Handler
        B GPIO9_Handler

        PUBWEAK GPIO10_Handler
        SECTION .text:CODE:REORDER:NOROOT(1)
GPIO10_Handler
        B GPIO10_Handler

        PUBWEAK GPIO11_Handler
        SECTION .text:CODE:REORDER:NOROOT(1)
GPIO11_Handler
        B GPIO11_Handler

        PUBWEAK PID_Handler
        SECTION .text:CODE:REORDER:NOROOT(1)
PID_Handler
        B PID_Handler

        PUBWEAK Default_Handler
        SECTION .text:CODE:REORDER:NOROOT(1)
Default_Handler
        B Default_Handler
        
        
        END
