[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Forced Linking
From: |
Tvrtko A. Ursulin |
Subject: |
Re: [avr-gcc-list] Forced Linking |
Date: |
Fri, 7 Mar 2003 00:27:59 +0100 |
User-agent: |
KMail/1.4.3 |
On Thursday 06 March 2003 22:47, Keith Gudger wrote:
> I have some AVR interrupt routines in an archive file. When I run the
> linker, they get left out, as nothing in my source files refers to them.
> Obviously, the linked code doesn't work.
> Any ideas? Thanks.
There usually must be some code which initializes interrupt in question. I
have solved that problem by putting that function in the same source file as
the interrupt handler. In that way it is linked in if application calls the
initialization function - which it really must do to use it.
For example here is a snippet from my serial.c:
void serial_init(void)
{
fifo_init((struct fifo
*)&serial.rx_fifo,SERIAL_RX_FIFO,&serial.rx_buffer[0]);
fifo_init((struct fifo
*)&serial.tx_fifo,SERIAL_TX_FIFO,&serial.tx_buffer[0]);
INIT_WAIT_QUEUE(serial.receive_q);
INIT_WAIT_QUEUE(serial.transmit_q);
}
IRQ(SIG_UART_RECV)
{
if ( serial_rx_space() )
{
#ifdef CONFIG_SERIAL_OPTIMIZED
_fifo_push((struct fifo *)&serial.rx_fifo,inp(UDR));
#else
fifo_push((struct fifo *)&serial.rx_fifo,inp(UDR));
#endif
}
wake_up(&serial.receive_q);
}