STM8中断向量表

// Copyright (c) 2009, Wolver Wang, Innov Inc. R&D Center
// [email protected]
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
//    notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
//    notice, this list of conditions and the following disclaimer in the
//    documentation and/or other materials provided with the distribution.
// 3. All advertising materials mentioning features or use of this software
//    must display the following acknowledgement:
//      This product includes software developed by Wolver Wang.
// 4. The name of the author may not be used to endorse or promote
//    products derived from this software without specific prior
//    written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
///




// Go to Project/settings/linker => select catergory 'input". 
// Here by right click on Segment/section name, you can create 
// a new segment 'UserApp' and then create a section '.usr_tab' 
// under this segment. Then allocate the address to this segment/section. 


// Includes ------------------------------------------------------------------

//----------------------------------------------------------------------------


// Exported macro ------------------------------------------------------------

//----------------------------------------------------------------------------



// Exported types ------------------------------------------------------------

typedef void @near (*interrupt_handler_t)(void);

struct interrupt_vector {
        unsigned int interrupt_instruction;
        interrupt_handler_t interrupt_handler;
};

// Exported functions ------------------------------------------------------- 

extern @near void _stext();                                                                                                                                                                     // startup routine

extern @near @interrupt void TRAP_IRQHandler(void);                                                                // TRAP
extern @near @interrupt void TLI_IRQHandler(void);                                                                        // TLI
extern @near @interrupt void AWU_IRQHandler(void);                                                                        // AWU
extern @near @interrupt void CLK_IRQHandler(void);                                                                        // CLOCK
extern @near @interrupt void EXTI_PORTA_IRQHandler(void);                                        // EXTI PORTA
extern @near @interrupt void EXTI_PORTB_IRQHandler(void);                                        // EXTI PORTB
extern @near @interrupt void EXTI_PORTC_IRQHandler(void);                                        // EXTI PORTC
extern @near @interrupt void EXTI_PORTD_IRQHandler(void);                                        // EXTI PORTD
extern @near @interrupt void EXTI_PORTE_IRQHandler(void);                                        // EXTI PORTE
extern @near @interrupt void CAN_RX_IRQHandler(void);                                                        // CAN RX
extern @near @interrupt void CAN_TX_IRQHandler(void);                                                        // CAN TX/SCE
extern @near @interrupt void SPI_IRQHandler(void);                                                                 // SPI
extern @near @interrupt void TIM1_UPD_OVF_TRG_BRK_IRQHandler(void);// TIM1 UPD/OVF/TRG/BRK
extern @near @interrupt void TIM1_CAP_COM_IRQHandler(void);                                 // TIM1 CAP/COM
extern @near @interrupt void TIM2_UPD_OVF_BRK_IRQHandler(void);                // TIM2 UPD/OVF/BRK
extern @near @interrupt void TIM2_CAP_COM_IRQHandler(void);                                 // TIM2 CAP/COM
extern @near @interrupt void TIM3_UPD_OVF_BRK_IRQHandler(void);                 // TIM3 UPD/OVF/BRK
extern @near @interrupt void TIM3_CAP_COM_IRQHandler(void);                                 // TIM3 CAP/COM
extern @near @interrupt void USART_TX_IRQHandler(void);                                                 // USART TX
extern @near @interrupt void USART_RX_IRQHandler(void);                                                 // USART RX
extern @near @interrupt void I2C_IRQHandler(void);                                                                 // I2C
extern @near @interrupt void LINUART_TX_IRQHandler(void);                                         // LINUART TX
extern @near @interrupt void LINUART_RX_IRQHandler(void);                                         // LINUART RX
extern @near @interrupt void ADC_IRQHandler(void);                                                                 // ADC
extern @near @interrupt void TIM4_UPD_OVF_IRQHandler(void);                                 // TIM4 UPD/OVF
extern @near @interrupt void FLASH_IRQHandler(void);                                                         // FLASH CHECK
extern @near @interrupt void NonHandledInterrupt (void);                                                // Unexpected events


// Exported constants --------------------------------------------------------

