[PATCH 7/7] rtems: Add rtems_task_build()

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Sep 1 07:27:42 UTC 2020

On 31/08/2020 23:15, Joel Sherrill wrote:
> On Fri, Aug 21, 2020 at 6:51 AM Sebastian Huber 
> <sebastian.huber at embedded-brains.de 
> <mailto:sebastian.huber at embedded-brains.de>> wrote:
>     In contrast to rtems_task_create() this function creates a task with a
>     user-provided task storage area.
> And all the creation parameters are in a structure which this log 
> doesn't mention.

Ok, I will add this to the commit message.

> How is the user supposed to know how large the "task storage area" should be
> The sp01 modifications seem to be a bit deceptive because the area is 
> just declared
> in terms of stack size. I would expect some user facing macros that 
> capture the
> size required for a non-FP and FP task. If FP is all tasks, then both 
> would give
> the same base value. Perhaps even take the requested stack size.

Ok, we already have an internal CONTEXT_FP_SIZE. What about adding an 
RTEMS_TASK_FLOATING_POINT_CONTEXT_SIZE define which can be used to 
deterime the size of the task storage area?

> How does the user account for any memory that is needed for alignment?
> Declaring a byte array is almost certainly not aligned sufficiently for a
> structure with larger elements and the stack itself may need to be cache
> line size aligned.

The parts allocated from the storage area do their own alignment.  We 
could add an RTEMS_TASK_STORAGE_ALIGNMENT define to help to reduce 
memory waste.

> I spotted multiple places in this patch where variables and parameters
> are not aligned properly.

Which places?

> But more important than formatting, I think the user facing part is too 
> error
> prone as it appears to be defined. It still counts as a user facing task 
> which
> means confdefs.h will include it in its stack calculations and that is used
> to reserve memory which will never be used. Similarly maximum tasks
> is used to reserve work space memory for various structures.

This is one of the last missing pieces to get rid of the workspace for 
certain application configurations. Mixing rtems_task_create() and 
rtems_task_create_build_whatever() is not recommended. If you really 
want to mix the functions, then the task stack space configuration is a 
bit more difficult.  You can for example adjust the size via 

I will add this as a note to the documentation.

> I don't think this one is ready. It needs API discussion more than basic
> feature discussion.

It would be nice to know your preference with respect to the function name.

Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

More information about the devel mailing list