飞思卡尔MCU自定义中断向量程序设计

更新时间:2024-06-02 07:54:01 阅读量: 综合文库 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

自定义中断向量的情况说明

#pragma CODE_SEG NON_BANKED // 声明外部中断函数

extern void Timer0_C0(void);

extern void _Startup(void); //Startup routine */

#pragma CODE_SEG NON_BANKED

/* Interrupt section for this module. Placement will be in NON_BANKED area. */ __interrupt void UnimplementedISR(void) //定义在NON_BANKED区 {

asm BGND; // 空的中断函数 }

typedef void (*near tIsrFunc)(void); //定义了函数指针类型

//定义一个函数指针数组中断表,从0xFF80地址开始装载各个中断函数的首地址 const tIsrFunc _vect[] @0xFF80 = /* Interrupt table */ {

UnimplementedISR, /* vector 63 */ UnimplementedISR, /* vector 62 */ UnimplementedISR, /* vector 61 */ UnimplementedISR, /* vector 60 */ UnimplementedISR, /* vector 59 */ UnimplementedISR, /* vector 58 */ UnimplementedISR, /* vector 57 */ UnimplementedISR, /* vector 56 */ UnimplementedISR, /* vector 55 */ UnimplementedISR, /* vector 54 */ UnimplementedISR, /* vector 53 */ UnimplementedISR, /* vector 52 */ UnimplementedISR, /* vector 51 */ UnimplementedISR, /* vector 50 */ UnimplementedISR, /* vector 49 */ UnimplementedISR, /* vector 48 */ UnimplementedISR, /* vector 47 */ UnimplementedISR, /* vector 46 */

UnimplementedISR, /* vector 45 */ UnimplementedISR, /* vector 44 */ UnimplementedISR, /* vector 43 */ UnimplementedISR, /* vector 42 */ UnimplementedISR, /* vector 41 */ UnimplementedISR, /* vector 40 */ UnimplementedISR, /* vector 39 */ UnimplementedISR, /* vector 38 */ UnimplementedISR, UnimplementedISR, UnimplementedISR, UnimplementedISR, UnimplementedISR, UnimplementedISR, UnimplementedISR, UnimplementedISR, UnimplementedISR, UnimplementedISR, UnimplementedISR, UnimplementedISR, UnimplementedISR, UnimplementedISR, UnimplementedISR, UnimplementedISR, UnimplementedISR, UnimplementedISR, UnimplementedISR, UnimplementedISR, UnimplementedISR, UnimplementedISR, UnimplementedISR, UnimplementedISR, UnimplementedISR, UnimplementedISR, UnimplementedISR, UnimplementedISR, /* vector 37 */ /* vector 36 */ /* vector 35 */ /* vector 34 */ /* vector 33 */ /* vector 32 */ /* vector 31 */ /* vector 30 */ /* vector 29 */ /* vector 28 */ /* vector 27 */ /* vector 26 */ /* vector 25 */ /* vector 24 */ /* vector 23 */ /* vector 22 */ /* vector 21 */ /* vector 20 */ /* vector 19 */ /* vector 18 */ /* vector 17 */ /* vector 16 */ /* vector 15 */ /* vector 14 */ /* vector 13 */ /* vector 12 */ /* vector 11 */ /* vector 10 */

UnimplementedISR, /* vector 09 */ Timer0_C0, /* vector 08 */ UnimplementedISR, /* vector 07 */ UnimplementedISR, /* vector 06 */ UnimplementedISR, /* vector 05 */ UnimplementedISR, /* vector 04 */ UnimplementedISR, /* vector 03 */ UnimplementedISR, /* vector 02 */ UnimplementedISR, /* vector 01 */ _Startup /* Reset vector */ };

在编译的时候,假如出现以下的错误提示

ERROR: Vector allocated at absolute address 0xFFFE overlaps with sections placed in segment xxxx

则说明_Startup()函数的绝对地址约束存在二义性。

可以直接打开对应工程文件的PRM文件,将最后的 “VECTOR 0 _Startup ”注释掉。 因为这句话的意思就是值,将_Startup 函数放在 0号中断向量的地方。

而上面我们自己定义的_vect[]表,的最后一个也是_Startup()函数,并且制定了绝对地址。如此一来就和VECTOR 0 _Startup 产生了冲突!

本文来源:https://www.bwwdw.com/article/mxl6.html

Top