Nios® II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Announcements
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.
12409 Discussions

How to get rid of warning: implicit declaration of function 'alt_irq_register'?

Altera_Forum
Honored Contributor II
2,849 Views

Hi all, 

 

I'm working with a nios application and it works but I can't find a way to get rid of this warning. I try to follow the# include files but I keep getting lost. I have a fixed timer (100ms) set up in qsys... called TIMER_0. I've included the following files in main.c: 

 

# include "alt_types.h"# include "io.h"# include "system.h"# include "altera_avalon_timer_regs.h" //for timer# include "sys/alt_irq.h" //for irq ? 

 

The line giving me the error is: 

 

alt_irq_register(TIMER_0_IRQ, 0, timer_isr); 

 

 

Thanks
0 Kudos
5 Replies
Altera_Forum
Honored Contributor II
737 Views

Look at the BSP documentation that was generated when you built your BSP. Check there for alt_irq_register. Assuming you didn't mispell it, that documentation should list what include file(s) you need to include.

Altera_Forum
Honored Contributor II
737 Views

Could you be more specific when you say to look at the documentation that was generated with the BSP please? I see a "summary.html" file but I'm not sure what I'm looking for. 

 

Thanks
Altera_Forum
Honored Contributor II
737 Views

Please have a look at the systems.h inside your BSP and check whether you have a define for "ALT_ENHANCED_INTERRUPT_API_PRESENT". 

 

if it is defined, please have look at <alt_irq.h> and see: 

 

/* 

* alt_ic_isr_register() can be used to register an interrupt handler. If the 

* function is succesful, then the requested interrupt will be enabled upon  

* return. 

*/ 

extern int alt_ic_isr_register(alt_u32 ic_id, 

alt_u32 irq, 

alt_isr_func isr, 

void *isr_context, 

void *flags); 

 

 

if it is not defined, use: 

 

/* 

* alt_irq_register() can be used to register an interrupt handler. If the  

* function is succesful, then the requested interrupt will be enabled upon  

* return. 

*/ 

extern int alt_irq_register (alt_u32 id,  

void* context,  

alt_isr_func handler); 

 

which seems to be used by you, but the define seems to be there... 

 

I hope this helps as starting point. 

 

Kind regards
Altera_Forum
Honored Contributor II
737 Views

ALT_ENHANCED_INTERRUPT_API_PRESENT was defined. I was reading the documentation and it said that alt_irq_register() was deprecated so I changed it to alt_ic_isr_register() a few days ago. I didn't know what to use for "void *isr_context" and "void *flags" so I made them zero. I defined the isr as: void timer_isr(). All warnings went away. Thanks.

Altera_Forum
Honored Contributor II
737 Views

Sorry, my mistake. I was thinking of the SoC chip BSP. The NIOS environment doesn't automatically generate BSP documentation.  

 

For the NIOS, the BSP documentation is in https://www.altera.com/content/dam/altera-www/global/en_us/pdfs/literature/hb/nios2/n2sw_nii5v2.pdf. This is the NIOS II Software development handbook.  

 

You might also want to look at https://www.altera.com/content/dam/altera-www/global/en_us/pdfs/literature/hb/nios2/n2sw_nii52017.pd... which is the documentation for the development environment.
Reply