您的位置: 旅游网 > 时尚

在ARMSYS上进行uClinux内核移植的总结 (3)

发布时间:2019-09-13 20:40:14

如果在Bootloader执行的全过程中都不必响应中断,那么上面的设置已能满足要求。但在我们的ARMSYS上提供了USB下载器,需要用到中断,那么Bootloader必须在同样的地址(0xc000000)处配置自己的二级异常中断矢量表,以便同uClinux兼容。这张表事先存放在 Flash Memory里,引导过程中由Bootloader将其复制到RAM地址0x0C000000,存放矢量表: ;IRQ ==the program put this phrase to 0xc000000ExceptionHanlderBeginb .ldr pc, MyHandleUndef ; HandlerUndef ldr pc, MyHandleSWI ; HandlerSWI ldr pc, MyHandlePabort ; HandlerPabort ldr pc, MyHandleDabort ; HandlerDAbortb . ; HandlerReservedldr pc, MyHandleIRQ ; HandlerIRQldr pc, MyHandleFIQ ; HandlerFIQMyHandleUndef DCD HandleUndef ;reserve a word(32bit)MyHandleSWI DCD HandleSWI MyHandlePabort DCD HandlePabortMyHandleDabort DCD HandleDabortMyHandleIRQ DCD HandleIRQMyHandleFIQ DCD HandleFIQExceptionHanlderEnd建立二级矢量表: ;****************************************************;* Setup IRQ handler *;****************************************************ldr r0,=(_IRQ_BASEADDRESS + 0x100)ldr r2,=_IRQ_BASEADDRESSadd r3,r0, #0x100 0 CMP r0, r3 STRCC r2, [r0], #4;cc:Carry clear;save R2 to R0 address, R0 =R0+ 4。BCC %B0ldr r1,=_IRQ_BASEADDRESS ldr r0,=ExceptionHanlderBegin ;if there isn't 'subs pc,lr,#4' at 0x18, 0x1cldr r3,=ExceptionHanlderEnd0 CMP r0, r3 ;put the vector table at _IRQ_BASEADDRESS(0xc000000)LDRCC r2, [r0], #4STRCC r2, [r1], #4BCC %B0ldr r1,=DIsrIRQ;put the IRQ judge program at _IRQ_BASEADDRESS+0x80(0xc000080) ldr r0,=IsrIRQ ;if there isn't 'subs pc,lr,#4' at 0x18, 0x1cldr r3,=IsrIRQEnd0 CMP r0, r3LDRCC r2, [r0], #4STRCC r2, [r1], #4BCC %B0ldr r1, =MyHandleIRQ ;MyHandleIRQ point to DIsrIRQldr r0, =ExceptionHanlderBeginldr r4, =_IRQ_BASEADDRESS;sub r0, r1, r0add r0, r0,r4ldr r1, =DIsrIRQ str r1, [r0] 定义Handlexxx:^ (_IRQ_BASEADDRESS)HandleReset # 4HandleUndef # 4HandleSWI # 4HandlePabort # 4HandleDabort # 4HandleReserved # 4HandleIRQ # 4HandleFIQ # 4^ (_IRQ_BASEADDRESS+0x80)DIsrIRQ # 4;IntVectorTable^ (_IRQ_BASEADDRESS+0x100)HandleADC # 4HandleRTC # 4HandleUTXD1 # 4HandleUTXD0 # 4HandleSIO # 4HandleIIC # 4HandleURXD1 # 4HandleURXD0 # 4HandleTIMER5 # 4HandleTIMER4 # 4HandleTIMER3 # 4HandleTIMER2 # 4HandleTIMER1 # 4HandleTIMER0 # 4HandleUERR01 # 4HandleWDT # 4HandleBDMA1 # 4HandleBDMA0 # 4HandleZDMA1 # 4HandleZDMA0 # 4HandleTICK # 4HandleEINT4567 # 4HandleEINT3 # 4HandleEINT2 # 4HandleEINT1 # 4HandleEINT0 # 4

