#1924 closed defect (fixed)

Enhanced stack allocator configuration

Reported by: Sebastian Huber Owned by: Sebastian Huber
Priority: normal Milestone: 4.11
Component: score Version: 4.11
Severity: normal Keywords:
Cc: joel.sherrill@…, gedare@… Blocked By:
Blocking:

Description

The RTEMS application configuration may provide a special task stack allocator:

http://rtems.org/onlinedocs/doc-current/share/rtems/html/c_user/c_user00419.html

CONFIGURE_TASK_STACK_ALLOCATOR may point to a user provided routine to allocate task stacks. The default value for this field is NULL which indicates that task stacks will be allocated from the RTEMS Workspace.

CONFIGURE_TASK_STACK_DEALLOCATOR may point to a user provided routine to free task stacks. The default value for this field is NULL which indicates that task stacks will be allocated from the RTEMS Workspace.

The current structure has two problems:

A) There is no standard way to initialize the allocator
B) The task stack area size is unknown to the allocator and the stack area size is accounted in the work space size estimate (thus the work space is larger than necessary).

To address problem A we should add an optional initialization function:

CONFIGURE_TASK_STACK_ALLOCATOR_INIT may point to a user provided routine to initialize the task stack allocator. The default value for this field is NULL which indicates that task stacks will be allocated from the RTEMS Workspace.

The prototype should be:

void (*stack_allocator_init_hook)(uintptr_t stack_area_size);

The function should be called right before _Thread_Create_idle() in rtems_initialize_data_structures().

To address problem B we should add an additional field to the Configuration:

typedef struct {

void *work_space_start;
uintptr_t work_space_size;
uintptr_t stack_space_size;
[...]
void (*stack_allocator_init_hook)( uintptr_t );
void * (*stack_allocate_hook)( size_t );
void (*stack_free_hook)( void *);
[...]

} rtems_configuration_table;

The confdefs.h must be modified to separate the stack area estimate from the overall work space estimate. In case no stack allocator is configured the work space size is increased by the stack space size.

Attachments (4)

config-cvs.patch (26.8 KB) - added by Sebastian Huber on Oct 26, 2011 at 10:02:43 AM.
Added stack_space_size field to Configuration.
config.patch (32.9 KB) - added by Sebastian Huber on Nov 9, 2011 at 11:58:22 AM.
Configuration changes.
config_v1.patch (11.7 KB) - added by Sebastian Huber on Dec 13, 2011 at 4:01:09 PM.
Configuration changes.
doc-conf.patch (15.1 KB) - added by Sebastian Huber on Dec 14, 2011 at 3:21:03 PM.
Documentation changes.

Download all attachments as: .zip

Change History (12)

comment:1 Changed on Sep 30, 2011 at 8:28:24 AM by Sebastian Huber

Owner: changed from Joel Sherrill to Sebastian Huber

Changed on Oct 26, 2011 at 10:02:43 AM by Sebastian Huber

Attachment: config-cvs.patch added

Added stack_space_size field to Configuration.

Changed on Nov 9, 2011 at 11:58:22 AM by Sebastian Huber

Attachment: config.patch added

Configuration changes.

comment:2 Changed on Nov 9, 2011 at 11:58:22 AM by Sebastian Huber

attachments.isobsolete: 01

comment:3 Changed on Nov 9, 2011 at 1:38:58 PM by Gedare Bloom

Cc: Gedare Bloom added

comment:4 Changed on Nov 10, 2011 at 2:33:27 PM by Joel Sherrill

Cc: Joel Sherrill added

Changed on Dec 13, 2011 at 4:01:09 PM by Sebastian Huber

Attachment: config_v1.patch added

Configuration changes.

comment:5 Changed on Dec 13, 2011 at 4:01:09 PM by Sebastian Huber

attachments.isobsolete: 01

Changed on Dec 14, 2011 at 3:21:03 PM by Sebastian Huber

Attachment: doc-conf.patch added

Documentation changes.

comment:6 Changed on Dec 14, 2011 at 3:21:03 PM by Sebastian Huber

attachments.isobsolete: 01

comment:8 Changed on Nov 24, 2014 at 6:58:28 PM by Gedare Bloom

Version: HEAD4.11

Replace Version=HEAD with Version=4.11 for the tickets with Milestone >= 4.11

Note: See TracTickets for help on using tickets.