您的位置 首页 芯闻

ARM中止函数界说

ARM的中断函数是在startup code中定义的,在CODE区分配中断向量表时,及将中断函数定义出了; Vector Table Mapped to Address 0 at ResetAREA

ARM中止函数是在startup code中界说的,在CODE区分配中止向量表时,及将中止函数界说出了

; Vector Table Mapped to Address 0 at Reset

AREA RESET, DATA, READONLY

EXPORT __Vectors

__Vectors DCD __initial_sp ; Top of Stack

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 0 ; Reserved

DCD 0 ; Reserved

DCD 0 ; Reserved

DCD 0 ; Reserved

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_IRQHandler ; GPIO P0 Interrupt

DCD GPIO1_IRQHandler ; GPIO P1 Interrupt

DCD GPIO2_IRQHandler ; GPIO P2 Interrupt

DCD GPIO3_IRQHandler ; GPIO P3 Interrupt

DCD GPIO4_IRQHandler ; GPIO P4 Interrupt

DCD CP_IRQHandler ; Capture/PWM

DCD ADC_IRQHandler ; A/D Converter

DCD Reserved_IRQHandler ; Reserved

DCD Reserved_IRQHandler ; Reserved

DCD Reserved_IRQHandler ; Reserved

DCD Reserved_IRQHandler ; Reserved

DCD Reserved_IRQHandler ; Reserved

DCD Reserved_IRQHandler ; Reserved

DCD Reserved_IRQHandler ; Reserved

DCD Reserved_IRQHandler ; Reserved

DCD UART0_IRQHandler ; UART0

DCD UART1_IRQHandler ; UART1

DCD UART2_IRQHandler ; UART2

DCD UART3_IRQHandler ; UART3

DCD TIMER0_IRQHandler ; Timer0

DCD TIMER1_IRQHandler ; Timer1

DCD TIMER1_IRQHandler ; Timer1

DCD TIMER2_IRQHandler ; Timer2

DCD TIMER3_IRQHandler ; Timer3

DCD WDT_IRQHandler ; Watchdog timer

DCD I2C0_IRQHandler ; I2C0

DCD I2C1_IRQHandler ; I2C1

DCD SSP0_IRQHandler ; SSP0

DCD SSP1_IRQHandler ; SSP1

DCD TIMER01_IRQHandler ; Timer0 Timer1

DCD TIMER23_IRQHandler ; Timer2 Timer3

DCD Reserved_IRQHandler ; Reserved

DCD Reserved_IRQHandler ; Reserved

AREA |.text|, CODE, READONLY

不同芯片有各自的startup code,所以界说不同。

在startup code中界说的中止函数都是[weak]特点,假如编译器在其他文件中发现相同的函数名,则在链接时用别处的地址进行链接。

所以只要在工程的详细位置,按startup code中界说的称号直接完好该函数即可,不用在特别声明和与中止向量号联系起来。

Default_Handler PROC

EXPORT GPIO0_IRQHandler [WEAK]

EXPORT GPIO1_IRQHandler [WEAK]

EXPORT GPIO2_IRQHandler [WEAK]

EXPORT GPIO3_IRQHandler [WEAK]

EXPORT GPIO4_IRQHandler [WEAK]

EXPORT CP_IRQHandler [WEAK]

EXPORT ADC_IRQHandler [WEAK]

EXPORT SSP0RXINT_IRQHandler [WEAK]

EXPORT SSP0TXINT_IRQHandler [WEAK]

EXPORT SSP0RORINT_IRQHandler [WEAK]

EXPORT SSP0RTINT_IRQHandler [WEAK]

EXPORT SSP1RXINT_IRQHandler [WEAK]

EXPORT SSP1TXINT_IRQHandler [WEAK]

EXPORT SSP1RORINT_IRQHandler [WEAK]

EXPORT SSP1RTINT_IRQHandler [WEAK]

EXPORT UART0_IRQHandler [WEAK]

EXPORT UART1_IRQHandler [WEAK]

EXPORT UART2_IRQHandler [WEAK]

EXPORT UART3_IRQHandler [WEAK]

EXPORT TIMER0_IRQHandler [WEAK]

EXPORT TIMER1_IRQHandler [WEAK]

EXPORT TIMER2_IRQHandler [WEAK]

EXPORT TIMER3_IRQHandler [WEAK]

EXPORT WDT_IRQHandler [WEAK]

EXPORT I2C0_IRQHandler [WEAK]

EXPORT I2C1_IRQHandler [WEAK]

EXPORT SSP0_IRQHandler [WEAK]

EXPORT SSP1_IRQHandler [WEAK]

EXPORT TIMER01_IRQHandler [WEAK]

EXPORT TIMER23_IRQHandler [WEAK]

在详细的.c文件中

/*———————————————————————————————————*/

/* Interrupt Handler */

/* Interrupt Handler */

/*———————————————————————————————————*/

void I2C0_IRQHandler(void)

{

uint32_t status;

status = I2C0->STAT;

switch (status)

{

/* Arbitration loss */

case 0x38:

if (I2CHandler[0].ArbitLossCallBackFn)

I2CHandler[0].ArbitLossCallBackFn(status);

break;

/* Bus error */

case 0x00:

if (I2CHandler[0].BusErrCallBackFn)

I2CHandler[0].BusErrCallBackFn(status);

break;

default:

if (I2CHandler[0].I2CCallBackFn)

I2CHandler[0].I2CCallBackFn(status);

break;

}

}

声明:本文内容来自网络转载或用户投稿,文章版权归原作者和原出处所有。文中观点,不代表本站立场。若有侵权请联系本站删除(kf@86ic.com)https://www.86ic.net/news/xinwen/137451.html

为您推荐

联系我们

联系我们

在线咨询: QQ交谈

邮箱: kf@86ic.com

关注微信
微信扫一扫关注我们

微信扫一扫关注我们

返回顶部