Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++

alt_timestamp() issue!

Altera_Forum
Honored Contributor II
2,881 Views

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 II
1,709 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.

0 Kudos
Altera_Forum
Honored Contributor II
1,709 Views

Thanks a lot it worked!

0 Kudos
Altera_Forum
Honored Contributor II
1,709 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.
0 Kudos
Altera_Forum
Honored Contributor II
1,709 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
0 Kudos
Altera_Forum
Honored Contributor II
1,709 Views

Thanks a lot!

0 Kudos
Reply