Hi, I'm trying to start-up the interrupt handling. Herefor I configured Timer0 as IRQ source, and forced an interrupt. But nothing happened. LPC21xx_VICIntSelect = 0x00000000; // all interrupts are 'IRQ' category LPC21xx_VICIntEnClr = 0xFFFFFFFF; // clear alle interrupts LPC21xx_VICIntEnable = IRQ_TIMER_0; // enable IRQ LPC21xx_VICDefVectAddr = (UINT32) DefaultInterrupt; // Default IRQ vector address (for non-vectored irq LPC21xx_VICVectAddr0 = (UINT32) Timer_OnInterrupt; LPC21xx_VICVectCntl0 = 0x00000024; // Timer0 LPC21xx_VICSoftInt = 0x00000010; // bit 4 = Timer0 // force an interrupt - for test purposes Then I realized that the IRQ was disabled by next lines in the crt0.s-file: /* ----------------- */ /* Re-enter SVC mode */ /* ----------------- */ MOV r0, #Mode_SVC /* Setup SVC mode */ ORR r0, r0, #I_Bit /* IRQ is disabled */ ORR r0, r0, #F_Bit /* FIQ is disabled */ MSR CPSR, r0 /* Enter SVC mode */ LDR SP, =SVC_Stack /* Set stack pointer */ But when I don't set the IRQ-disable-bit, then the code crashes somewhere in the main-initialisation-code of the GNU compiler. The PC never gets at @18 (IRQ handler), but at @10 (abourt address) b reset_handler /* @ 0x00 = reset address */ nop /* @ 0x04 = undefined address */ b SWI_handler /* @ 0x08 = SWI address */ nop /* @ 0x0C = prefetch address */ b ABT_handler /* @ 0x10 = abort address */ nop /* @ 0x14 = reserved vector */ /*b IRQ_handler*/ /* @ 0x18 = IRQ address */ LDR PC, [PC, #-0xFF0] /* Vector from VicVECAddr */ b FIQ_handler /* @ 0x1C = FIQ address */ When the lines: ORR r0, r0, #I_Bit /* IRQ is disabled */ ORR r0, r0, #F_Bit /* FIQ is disabled */ are set, the code keeps working normal. When I try to run the code in USER mode, then it crashes always. -Compiler is arm-elf-gcc V2.95.2 -I'm using a Nohau debugger for ARM. My questions are: -What could be wrong? -Can someone provide me example source code for GNU-compiler? -Does the device has to work in user mode, or in service mode? Thanks. Pascal Degryze - Belgium
Message
Problem with interrupts (and crt0.s) using GNU compiler.
2004-03-10 by Pascal Degryze
Attachments
- No local attachments were found for this message.