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++

timestamp

Altera_Forum
Honored Contributor II
2,771 Views

http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/biggrin.gif http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/biggrin.gif http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/biggrin.gif  

hello to everybody  

i would like to use timestamp to monitoring my application time. 

In sopc builder i set timer 1 msec . 

I follow documents and then i include the header file such as the documents 

told me. 

but when i compile to download exe file (.elf ) occur a console warning that  

tell me is notpossible to find header file . 

Very strange . 

Somebody already use this function? 

thanks for helps  

ciao  

walter
0 Kudos
14 Replies
Altera_Forum
Honored Contributor II
1,188 Views

Could you post the warning message you are seeing? 

 

--chris 

 

 

--- Quote Start ---  

originally posted by pmicro@Jun 26 2006, 06:27 PM 

http://forum.niosforum.com/work2/style_emoticons/<#emo_dir#>/biggrin.gif   http://forum.niosforum.com/work2/style_emoticons/<#emo_dir#>/biggrin.gif   http://forum.niosforum.com/work2/style_emoticons/<#emo_dir#>/biggrin.gif  

hello to everybody  

i would like to use timestamp to monitoring my application time. 

in sopc builder i set timer 1 msec . 

i follow documents and then i include the header file such as the documents 

told me. 

but when i compile to download exe file  (.elf ) occur a console  warning that  

tell me is notpossible to find header file . 

very strange . 

somebody already use this  function? 

thanks for helps  

ciao  

walter 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=16409) 

--- quote end ---  

 

--- Quote End ---  

0 Kudos
Altera_Forum
Honored Contributor II
1,188 Views

#include "sys/alt_timestamp.h"# include "my_app.h" 

 

alt_u32 time1; 

alt_u32 time2; 

 

int main(void) 

 

if(alt_timestamp_start()<0) 

printf("No timestamp device aviable\n"); 

else 

time1=alt_timestamp(); 

 

while (1) 

....................... //my application  

........................//my application  

time2=alt_timestamp(); 

 

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

 

}  

 

 

"undefined reference to &#39; alt_timestamp_start &#39; undefined reference to  

&#39; alt_timestamp&#39;  

 

In effects these functions are not in the file "sys/alt_timestamp.h" 

but i found them in the file "altera_avalon_timer_ts .c " 

I try also to include this file but nothing  

I cannot understand  

http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/sad.gif http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/sad.gif http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/sad.gif
0 Kudos
Altera_Forum
Honored Contributor II
1,188 Views

Have you defined the timestamp timer in the IDE (checkbox on the System Library properties page)? The timestamp functions do not make use of the system clock timer.

0 Kudos
Altera_Forum
Honored Contributor II
1,188 Views

could you be clearer? 

Please explain to me exactly informations about your question slacker 

thanks http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/wink.gif  

walter
0 Kudos
Altera_Forum
Honored Contributor II
1,188 Views

Do you have a "Timestamp timer" defined on the System Library properties page? If you do not, or don&#39;t know what I&#39;m referring to, please go look at this page (in the IDE).  

 

The timestamp functions will not be compiled into your System Library unless you have one selected/defined.
0 Kudos
Altera_Forum
Honored Contributor II
1,188 Views

these are the declarations related to the timer.  

In sopc builder I have setted as from manual, but here in the file  

result me "none".You can see at the end of file  

# define SYSTEM_TIMER_NAME "/dev/system_timer"# define SYSTEM_TIMER_TYPE "altera_avalon_timer"# define SYSTEM_TIMER_BASE 0x00900800# define SYSTEM_TIMER_IRQ 1# define SYSTEM_TIMER_ALWAYS_RUN 0# define SYSTEM_TIMER_FIXED_PERIOD 1# define SYSTEM_TIMER_SNAPSHOT 1# define SYSTEM_TIMER_PERIOD 1# define SYSTEM_TIMER_PERIOD_UNITS "ms"# define SYSTEM_TIMER_RESET_OUTPUT 0# define SYSTEM_TIMER_TIMEOUT_PULSE_OUTPUT 0# define SYSTEM_TIMER_MULT 0.001# define SYSTEM_TIMER_FREQ 50000000 

# define ALT_SYS_CLK SYSTEM_TIMER# define ALT_TIMESTAMP_CLK none# define ALT_MAX_FD 32 

 

I follow instruction from manual . 

It&#39;s possible make some change in this file , without regenerate in sopc  

and compile in quartus II ? 

If not , how i have to set flags in sopc builder ? 

thanks for the answers  

ciao  

walter
0 Kudos
Altera_Forum
Honored Contributor II
1,188 Views

Walter, 

 

I&#39;d advocate having two timers in your SOPC Builder system, one for the system clock timer and one timestamp timer. 

 

The reason your design is failing is 

 

#define ALT_TIMESTAMP_CLK none 

 

Unless your SOPC Builder system has two timers, already, you&#39;ll have to add another one and re-generate/re-compile. You could also use the "system_timer" timer as your timestamp clock, but then you wouldn&#39;t have a system clock timer, and I don&#39;t advocate that! 

 

Both the full_featured and standard "examples" have timestamp timers as well as system clock timers. You should change your SOPC Builder design so that it does too. 

 