// Redirected constant section to usr_tab: 0x8100-0x8180
#pragma section const {usr_tab}
struct interrupt_vector const UserISR_IRQ[32]  = {
        {0x8200, (interrupt_handler_t)_stext},                                                                                                         // reset
        {0x8200, (interrupt_handler_t)TRAP_IRQHandler},                                                                 // trap  - Software interrupt
        {0x8200, (interrupt_handler_t)TLI_IRQHandler},                                                                         // irq0  - External Top Level interrupt (TLI)  
        {0x8200, (interrupt_handler_t)AWU_IRQHandler},                                                                         // irq1  - Auto Wake Up from Halt interrupt   
        {0x8200, (interrupt_handler_t)CLK_IRQHandler},                                                                         // irq2  - Clock Controller interrupt  
        {0x8200, (interrupt_handler_t)EXTI_PORTA_IRQHandler},                                         // irq3  - External interrupt 0 (GPIOA)  
        {0x8200, (interrupt_handler_t)EXTI_PORTB_IRQHandler},                                         // irq4  - External interrupt 1 (GPIOB)  
        {0x8200, (interrupt_handler_t)EXTI_PORTC_IRQHandler},                                         // irq5  - External interrupt 2 (GPIOC)  
        {0x8200, (interrupt_handler_t)EXTI_PORTD_IRQHandler},                                         // irq6  - External interrupt 3 (GPIOD)  
        {0x8200, (interrupt_handler_t)EXTI_PORTE_IRQHandler},                                         // irq7  - External interrupt 4 (GPIOE)  
        {0x8200, (interrupt_handler_t)CAN_RX_IRQHandler},                                                         // irq8  - CAN Rx interrupt  
        {0x8200, (interrupt_handler_t)CAN_TX_IRQHandler},                                                         // irq9  - CAN Tx/ER/SC interrupt  
        {0x8200, (interrupt_handler_t)SPI_IRQHandler},                                                                         // irq10 - SPI End of transfer interrupt
        {0x8200, (interrupt_handler_t)TIM1_UPD_OVF_TRG_BRK_IRQHandler}, // irq11 - TIM1 Update/Overflow/Trigger/Break interrupt
        {0x8200, (interrupt_handler_t)TIM1_CAP_COM_IRQHandler},                                 // irq12 - TIM1 Capture/Compare interrupt
        {0x8200, (interrupt_handler_t)TIM2_UPD_OVF_BRK_IRQHandler},                 // irq13 - TIM2 Update/Overflow/Break interrupt
        {0x8200, (interrupt_handler_t)TIM2_CAP_COM_IRQHandler},                                 // irq14 - TIM2 Capture/Compare interrupt
        {0x8200, (interrupt_handler_t)TIM3_UPD_OVF_BRK_IRQHandler},                 // irq15 - TIM3 Update/Overflow/Break interrupt
        {0x8200, (interrupt_handler_t)TIM3_CAP_COM_IRQHandler},                                 // irq16 - TIM3 Capture/Compare interrupt
        {0x8200, (interrupt_handler_t)USART_TX_IRQHandler},                                                 // irq17 - USART Tx complete interrupt
        {0x8200, (interrupt_handler_t)USART_RX_IRQHandler},                                                 // irq18 - USART Rx interrupt
        {0x8200, (interrupt_handler_t)I2C_IRQHandler},                                                                         // irq19 - I2C interrupt
        {0x8200, (interrupt_handler_t)LINUART_TX_IRQHandler},                                         // irq20 - LINUART Tx interrupt
        {0x8200, (interrupt_handler_t)LINUART_RX_IRQHandler},                                         // irq21 - LINUART Rx interrupt
        {0x8200, (interrupt_handler_t)ADC_IRQHandler},                                                                         // irq22 - ADC end of conversion interrupt
        {0x8200, (interrupt_handler_t)TIM4_UPD_OVF_IRQHandler},                                 // irq23 - TIM4 Update/Overflow interrupt
        {0x8200, (interrupt_handler_t)FLASH_IRQHandler},                                                                 // irq24 - FLASH interrupt
        {0x8200, (interrupt_handler_t)NonHandledInterrupt},                                                 // irq25 - Reserved
        {0x8200, (interrupt_handler_t)NonHandledInterrupt},                                                 // irq26 - Reserved
        {0x8200, (interrupt_handler_t)NonHandledInterrupt},                                                 // irq27 - Reserved
        {0x8200, (interrupt_handler_t)NonHandledInterrupt},                                                 // irq28 - Reserved
        {0x8200, (interrupt_handler_t)NonHandledInterrupt},                                                 // irq29 - Reserved
};

// Restore default section
#pragma section const {}
// System interrupt table: 0x8000-0x8080
struct interrupt_vector const _vectab[] = {
        {0x8200, (interrupt_handler_t)_stext},                                                 // reset
        {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 1)},         // trap  - Software interrupt
        {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 2)},         // irq0  - External Top Level interrupt (TLI)  
        {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 3)},        // irq1  - Auto Wake Up from Halt interrupt   
        {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 4)},        // irq2  - Clock Controller interrupt  
        {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 5)},        // irq3  - External interrupt 0 (GPIOA)  
        {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 6)},        // irq4  - External interrupt 1 (GPIOB)  
        {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 7)},         // irq5  - External interrupt 2 (GPIOC)  
        {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 8)},         // irq6  - External interrupt 3 (GPIOD)  
        {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 9)},         // irq7  - External interrupt 4 (GPIOE)  
        {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 10)}, // irq8  - CAN Rx interrupt  
        {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 11)}, // irq9  - CAN Tx/ER/SC interrupt  
        {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 12)}, // irq10 - SPI End of transfer interrupt
        {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 13)}, // irq11 - TIM1 Update/Overflow/Trigger/Break interrupt
        {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 14)}, // irq12 - TIM1 Capture/Compare interrupt
        {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 15)}, // irq13 - TIM2 Update/Overflow/Break interrupt
        {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 16)}, // irq14 - TIM2 Capture/Compare interrupt
        {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 17)}, // irq15 - TIM3 Update/Overflow/Break interrupt
        {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 18)}, // irq16 - TIM3 Capture/Compare interrupt
        {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 19)}, // irq17 - USART Tx complete interrupt
        {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 20)}, // irq18 - USART Rx interrupt
        {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 21)}, // irq19 - I2C interrupt
        {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 22)}, // irq20 - LINUART Tx interrupt
        {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 23)}, // irq21 - LINUART Rx interrupt
        {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 24)}, // irq22 - ADC end of conversion interrupt
        {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 25)}, // irq23 - TIM4 Update/Overflow interrupt
        {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 26)}, // irq24 - FLASH interrupt
        {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 27)}, // irq25 - Reserved 
        {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 28)}, // irq26 - Reserved 
        {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 29)}, // irq27 - Reserved 
        {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 30)}, // irq28 - Reserved 
        {0x8200, (interrupt_handler_t)(UserISR_IRQ+ 31)}, // irq29 - Reserved 
};


 

你可能感兴趣的:(技术资料转载备份)