Altera_Forum
Honored Contributor
14 years agoUnresolved Inclusion, priv
Good day forum People
I am a total noob to nios2. I am trying to run a uart IRQ but because of an unresolved inclusion: My main c files code is:# include "system.h"# include "altera_avalon_uart_regs.h"# include "sys/alt_irq.h"# include <stdio.h># include "altera_avalon_pio_regs.h"# include <alt_types.h>
# define RX_BUFFER_SIZE 1024
unsigned char rx_buffer;
void IsrUart()
{
IOWR_ALTERA_AVALON_UART_TXDATA(UART_BASE,0x03);
int sr;
IOWR_ALTERA_AVALON_PIO_DATA(OUT_8PIO_BASE,0x2);
sr = IORD_ALTERA_AVALON_UART_STATUS(UART_BASE);
if(sr & ALTERA_AVALON_UART_STATUS_RRDY_MSK)
{
rx_buffer=IORD_ALTERA_AVALON_UART_RXDATA(UART_BASE);
}
IOWR_ALTERA_AVALON_UART_RXDATA(UART_BASE,rx_buffer);
if (rx_buffer==0x55)
IOWR_ALTERA_AVALON_PIO_DATA(OUT_8PIO_BASE,rx_buffer);
}
void InitUart()
{
IOWR_ALTERA_AVALON_UART_TXDATA(UART_BASE,0x02);
int context_uart;
alt_irq_register(UART_IRQ,&context_uart,IsrUart);
alt_irq_enable (UART_IRQ);
}
int main(void)
{
IOWR_ALTERA_AVALON_UART_TXDATA(UART_BASE,0x01);
InitUart();
IOWR_ALTERA_AVALON_PIO_DATA(OUT_8PIO_BASE,0x00);
while(1)
{
usleep(1000000);
IOWR_ALTERA_AVALON_UART_TXDATA(UART_BASE,0x11);
}
return 0;
}Every time I try to build it I get the error: undefined reference to `alt_irq_enable' I've traced it all the way through alt_irq.h and found that the function is declared in alt_legacy_irq.h which is included in alt_irq. If I manually go and get this file and included it the error goes away but my interrupt never gets executed. Any help would be much appreciated.