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.
12452 Discussions

Can not find file "altera_avalon_timer.h"

Altera_Forum
Honored Contributor II
1,777 Views

Hi Everybody, 

 

I have got the problem when finding the solution to measure performance of C program on NiosII.  

Here is the example code that I have followed an example in Nios II handbook: 

 

# include "sys/alt_timestamp.h" 

# include "alt_types.h" 

int main(void) 

int the; 

double sinLookup[Thetamax]; 

double cosLookup[Thetamax]; 

alt_u32 time1; 

alt_u32 time2; 

time1 = alt_timestamp(); 

//Make a sin and cos lookup-table for performance improvement 

for(the=0;the<Thetamax;the++) 

sinLookup[the] = sin(the*PI/180); 

cosLookup[the] = cos(the*PI/180); 

time2 = alt_timestamp(); 

printf ("time in func1 = %u ticks\n",(unsigned int) (time2 - time1)); 

printf ("Number of ticks per second = %u\n",(unsigned int)alt_timestamp_freq()); 

 

}//main(void) 

 

For Hardware, I added an Interval Timer on SOPC Builder. 

 

The problem happened when I compiled this code to run on Nios. There was three errors:  

 

"/cygdrive/c/altera/11.0sp1/nios2eds/components/altera_hal/HAL/inc/sys/alt_timestamp.h:43:33: altera_avalon_timer.h: No such file or directory" 

 

"undefined reference to `alt_timestamp' " 

 

"undefined reference to `alt_timestamp_freq' " 

 

I have checked on directory "/altera/11.0sp1/nios2eds/components/altera_hal/HAL/inc", the file "altera_avalon_timer.h" does not exist. 

 

 

 

I am using Quartus v11 sp1, Nios II v11 sp1. 

If somebody know what my problem is, could you please show me the solution for this problem ? 

 

Thanks in advance, 

Khai.
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
523 Views

The file altera_avalon_timer.h exists in the directory of the timer component: 

 

C:\altera\11.0sp1\ip\altera\sopc_builder_ip\altera_avalon_timer\HAL\inc 

 

Not sure why it couldn't find it, maybe there is something wrong with your include directories or your project in the Nios II IDE doesn't know that there is a timer instance in your hardware... maybe you have to re-generate the *.ptf / *.sopc files.
Altera_Forum
Honored Contributor II
523 Views

You should add the timer to your timestamp_timer_settings in the BSP/system library: 

SysLib/BSP -> Properties -> System Library -> Timestamp Timer 

This setting is 'none' by default
Reply