- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Friends!
When I compile this piece of code#include <asm/timer_struct.h>
int Timer_TimerDif(Timer_Data_t *timerData)
{
return nr_timer_milliseconds()-timerData->iStartTimer;
}
I get this error message: undefined reference to `nr_timer_milliseconds' Although timer_struct.h contains the following declaration of nr_timer_milliseconds int nr_timer_milliseconds(); // Starts on first call, hogs timer1.
The definition of struct np_timer for variable timerData is found by the compiler in timer_struct.h. But nr_timer_milliseconds is not founded? Bye, Lothar.
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Lothar,
I haven't used this before, but I believe you need to create a timer in you Nios core and call it na_timer1. A note claims this will tie up the counter completely, so it is probably best anyway. The function is defined in timer_milliseconds.c If you did a standard installation, the path will be (from a nios terminal) cygdrive/c/altera/kits/nios2/components/altera_avalon_timer/sdk_c/lib/ Doug- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Doug!
How can I create a new timer in a kernel project? Bye, Lothar.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Lothar,
Since you should have a dedicated timer for this function, you should probably go back to SOPC builder and create one. You can not just create one for the kernel project, it has to be generated by SOPC builder first. However, for the purpose of checking it out, you may be able to use one that is already available. If you are using an Altera Dev board, I think most of them have something like a sys_timer and high_res_timer pre-defined. Try using the high_res_timer, although remember this is a us timer and not a ms timer. Create a na_timer1 in your code and assign it to the address of you high_res_timer, see how things go. Timers and addresses should be available in your system.h file, ptf file, or SOPC builder. Once you iron our the details go back to SOPC builder and create a timer devoted to support this function. Doug
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page