[ECOS] crash in call_pending_DSRs_inner when DSR is called (SA1100)
Andrew Lunn
andrew.lunn@ascom.ch
Mon Oct 8 03:29:00 GMT 2001
On Mon, Oct 08, 2001 at 12:18:05PM +0200, Andreas B?rgel wrote:
> I'm working on a I2C-chipcard driver for a custom StrongARM 1100
> platform. Every time the card is changed, an interrupt is fired. But
> instead calling my DSR the cpu jumps into nirvana (but without achieving
> salvation ;). I found the point where all ends up in
> Cyg_Interrupt::call_pending_DSRs_inner(void) in the line
>
> intr->dsr( intr->vector, 1, (CYG_ADDRWORD)intr->data );
>
> to be very precise in the following line of assembly code
>
> ldr pc, [r12, #12]
[...]
> int chipcard_initializeInterrupt () {
> cyg_handle_t lIntrHandle;
> cyg_interrupt lIntr;
> cyg_vector_t lIntrVector;
> cyg_priority_t lIntrPriority;
>
> lIntrPriority = 99;
> lIntrVector = CYGNUM_HAL_INTERRUPT_GPIO2;
>
> cyg_interrupt_create ( lIntrVector,
> lIntrPriority,
> (cyg_addrword_t) gCardContentBuffer,
> chipcard_isrCardChange,
> chipcard_dsrCardChange,
> &lIntrHandle,
> &lIntr);
> cyg_interrupt_attach ( lIntrHandle);
> cyg_interrupt_unmask ( lIntrVector);
> }
>
The problem is you have a local variable for lIntr. The state
information for the interrupt is put into lIntr. The variable intr in
Cyg_Interrupt::call_pending_DSRs_inner(void) is actually your
lIntr. But because you have made is a local variable, it was destroyed
as soon as chipcard_initializeInterrupt() exited. The memory on the
stack has then be used by other function so changing its
contents. Making lIntr a static will be your salvation.
Andrew
More information about the Ecos-discuss
mailing list