Creation of initial task fails with RTEMS_UNSATISFIED

Ingolf Steinbach ingolf.steinbach at googlemail.com
Thu May 10 07:45:48 UTC 2007


Joel Sherrill wrote on 2006-08-24:
> I suspect that for whatever reason, the configure ran out of
> memory for stack space before it ran out of task control blocks.
>
> If you can post a small and complete example, I can probably tell
> you precisely what happened.

Please have a look at the example code below. The reason for
the problem might be that _Thread_Initialize() is called *four*
times: once for
 - the idle task
 - the INIT task
 - the USR1 task
 - the USR2 task.

On RTEMS 4.6.5, the assertion fails because the second
rtems_task_create() (for USR2) fails with RTEMS_UNSATISFIED.

Do I really have to count the idle task, too, when configuring
CONFIGURE_MAXIMUM_TASKS?

Cheers
Ingolf
--------8<--------8<--------8<--------
#include <assert.h>
#include <rtems.h>

rtems_task Init(rtems_task_argument unused);

#define CONFIGURE_INIT

#define CONFIGURE_MICROSECONDS_PER_TICK 500 /* 0.5 millisecond */
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER

#define CONFIGURE_MAXIMUM_TASKS       3
#define CONFIGURE_MAXIMUM_PERIODS     1
#define CONFIGURE_MAXIMUM_SEMAPHORES  2
#define CONFIGURE_MAXIMUM_TIMERS      1
#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1

#define CONFIGURE_RTEMS_INIT_TASKS_TABLE

#define CONFIGURE_INIT_TASK_PRIORITY 128
#define CONFIGURE_INIT_TASK_NAME rtems_build_name('I','N','I','T')
#define CONFIGURE_INIT_TASK_STACK_SIZE (2*RTEMS_MINIMUM_STACK_SIZE)
#define CONFIGURE_INIT_TASK_ATTRIBUTES (RTEMS_DEFAULT_ATTRIBUTES |
RTEMS_FLOATING_POINT)

#define CONFIGURE_EXTRA_TASK_STACKS (2*RTEMS_MINIMUM_STACK_SIZE)

#include <confdefs.h>

rtems_task Init(rtems_task_argument unused) {
    rtems_id taskId;
    rtems_status_code status = rtems_task_create(
        rtems_build_name('U','S','R','1'),
        130,
        RTEMS_MINIMUM_STACK_SIZE,
        RTEMS_DEFAULT_MODES,
        RTEMS_DEFAULT_ATTRIBUTES,
        &taskId);

    status = rtems_task_create(
        rtems_build_name('U','S','R','2'),
        129,
        2*RTEMS_MINIMUM_STACK_SIZE,
        RTEMS_PREEMPT | RTEMS_TIMESLICE |RTEMS_NO_ASR |
RTEMS_INTERRUPT_LEVEL(0),
        RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT,
        &taskId);

    assert(status == RTEMS_SUCCESSFUL);
}
--------8<--------8<--------8<--------



More information about the users mailing list