[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [rtems-users] CONFIGURE_EXTRA_TASK_STACKS Value



Richardson, Anthony wrote:
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.

It oculd be missing any resource and you are just covering it up. Or it could be convering up a driver needed unaccounted for resources.

Does the situation change if you leave out the clock driver? or
console driver?  I know the tasks won't do the right thing
but the issue is creating them not running them.

Usually the only way to find this is to break at _Workspace_Allocate
and note where the call is coming from.  If from malloc, ignore it.
If from inside RTEMS for the Workspace, make sure it is somewhere
that is accounted for.

If you can't figure it out from that, post again and I will
try to figure out what type of log I would need to do the
desk check.

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);
}


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