rtems_task_wake_after

Jerry Needell jerry.needell at unh.edu
Fri Jun 20 14:00:13 UTC 2003


On Friday, Jun 20, 2003, at 06:20 US/Eastern, 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
> -after 30 iteration the process doesn't go on; in the debugger I saw  
> that it is in the funtion _CPU_Thread_Idle_body ()


On my 500 Mhz system, it runs with sis/gdb, but is much slower than  
"real time".
It does stop after 30 iterations as you reported, but I think this is  
due to a
limitation of the simulator.
I also ran it under Jiri Gaislers (www.gaisler.com) tsim - simulator.  
It runs a lot faster - nearer to "real time" and also stops after 30  
itereations due to an overflow of the simulator clock after 2^32 clock  
cycles. I am using the "personal" version which is limited by design. I  
expect that sis has the same limitation.



- Jerry

>
> If I askrtems_task_wake_after(1000) rhe process doesn't freeze, but  
> the time scale is still wrong.
> 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
>




More information about the users mailing list