RTEMS Class example Timer : strange behaviour (to me)

Joel Sherrill joel.sherrill at OARcorp.com
Mon May 18 13:39:33 UTC 2009


pierre kestener wrote:
> Yes, exactly.
> For latest CVS sources, defining USE_TIMER_SERVER triggers the problem.
> With RTEMS 4.9 whatever this variable, the example is working as expected.
>
> The problem certainly is with the timer server code. I'll try to have a 
> look there.
>
>   
Try the attached patch.  I figured out what it was at home
but forgot to move the patch to OAR so this is right but hasn't
been compiled.  If that makes sense.

The issue is that the timers were rescheduling themselves
when they fire and the insertions for the timer server are
processed ONLY at specific times in the server. 

It would help to have a small test to add to the suite that
checks this behavior works and stays working.  If you could
write that, I would personally be very grateful.   Just follow
the style of the sptests.  More tests is a good thing. :)

Thanks.

--joel
> Pierre.
>
> Joel Sherrill a écrit :
>   
>> pierre kestener wrote:
>>     
>>> Hello,
>>>
>>> The problem can be reproduced using the Sparc/SIS simulator target
>>> with the latest CVS sources and the 4.10 toolchain. However the 
>>> problem disappears
>>> when falling back to RTEMS version 4.9.
>>>
>>>   
>>>       
>> I have duplicated this and wonder if the USE_TIMER_SERVER
>> is NOT defined when it works and is defined when it does not.
>>
>> That would indicate an issue with the task timer server code
>> that is likely version independent.
>> Please confirm this setting for your "works" and "broken" cases.
>>
>> FWIW you can also do this to get the time stamp:
>>
>>
>>        { struct timespec uptime;
>>          rtems_clock_get_uptime( &uptime );
>>          fprintf( stderr, "  %d:%d\n", uptime.tv_sec, uptime.tv_nsec );
>>        }
>>
>> rtems_clock_get_uptime() is fairly new but handy. :)
>>
>> --joel
>>     
>>> Can someone confirm he has the same wrong output as me for this test 
>>> using the SIS target ?
>>> Wrong output of timer class example (withthe only modification to 
>>> have a print_time following each LED print) :
>>> *** LED BLINKER -- timer ***
>>> LED OFF 00:00:01
>>> LED ON 00:00:02
>>> LED OFF 00:00:03
>>> LED ON 00:00:05
>>> LED OFF 00:00:07
>>> LED ON 00:00:09
>>> LED OFF 00:00:11
>>> LED ON 00:00:13
>>> LED OFF 00:00:15
>>> LED ON 00:00:17
>>>
>>> The first LED_ON is missing.
>>> Moreover it looks like after a while, the 2 timers are 
>>> "sequentialized" instead of interleaved.
>>>
>>> Pierre Kestener.
>>>
>>>
>>> pierre kestener a écrit :
>>>  
>>>       
>>>> More about timer example problem in Leon2 BSP :
>>>>
>>>> I have tried different couples RTEMS toochain / RTEMS src :
>>>> - 4.9.0 from rtems.org
>>>> - RCC 1.1.1 from Gaisler (RTEMS scr 4.8)
>>>> - RCC 1.1.99.1 from Gaisler (downloaded in Feb 2009)
>>>> - RCC 1.1.99.3 from Gaisler (downloaded today)
>>>>
>>>> the problem described below only appears with the latest Gaisler 
>>>> toolchain/src 1.1.99.x
>>>>
>>>> everything is fine when using the release toolchain/src 4.9.0 (from 
>>>> rtems.org) or with the older Gaisler toolchain/src couple.
>>>>
>>>> I haven't tried a more recent toolchain/src neither the CVS sources.
>>>>
>>>> Pierre.
>>>>
>>>> pierre kestener a écrit :
>>>>    
>>>>         
>>>>> Hello,
>>>>>
>>>>> I am running the timer class example on real hardware (Sparc/Leon2) 
>>>>> with printing on console.
>>>>>
>>>>> Timer1 and 2 service routines are each set with a 2 seconds 
>>>>> interval, but I noticed that
>>>>> after 2 fireouts, time between 2 LED_ON (or LED OFF)  prints 
>>>>> becomes 4 seconds.
>>>>> To illustrate this, I put a rtems_time_of_day  global variable 
>>>>> named "now" in the source code to use it to print time.
>>>>>
>>>>> Here is the corresponding output :
>>>>>
>>>>> *** LED BLINKER -- timer ***
>>>>> LED ON  00:00:00   
>>>>> 01/01/2009                                                  LED 
>>>>> OFF  00:00:01   
>>>>> 01/01/2009                                                 LED ON  
>>>>> 00:00:02   
>>>>> 01/01/2009                                                  LED 
>>>>> OFF  00:00:03   
>>>>> 01/01/2009                                                 LED ON  
>>>>> 00:00:05   
>>>>> 01/01/2009                                                  LED 
>>>>> OFF  00:00:07   
>>>>> 01/01/2009                                                 LED ON  
>>>>> 00:00:09   
>>>>> 01/01/2009                                                  LED 
>>>>> OFF  00:00:11   
>>>>> 01/01/2009                                                 LED ON  
>>>>> 00:00:13   
>>>>> 01/01/2009                                                  LED 
>>>>> OFF  00:00:15   
>>>>> 01/01/2009                                                 LED ON  
>>>>> 00:00:17   01/01/2009
>>>>>
>>>>> I also noticed that if I comment the line calling Timer2 service 
>>>>> routine
>>>>> Timer_Routine(Timer2, NULL);
>>>>> in the Init task, then Timer1 is called twice and then it stops, no 
>>>>> print anymore.
>>>>>                    *** LED BLINKER -- timer ***
>>>>> LED ON  00:00:00   
>>>>> 01/01/2009                                                  LED ON  
>>>>> 00:00:02   
>>>>> 01/01/2009                                                Can 
>>>>> someone help me and give some explanation of what seems strange to 
>>>>> me ?
>>>>> Thank you in advance.
>>>>>
>>>>> Pierre Kestener.
>>>>>
>>>>>       
>>>>>           
>>> _______________________________________________
>>> rtems-users mailing list
>>> rtems-users at rtems.org
>>> http://www.rtems.org/mailman/listinfo/rtems-users
>>>   
>>>       
>
>
>   


-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel.sherrill at OARcorp.com        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
   Support Available             (256) 722-9985


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: timerserver.diff
URL: <http://lists.rtems.org/pipermail/users/attachments/20090518/28c240d9/attachment-0001.ksh>


More information about the users mailing list