rtems_task_wake_after

Joel Sherrill joel.sherrill at OARcorp.com
Fri Jun 20 13:29:50 UTC 2003



Fabio Degiovanni - Eicas wrote:
> 
> Dear Sirs,
>                 I'm new with RTEMS; I installed it on a Linux RedHat
> 7.3, my target is SPARC ERC32. I run my application using the ERC32
> simulatoror within sparc-rtems-gdb.
> 
> I tried with this simple example (see code below). I set up
> CONFIGURE_MICROSECONDS_PER_TICK 1000 and I ask
> rtems_task_wake_after(10000) whitch for me means that the task should be
> blocked for 10s.
> I have two problems:
> -rtems_task_wake_after instead of waking after 10s wakes after 1s

Is this wall-time (real user time) or simulated processor time.  I
assume
you are on reasonably modern PC hardware which means you can simulate
an ERC32 faster than the real processor.  

> -after 30 iteration the process doesn't go on; in the debugger I saw
> that it is in the funtion _CPU_Thread_Idle_body ()

That's where RTEMS will always be when there are no user tasks to
execute.
 
> If I askrtems_task_wake_after(1000) rhe process doesn't freeze, but the
> time scale is still wrong.

Wall-time != simualted processor time.

> Can anyone of you help me?
> 
> Thank you very much in advance
> 
> Fabio Degiovanni
> 
> my code:
> 
> #include <bsp.h>
> 
> #include <stdio.h>
> 
> #include <rtems.h>
> 
> rtems_task user_application(rtems_task_argument argument);
> 
> rtems_task Init(
>   rtems_task_argument ignored
> )
> {
> rtems_id tid;
> rtems_status_code status;
> rtems_name name;
> 
>     name=rtems_build_name('A','P','P','1');
> 
> 
> status=rtems_task_create(name,10,RTEMS_MINIMUM_STACK_SIZE,RTEMS_DEFAULT_MODES,RTEMS_DEFAULT_ATTRIBUTES,&tid);
> 
>     if(status!=RTEMS_SUCCESSFUL){
>         printf("rtems_task_create failed with status of %d.\n",status);
>         exit(1);
>     }
> 
>     status=rtems_task_start(tid,user_application,0);
> 
>     if(status!=RTEMS_SUCCESSFUL){
>         printf("rtems_task_start failed with status of %d.\n",status);
>         exit(1);
>     }
> 
>     status=rtems_task_delete(RTEMS_SELF);
> 
>     printf("rtems_task_delete returned with status of %d.\n",status);
>     exit(1);
> }
> 
> rtems_task user_application(rtems_task_argument argument){
> rtems_interval inter=10000;
> int i=0;
>     while(1){
>         printf("user_application %d\n",i);
> 
>         rtems_task_wake_after(inter);
> 
>         i++;
>         if(i==100){
>             rtems_shutdown_executive(0);
>         }
>     }
> 
> }
> 
> /* configuration information */
> 
> #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER /*for stdio*/
> #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER    /*for time services*/
> 
> #define CONFIGURE_MICROSECONDS_PER_TICK 1000
> 
> #define CONFIGURE_MAXIMUM_TASKS 2
> 
> #define CONFIGURE_INIT_TASK_NAME rtems_build_name('E','X','A','M')
> #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
> 
> #define CONFIGURE_INIT
> 
> #include <confdefs.h>
> 
> /* end of file */
> 
> my makefile:
> 
> #
> #  Makefile
> #
> 
> #
> #  RTEMS_MAKEFILE_PATH is typically set in an environment variable
> #
> 
> EXEC=hello.exe
> PGM=${ARCH}/$(EXEC)
> 
> # optional managers required
> MANAGERS=io
> 
> # C source names
> CSRCS = test.c
> COBJS_ = $(CSRCS:.c=.o)
> COBJS = $(COBJS_:%=${ARCH}/%)
> 
> # C++ source names
> CXXSRCS =
> CXXOBJS_ = $(CXXSRCS:.cc=.o)
> CXXOBJS = $(CXXOBJS_:%=${ARCH}/%)
> 
> # AS source names
> ASSRCS =
> ASOBJS_ = $(ASSRCS:.s=.o)
> ASOBJS = $(ASOBJS_:%=${ARCH}/%)
> 
> # Libraries
> LIBS = -lrtemsall -lc
> 
> include $(RTEMS_MAKEFILE_PATH)/Makefile.inc
> 
> include $(RTEMS_CUSTOM)
> include $(PROJECT_ROOT)/make/leaf.cfg
> 
> OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS)
> 
> all:    ${ARCH} $(PGM)
> 
> $(PGM): $(OBJS)
>     $(make-exe)
> 
> --
> Dott. Ing. Degiovanni Fabio
> Eicas Automazione
> Via Vincenzo Vela, 27 10128 Torino (ITALIA)
> Telefoni +39-11-562.37.98/562.3088 Fax +39-11-436.06.79

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



More information about the users mailing list