Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Altera_Forum
Honored Contributor I
1,568 Views

alt_timestamp() issue!

Hi, 

I am working with Altera Stratix FPGA and NiosII processor. 

In Hello_World program I wanted to check time duration using HAl API alt_timestamp() and alt_timestamp_start(). 

 

i wrote progarm like this: 

# include <stdio.h># include "sys/alt_timestamp.h"# include "alt_types.h" 

 

int main (void) 

 

 

alt_u32 time1; 

 

alt_u32 time2; 

 

alt_timestamp_start(); 

 

time1 = alt_timestamp(); 

 

printf("hello from niosII!\n"); 

 

time2 = alt_timestamp(); 

 

printf("value =%u \n", (unsigned int) (time2-time1)); 

return 0; 

 

 

 

after build it is showing following error: 

 

Info: Linking Hello_World_0.elf 

nios2-elf-g++ -T'../Hello_World_0_bsp/linker.x' -msys-crt0='../Hello_World_0_bsp/obj/HAL/src/crt0.o' -msys-lib=hal_bsp -L../Hello_World_0_bsp -Wl,-Map=Hello_World_0.map -O0 -g -Wall -EL -mno-hw-div -mhw-mul -mno-hw-mulx -o Hello_World_0.elf obj/hello_world.o -lm  

obj/hello_world.o: In function `main': 

D:\Bharani_15RPM\Bharanisp_ep1s80_15rpm_15June2011_v6_50Mhz\software\Hello_World_0/hello_world.c:33: undefined reference to `alt_timestamp_start' 

D:\Bharani_15RPM\Bharanisp_ep1s80_15rpm_15June2011_v6_50Mhz\software\Hello_World_0/hello_world.c:35: undefined reference to `alt_timestamp' 

D:\Bharani_15RPM\Bharanisp_ep1s80_15rpm_15June2011_v6_50Mhz\software\Hello_World_0/hello_world.c:39: undefined reference to `alt_timestamp' 

collect2: ld returned 1 exit status 

make: *** [Hello_World_0.elf] Error 1 

 

 

can anyone tell me what may be expected mistake? 

 

Thanks in advance! 

sblrde
0 Kudos
5 Replies
Altera_Forum
Honored Contributor I
396 Views

Did you remember to add the timer to your timestamp timer settings in the BSP/system library? I don't think it is added automatically for you so you would need to manually set it.

Altera_Forum
Honored Contributor I
396 Views

Thanks a lot it worked!

Altera_Forum
Honored Contributor I
396 Views

Hello, 

I have the same problem. I've found, how to add timer to the syslib settings of nios 9.0 project. 

But how can I do the same for 11.0 project? 

 

Thanks in advance.
Altera_Forum
Honored Contributor I
396 Views

Hey, 

If you want to add a system or timestamp timer you have to rightclick on your bsp folder in your Nios Eclipsle Project, than choose Nios2->BSP Editior 

There you can change your System Timer and Timestamp Timer 

 

Best regards  

 

Tobias
Altera_Forum
Honored Contributor I
396 Views

Thanks a lot!

Reply