sparc stack and heap

Aleix Conchillo Flaqué aconchillo at ieec.fcr.es
Tue Jul 25 12:31:35 UTC 2006


On 25 Jul 2006, at 14:06, Joel Sherrill wrote:

> STACK_SIZE in linkcmds looks the size of the initial stack used for  
> system initialization in that BSP.
> Do you see symbols near it in start.S used to set the stack pointer?
>

STACK_SIZE is defined inside bspstart.c:

#define STACK_SIZE 16 + 1024

Then heap_size is calculated (in bsp_pretasking_hook) as:

heap_size = BSP_Configuration.work_space_start - (void *)&end -  
STACK_SIZE;
heap_size &= 0xfffffff0;

bsp_libc_init ((void *) heap_start, heap_size, 0);


> The application usually uses confdefs.h to specify the RTEMS  
> resources needed.  confdefs.h calculates
> the required amount of workspace. If you configure 10 tasks, then  
> it calculates you need 40K for corresponding
> task stacks.  This is from the ticker sample:
>
> #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 <rtems/confdefs.h>
>
> It says that the application wants a maximum of 4 Classic API tasks  
> and 3 of those use stacks of
> twice the minimum.
> No.  You can have as many as you have RAM.  See libbsp/sparc/shared/ 
> bspstart.c which
> tries to give the required memory above the heap to the RTEMS  
> Workspace.
>

OK, I understand this and it makes sense at all, what I don't  
understand is the heap_size variable initialisation.

Thanks for the fast answer.

Best regards,

aleix




More information about the users mailing list