i.MX28 Bare Metal Interrupt Handler

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

i.MX28 Bare Metal Interrupt Handler

690 Views
contra
Contributor III

Hi,


I'm creating a bare metal application as Linux or Win CE are way too complex for my application, I'm having a problem getting my interrupt handler to work. I have the Freescale IMX_OBDS project which has a vectors.s file, this contains the exception handlers for the core but does not demonstrate how to action an interrupt exception. I'd be grateful if anyone could provide a code example for this.


IMX_OBDS has exception vector definitions but doesn't use them:

startup_vectors:

        ldr     pc, reset_addr

        ldr     pc, undefined_addr

        ldr     pc, swi_addr

        ldr     pc, prefetch_addr

        ldr     pc, abort_addr

        nop                             /* reserved vector */

        ldr     pc, irq_addr

        ldr     pc, fiq_addr


reset_addr:      .word     startup

undefined_addr:  .word     undefined_handler

swi_addr:        .word     swi_handler

prefetch_addr:   .word     prefetch_handler

abort_addr:      .word     abort_handler

irq_addr:        .word     irq_handler

fiq_addr:        .word     fiq_handler

/*!

* Exception Handlers

*/

undefined_handler:

        b       undefined_handler

swi_handler:

        b       swi_handler

prefetch_handler:

        b       prefetch_handler

abort_handler:

        b       abort_handler

irq_handler:

        b       irq_handler

fiq_handler:

        b       fiq_handler

Labels (1)
0 Kudos
1 Reply

389 Views
AnsonHuang
NXP Employee
NXP Employee

Hi, David

     For interrupt using, I can provide some guides based on my understanding:

     1. Need to copy these interrupt vectors to 0x00000000 or 0xffffffff address, for i.MX28, the interrupt vectors should be on high address which is 0xffffffff, if you enable mmu, this address means virtual address;

     2. As this address is occupied by ROM, so I think you may need to enable MMU, then map other physical address to be vector address;

     3. Enable interrupt controller and module's interrupt.

     To debug it, you can use JTAG to set break point at 0xffff0018 which is irq vector, then when there is an irq pending, PC will stop at here, you can debug it step by step. Maybe you also can refer to uboot's interrupt mode which should be more simple compared to kernel.