CONFIGURE_EXTRA_TASK_STACKS Value

Richardson, Anthony ar63 at evansville.edu
Tue Feb 1 14:24:20 UTC 2005


I seem to have some sort of problem with setting the stack size
(or a misunderstanding of the configuration parameters).  In the
example below, why do I need to set CONFIGURE_EXTRA_TASK_STACKS
value to anything other than zero?  If I leave it at 0 I get
an error when I create the third task (RTEMS_UNSATISFIED).  It seems
as if confdefs.h isn't setting aside the right amount of stack
space.

Hmmm. I noticed the provided ticker example has the same problem.
The third task doesn't get created and only the first two tasks
run.  It works if I increase the CONFIGURE_EXTRA_TASK_STACKS
value in the example code.

I'm using stock rtems-4.6.2 built for the pc386, running under Bochs.

Thanks,
Tony Richardson

========================================================================
=====
#include <bsp.h>
rtems_task Init( rtems_task_argument argument);
#define CONFIGURE_INIT
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#define CONFIGURE_MAXIMUM_TASKS        4
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE)
#include <confdefs.h>
#include <stdio.h>
#include <stdlib.h>

rtems_task hello(rtems_task_argument arg)
{
   char *msg = (char *)arg;
   while(1) {
     printf("%s\n",msg);
     rtems_task_wake_after(10);
   }
}

rtems_id   task_id[3];

char *tsk1_msg = "Hello from task one!";
char *tsk2_msg = "Hello from task two!";
char *tsk3_msg = "Hello from task three!";

rtems_task Init( rtems_task_argument ignored)
{
  rtems_status_code status;

  status = rtems_task_create( 
    rtems_build_name('T','S','K','1'), 10, RTEMS_MINIMUM_STACK_SIZE,
    RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, &task_id[0]
  );
  if (status != RTEMS_SUCCESSFUL) {
     fprintf(stderr, "Error creating task 1\n");
     exit(0);
  }

  status = rtems_task_create( 
    rtems_build_name('T','S','K','2'), 20, RTEMS_MINIMUM_STACK_SIZE,
    RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, &task_id[1]
  );
  if (status != RTEMS_SUCCESSFUL) {
     fprintf(stderr, "Error creating task 2\n");
     exit(0);
  }

  status = rtems_task_create( 
    rtems_build_name('T','S','K','3'), 30, RTEMS_MINIMUM_STACK_SIZE,
    RTEMS_DEFAULT_MODES, RTEMS_DEFAULT_ATTRIBUTES, &task_id[2]
  );
  if (status != RTEMS_SUCCESSFUL) {
     fprintf(stderr, "Error creating task 3\n");
     exit(0);
  }

  status = rtems_task_start(task_id[0], hello,
(rtems_task_argument)tsk1_msg);
  status = rtems_task_start(task_id[1], hello,
(rtems_task_argument)tsk2_msg);
  status = rtems_task_start(task_id[2], hello,
(rtems_task_argument)tsk3_msg);

  rtems_task_delete(RTEMS_SELF);

  exit (0);
}



More information about the users mailing list