[PATCH v4 2/5] rtems: Add rtems_task_create_from_config()

Chris Johns chrisj at rtems.org
Sat Sep 12 00:53:48 UTC 2020


On 12/9/20 1:34 am, Sebastian Huber wrote:
> + * @par Notes
> + * By default, the calculation for the required memory in the RTEMS Workspace
> + * for tasks assumes that all Classic API Tasks are created by
> + * rtems_task_create().  This configuration option can be used to reduce the
> + * required memory for the system-provided task storage areas since tasks
> + * created by rtems_task_create_from_config() use a user-provided task storage
> + * area.
> + */
> +#define CONFIGURE_TASKS_CREATED_FROM_CONFIG

The documentation does not deal with 0 the default. It is fair to assume a
config that controls allocations for an API is consistent with similar calls. It
I set message queues to 0 any create call fails. I needed to check the patch to
know if 0 meant you could not create any tasks from a config.

If CONFIGURE_TASKS_CREATED_FROM_CONFIG was added to the configuration table
(which I am ok with) the rtems_task_create_from_config() could check for a
non-zero value before proceeding.

> +#ifndef CONFIGURE_TASKS_CREATED_FROM_CONFIG
> +  #define CONFIGURE_TASKS_CREATED_FROM_CONFIG 0
> +#endif
> +
> +#if CONFIGURE_TASKS_CREATED_FROM_CONFIG > CONFIGURE_MAXIMUM_TASKS
> +  #error "CONFIGURE_TASKS_CREATED_FROM_CONFIG shall be less than or equal to CONFIGURE_MAXIMUM_TASKS"
> +#endif
> +
>  #ifndef CONFIGURE_MAXIMUM_POSIX_THREADS
>    #define CONFIGURE_MAXIMUM_POSIX_THREADS 0
>  #endif
> diff --git a/cpukit/include/rtems/confdefs/wkspace.h b/cpukit/include/rtems/confdefs/wkspace.h
> index de476dbf82..215cdcb141 100644
> --- a/cpukit/include/rtems/confdefs/wkspace.h
> +++ b/cpukit/include/rtems/confdefs/wkspace.h
> @@ -100,7 +100,9 @@
>      + _CONFIGURE_POSIX_INIT_THREAD_STACK_EXTRA \
>      + _CONFIGURE_LIBBLOCK_TASKS_STACK_EXTRA \
>      + CONFIGURE_EXTRA_TASK_STACKS \
> -    + rtems_resource_maximum_per_allocation( _CONFIGURE_TASKS ) \
> +    + rtems_resource_maximum_per_allocation( \
> +        _CONFIGURE_TASKS - CONFIGURE_TASKS_CREATED_FROM_CONFIG \

I am confused by this. Does _CONFIGURE_TASKS have the number of tasks created
from config included in it? How was that added in?

I would have assumed I set CONFIGURE_TASKS_CREATED_FROM_CONFIG and that would be
added _CONFIGURE_TASKS internally.

Sorry, I think I am not understanding something.

Chris


More information about the devel mailing list