Custom RTEMS task stack location?

Gedare Bloom gedare at gwmail.gwu.edu
Wed Nov 17 14:07:48 CST 2010


The relevant code in the Thread Initialization is at
cpukit/score/src/threadinitialize.c:
 87   /*
 88    *  Allocate and Initialize the stack for this thread.
 89    */
 90   #if !defined(RTEMS_SCORE_THREAD_ENABLE_USER_PROVIDED_STACK_VIA_API)
 91     actual_stack_size = _Thread_Stack_Allocate( the_thread, stack_size
);
 92     if ( !actual_stack_size || actual_stack_size < stack_size )
 93       return false;                     /* stack allocation failed */
 94
 95     stack = the_thread->Start.stack;
 96   #else
 97     if ( !stack_area ) {
 98       actual_stack_size = _Thread_Stack_Allocate( the_thread, stack_size
);
 99       if ( !actual_stack_size || actual_stack_size < stack_size )
100         return false;                     /* stack allocation failed */
101
102       stack = the_thread->Start.stack;
103       the_thread->Start.core_allocated_stack = true;
104     } else {
105       stack = stack_area;
106       actual_stack_size = stack_size;
107       the_thread->Start.core_allocated_stack = false;
108     }
109   #endif


On Wed, Nov 17, 2010 at 3:06 PM, Gedare Bloom <gedare at gwmail.gwu.edu> wrote:

> I think this can be done with the User_extensions_thread_create_extension.
> How you do it I'm not sure exactly.
>
> With the Class API task create, I don't think that it can be done
> directly.  However, the functionality is certainly supported from some other
> interfaces.
> cpukit/rtems/src/taskcreate.c
> 174   status = _Thread_Initialize(
> 175     &_RTEMS_tasks_Information,
> 176     the_thread,
> 177     NULL,
> 178     stack_size,
> 179     is_fp,
> 180     core_priority,
> 181     _Modes_Is_preempt(initial_modes)   ? true : false,
> 182     _Modes_Is_timeslice(initial_modes) ?
> 183       THREAD_CPU_BUDGET_ALGORITHM_RESET_TIMESLICE :
> 184       THREAD_CPU_BUDGET_ALGORITHM_NONE,
> 185     NULL,        /* no budget algorithm callout */
> 186     _Modes_Get_interrupt_level(initial_modes),
> 187     (Objects_Name) name
> 188   );
>
> The third argument to _Thread_Initialize is interpreted as an initial stack
> location, but the classic API does not use the field (POSIX does I believe).
>
> -Gedare
>
>
> On Wed, Nov 17, 2010 at 2:23 PM, Cudmore, Alan P. (GSFC-5820) <
> alan.p.cudmore at nasa.gov> wrote:
>
>> When creating a task, can the stack be allocated from an absolute address
>> rather than having RTEMS allocate it from the workspace?
>>
>> Thanks,
>> Alan
>>
>>
>> _______________________________________________
>> rtems-users mailing list
>> rtems-users at rtems.org
>> http://www.rtems.org/mailman/listinfo/rtems-users
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.rtems.org/pipermail/rtems-users/attachments/20101117/9eac12cf/attachment.html>


More information about the rtems-users mailing list