将异常中断矢量重构到SDRAM,这样的好处就是可以在其它的功能程序内对中断处理程序的地址任意赋值。为此,我们在44b.h文件中定义: /* ISR */#define pISR_RESET (*(unsigned *)(_IRQ_BASEADDRESS+0x0))#define pISR_UNDEF (*(unsigned *)(_IRQ_BASEADDRESS+0x4))#define pISR_SWI (*(unsigned *)(_IRQ_BASEADDRESS+0x8))#define pISR_PABORT (*(unsigned *)(_IRQ_BASEADDRESS+0xc))#define pISR_DABORT (*(unsigned *)(_IRQ_BASEADDRESS+0x10))#define pISR_RESERVED (*(unsigned *)(_IRQ_BASEADDRESS+0x14))#define pISR_IRQ (*(unsigned *)(_IRQ_BASEADDRESS+0x18))#define pISR_FIQ (*(unsigned *)(_IRQ_BASEADDRESS+0x1c))#define pISR_ADC (*(unsigned *)(_IRQ_BASEADDRESS+0x100))//0x20))#define pISR_RTC (*(unsigned *)(_IRQ_BASEADDRESS+0x104))//0x24))#define pISR_UTXD1 (*(unsigned *)(_IRQ_BASEADDRESS+0x108))//0x28))#define pISR_UTXD0 (*(unsigned *)(_IRQ_BASEADDRESS+0x10c))//0x2c))#define pISR_SIO (*(unsigned *)(_IRQ_BASEADDRESS+0x110))//0x30))#define pISR_IIC (*(unsigned *)(_IRQ_BASEADDRESS+0x114))//0x34))#define pISR_URXD1 (*(unsigned *)(_IRQ_BASEADDRESS+0x118))//0x38))#define pISR_URXD0 (*(unsigned *)(_IRQ_BASEADDRESS+0x11c))//0x3c))#define pISR_TIMER5 (*(unsigned *)(_IRQ_BASEADDRESS+0x120))//0x40))#define pISR_TIMER4 (*(unsigned *)(_IRQ_BASEADDRESS+0x124))//0x44))#define pISR_TIMER3 (*(unsigned *)(_IRQ_BASEADDRESS+0x128))//0x48))#define pISR_TIMER2 (*(unsigned *)(_IRQ_BASEADDRESS+0x12c))//0x4c))#define pISR_TIMER1 (*(unsigned *)(_IRQ_BASEADDRESS+0x130))//0x50))#define pISR_TIMER0 (*(unsigned *)(_IRQ_BASEADDRESS+0x134))//0x54))#define pISR_UERR01 (*(unsigned *)(_IRQ_BASEADDRESS+0x138))//0x58))#define pISR_WDT (*(unsigned *)(_IRQ_BASEADDRESS+0x13c))//0x5c))#define pISR_BDMA1 (*(unsigned *)(_IRQ_BASEADDRESS+0x140))//0x60))#define pISR_BDMA0 (*(unsigned *)(_IRQ_BASEADDRESS+0x144))//0x64))#define pISR_ZDMA1 (*(unsigned *)(_IRQ_BASEADDRESS+0x148))//0x68))#define pISR_ZDMA0 (*(unsigned *)(_IRQ_BASEADDRESS+0x14c))//0x6c))#define pISR_TICK (*(unsigned *)(_IRQ_BASEADDRESS+0x150))//0x70))#define pISR_EINT4567 (*(unsigned *)(_IRQ_BASEADDRESS+0x154))//0x74))#define pISR_EINT3 (*(unsigned *)(_IRQ_BASEADDRESS+0x158))//0x78))#define pISR_EINT2 (*(unsigned *)(_IRQ_BASEADDRESS+0x15c))//0x7c))#define pISR_EINT1 (*(unsigned *)(_IRQ_BASEADDRESS+0x160))//0x80))#define pISR_EINT0 (*(unsigned *)(_IRQ_BASEADDRESS+0x164))//0x84))

例如,我们要使用到Exint4567中断,定义好中断处理程序Meint4567Isr()后,仅需要一条语句: pISR_EINT4567=(int)MEint4567Isr;

就能使中断发生后正确跳转到我们编写的处理程序上。

婴儿便秘的解决方法
小孩发热怎么办
小儿厌食挑食不吃饭怎么办
宝宝烧到39度怎么办
猜你会喜欢的
猜你会喜欢的