EmbDev.net

Forum: ARM programming with GCC/GNU tools AT91SAM7X256 - interrupts doesn't work?


von Tomasz K. (klombi)


Rate this post
useful
not useful
Hi.
I configure interrupts:
  AT91C_BASE_AIC->AIC_IDCR = 0x1 << AT91C_ID_PIOB;
  AT91C_BASE_AIC->AIC_SVR[AT91C_ID_PIOB] = (unsigned long) pio_handler ;
  AT91C_BASE_AIC->AIC_SMR[AT91C_ID_PIOB] =
AT91C_AIC_SRCTYPE_POSITIVE_EDGE|1;
                                          //src_type | priority
  AT91C_BASE_AIC->AIC_ICCR = 0x1 << AT91C_ID_PIOB;
Enable it:
  AT91C_BASE_PIOB->PIO_IER = AT91C_PIO_PB28;
  AT91C_BASE_AIC->AIC_IECR = 0x1 << AT91C_ID_PIOB;

My handler:
  __ramfunc void pio_handler(void)
  {
  AT91F_PIO_SetOutput(AT91C_BASE_PIOA,LED);
  AT91F_AIC_AcknowledgeIt(AT91C_BASE_AIC);
  return;
  }
I can see, that handler is in RAM (in .map file):
  (...)
.data           0x00200000       0xcc load address 0x00101610
                0x00200000                _data = .
 *(.vectram)
 .vectram       0x00200000       0x58 startup_SAM7X.o
 *(.data)
 .data          0x00200058        0x0 startup_SAM7X.o
 .data          0x00200058        0x0 projekt.o
 .data          0x00200058        0x0
c:/winarm/bin/../lib/gcc/arm-elf/4.1.1/thumb/interwork\libgcc.a(_udivsi3 
.o)
 .data          0x00200058        0x0
c:/winarm/bin/../lib/gcc/arm-elf/4.1.1/thumb/interwork\libgcc.a(_divsi3. 
o)
 .data          0x00200058        0x0
c:/winarm/bin/../lib/gcc/arm-elf/4.1.1/thumb/interwork\libgcc.a(_umodsi3 
.o)
 .data          0x00200058        0x0
c:/winarm/bin/../lib/gcc/arm-elf/4.1.1/thumb/interwork\libgcc.a(_dvmd_tl 
s.o)
                0x00200058                . = ALIGN (0x4)
 *(.fastrun)
 .fastrun       0x00200058       0x74 projekt.o
                0x00200058                timer0_c_irq_handler
                0x0020006c                pio_handler
                0x0020009c                sys_handler
                0x00200084                fiq_handler
                0x002000b4                irq_handler
                0x002000cc                . = ALIGN (0x4)
                0x002000cc                _edata = .
                0x002000cc                PROVIDE (edata, .)
  (...)

...but it doesn't work properly.
It seems that ARM reacts for interrupt (the programm stops), but it
doesn't call my handler routine. Led turned on in main programm is not
turned off in handler.
Any idea why it doesn't work??

von Tomasz K. (klombi)


Rate this post
useful
not useful
Tomasz Klonowski wrote:
> Hi.
> (...)


It is working now .. ISRs should be compiled in ARM-mode :)

von Duy-ky N. (duykyng)


Rate this post
useful
not useful
Remember interrupt works ONLY for ARM mode, so do not thumb mode at all.
It may help

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.