The key part, that you missed, is that you&#39;ve got to make sure your System Library properties are properly configured, prior to compiling your application. A quick browse through the Nios II IDE online help yields 

 

Timestamp timer - Associates the timestamp driver to a timer device in the SOPC Builder system. The Timestamp timer and the Periodic system timer cannot specify the same physical device. 

 

Unless you have a gigantic system, adding an additional timer to it shouldn&#39;t add more than a few seconds of generation/compilation time. 

 

Best of luck, 

 

- slacker
0 Kudos
Altera_Forum
Honored Contributor II
1,188 Views

yesterday i also add a new timer  

Generate system and ricompile in quartus II 

but in the system.h file i only read a new timer added , while the last lines at the end of file was the same  

"none2 . 

http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/sad.gif  

p.s. if i set "Writebke period " flag i loose full featured option 

I have to not set this flag from the manual if i want to use  

timestamp 

It&#39;s very uncredible , every little thing became big in this system  

To use timestamp is very easy from the manual , but what a have to do  

is not possible to know  

http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/dry.gif
0 Kudos
Altera_Forum
Honored Contributor II
1,188 Views

Yes... the default for Timestamp timer, in the System Library Properties page, is none. The build process, used by the IDE, will not (cannot, could not) automagically detect your new timer, you have to tell it to include the timestamp timer, by setting on the System Library properties page. 

 

The timestamp timer does, by the way, work. You just have to understand how important the System Library properties page is to the build process. 

 

Cheers, 

 

- slacker
0 Kudos
Altera_Forum
Honored Contributor II
1,188 Views

yes i know  

when i build a system in NIOS II IDE , the compiler take the system  

.ptf , after quartus II compile , and after sopv builder generate. 

So during building , IDE produce system. h , usiing address base specified in sopc  

builder , and map all register of all component used . 

Anyway , i posted the system.h above , and then i added a new timer  

in cops builder , generate , update in quartus II and "start compilation " again . 

After that in NIOS II IDE i build or rebuild all . 

In the system.h file appear a new timer , but the last three lines about  

timestamp remains the same . 

At the end i cannot understand what to do , really ...... 

http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/sad.gif http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/sad.gif http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/sad.gif  

I saw all documentation files , but they only explain how to use timestamp  

with some sample codes . 

they explain that it&#39;s possible to use timer driver in two ways , like timestamp or 

system timer and how to set the flags property page in sopc builder ... 

...nothing else  

Tomorrow i try to use my oscilloscope connected to the pc and set one output  

port bit in the beginner and reset at the end of my program  

And after try to understand the cycle time . 

http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/blink.gif
0 Kudos
Altera_Forum
Honored Contributor II
1,188 Views

Ok... here&#39;s the step-by-step for changing your syslib properties: 

 

1. Right-click on your project, in the IDE, and select "System Library Properties" 

or right-click on your System Library project and select "Properties". 

2. Change "Timestamp timer:" from "None" to whatever your new timer&#39;s name. 

- Take a look at any full_featured design&#39;s "high_res_timer" to see how to properly configure an interval timer in SOPC Builder. 

3. Click OK to apply the changes. 

4. Rebuild your project, and you should see the correct timestamp# def&#39;s. in your system.h file. 

 

Hopefully, that will get you where you want to go. 

 

BTW, both the Dhrystone software example and the software for the custom instruction tutorial make use of timestamp timers. Perhaps, you could refer to these example, in their entirety, prior to moving forward with your development? 

 

Cheers, 

 

- slacker
0 Kudos
Altera_Forum
Honored Contributor II
1,188 Views

CORRECT !!! http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/smile.gif  

I try to write TIMER_0 (my second timer in system) direct in the file  

instead "none" , but after generation IDE overwrite with "none" again. 

So i try as you suggest , because i saw the post later , 

and IDE compile correct . 

After that my code was compiled successfully. 

I change period from ms to us but the result is 0 (us) 

NIOS II is the faster system that i never see . 

http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/biggrin.gif  

Maybe there is other little problem because alt_timestamp return  

alwais 0 . 

...mmmmmmmmmmmmmm http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/dry.gif  

Otherwise , Slacker , thank you for your interest  

you are very nice  

http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/wink.gif  

Now i want to check why doesn&#39;t work properly  

have a good night (for me &#39;cause in italy now it&#39;s 1.30 ) 

ciao  

walter
0 Kudos
Altera_Forum
Honored Contributor II
1,188 Views

nothing ..... 

the function alt_timestamp() returns always 0 

http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/sad.gif  

ciao  

walter
0 Kudos
Altera_Forum
Honored Contributor II
1,188 Views

 

--- Quote Start ---  

originally posted by pmicro@Jul 1 2006, 05:55 PM 

nothing ..... 

the function alt_timestamp()  returns always  0 

http://forum.niosforum.com/work2/style_emoticons/<#emo_dir#>/sad.gif  

ciao  

walter 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=16602) 

--- quote end ---  

 

--- Quote End ---  

 

 

 

I also faced the problem which the compiler cannot identify the function alt_timestamp_start(). And I tried what slacker suggested, it works!!!! Bingo!
0 Kudos
Reply