[ECOS] Can excessive/intensive serial flow cause stack overflow?

Andrew Lunn andrew@lunn.ch
Thu Jul 3 15:40:00 GMT 2008


On Thu, Jul 03, 2008 at 04:58:52PM +0200, Alexandre wrote:
> Sorry for the spam ...
> This can be useful :
> 
> ***********************************************************************************
> TRACE: intr.cxx            [  86] Cyg_Interrupt::Cyg_Interrupt()
>                                                        {{enter
> 
> TRACE: intr.cxx            [  86] Cyg_Interrupt::Cyg_Interrupt()
>                                                          ((vector=7,
> priority=4, data=40000860, isr=000049ec, dsr=00004a3c))
> 
> TRACE: intr.cxx            [ 109] Cyg_Interrupt::Cyg_Interrupt()
>                                                        }}return void
> 
> TRACE: intr.cxx            [ 452] void Cyg_Interrupt::attach()
>                                                        {{enter
> 
> ASSERT FAIL: <1>lpc2xxx_misc.c[472]hal_interrupt_set_level() Priority
> already used by another vector
> 
> ASSERT FAIL: lpc2xxx_misc.c      [ 472] hal_interrupt_set_level()
>                                                              Priority
> already used by another vector

Duh... Didn't read the message correctly, so missed the obvious problem....

I thought vector, then the problem is priority.....

This is easy to explain. The actual serial driver is in
/packages/devs/serial/generic/16x5x/current/src.

It registers the interrupt handler with:

        cyg_drv_interrupt_create(ser_chan->int_num,
                                 CYG_IO_SERIAL_GENERIC_16X5X_INT_PRIORITY,
                                 (cyg_addrword_t)chan,
                                 pc_serial_ISR,
                                 pc_serial_DSR,
                                 &ser_chan->serial_interrupt_handle,
                                 &ser_chan->serial_interrupt);

The priority is hard coded for all serial devices as 4. 

You can sort of override this. The same file says:

#ifndef CYG_IO_SERIAL_GENERIC_16X5X_INT_PRIORITY
# define CYG_IO_SERIAL_GENERIC_16X5X_INT_PRIORITY 4
#endif

but you don't appear to be able to override it per device, just for
all devices. So i think you are not going to be able to benefit from
vectored interrupts and will have to use a priority of 16. Or you need
to have the serial driver to allow you to specify a priority level per
device.

Humm, actually, you could do something a little horrible like:

#define  CYG_IO_SERIAL_GENERIC_16X5X_INT_PRIORITY \
         (ser_chan->int_num == CYGNUM_HAL_INTERRUPT_UART0 ? 4 : 5)

in arm_lpc2xxx_ser.inl 

         Andrew


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss



More information about the Ecos-discuss mailing list