source: rtems-docs/c-user/config/idle-task.rst

Last change on this file was 6692946, checked in by Sebastian Huber <sebastian.huber@…>, on 07/25/23 at 05:36:09

c-user: Link task entry and global construction

  • Property mode set to 100644
File size: 8.1 KB
Line 
1.. SPDX-License-Identifier: CC-BY-SA-4.0
2
3.. Copyright (C) 2020, 2022 embedded brains GmbH & Co. KG
4.. Copyright (C) 1988, 2008 On-Line Applications Research Corporation (OAR)
5
6.. This file is part of the RTEMS quality process and was automatically
7.. generated.  If you find something that needs to be fixed or
8.. worded better please post a report or patch to an RTEMS mailing list
9.. or raise a bug report:
10..
11.. https://www.rtems.org/bugs.html
12..
13.. For information on updating and regenerating please refer to the How-To
14.. section in the Software Requirements Engineering chapter of the
15.. RTEMS Software Engineering manual.  The manual is provided as a part of
16.. a release.  For development sources please refer to the online
17.. documentation at:
18..
19.. https://docs.rtems.org
20
21.. Generated from spec:/acfg/if/group-idle
22
23Idle Task Configuration
24=======================
25
26This section describes configuration options related to the idle tasks.
27
28.. Generated from spec:/acfg/if/idle-task-body
29
30.. raw:: latex
31
32    \clearpage
33
34.. index:: CONFIGURE_IDLE_TASK_BODY
35
36.. _CONFIGURE_IDLE_TASK_BODY:
37
38CONFIGURE_IDLE_TASK_BODY
39------------------------
40
41.. rubric:: CONSTANT:
42
43``CONFIGURE_IDLE_TASK_BODY``
44
45.. rubric:: OPTION TYPE:
46
47This configuration option is an initializer define.
48
49.. rubric:: DEFAULT VALUE:
50
51If the :ref:`CONFIGURE_DISABLE_BSP_SETTINGS` configuration option is not defined and
52:c:macro:`BSP_IDLE_TASK_BODY` is provided by the
53:term:`BSP`, then the default value is defined by
54:c:macro:`BSP_IDLE_TASK_BODY`, otherwise the default value is
55``_CPU_Thread_Idle_body``.
56
57.. rubric:: DESCRIPTION:
58
59The value of this configuration option initializes the IDLE thread body.
60
61.. rubric:: NOTES:
62
63IDLE threads shall not block.  A blocking IDLE thread results in undefined
64system behaviour because the scheduler assume that at least one ready thread
65exists.
66
67IDLE threads can be used to initialize the application, see configuration
68option :ref:`CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION`.
69
70The BSP may have knowledge of the specific CPU model, system controller
71logic, and peripheral buses, so a BSP-specific IDLE task may be capable of
72turning components off to save power during extended periods of no task
73activity.
74
75.. rubric:: CONSTRAINTS:
76
77The value of the configuration option shall be defined to a valid function
78pointer of the type ``void *( *idle_body )( uintptr_t )``.
79
80.. Generated from spec:/acfg/if/idle-task-init-appl
81
82.. raw:: latex
83
84    \clearpage
85
86.. index:: CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION
87
88.. _CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION:
89
90CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION
91-------------------------------------------
92
93.. rubric:: CONSTANT:
94
95``CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION``
96
97.. rubric:: OPTION TYPE:
98
99This configuration option is a boolean feature define.
100
101.. rubric:: DEFAULT CONFIGURATION:
102
103If this configuration option is undefined, then the user is assumed to
104provide one or more initialization tasks.
105
106.. rubric:: DESCRIPTION:
107
108This configuration option is defined to indicate that the user has configured
109**no** user initialization tasks or threads and that the user provided IDLE
110task will perform application initialization and then transform itself into
111an IDLE task.
112
113.. rubric:: NOTES:
114
115If you use this option be careful, the user IDLE task **cannot** block at all
116during the initialization sequence.  Further, once application
117initialization is complete, it shall make itself preemptible and enter an idle
118body loop.
119
120The IDLE task shall run at the lowest priority of all tasks in the system.
121
122If this configuration option is defined, then it is mandatory to configure a
123user IDLE task with the :ref:`CONFIGURE_IDLE_TASK_BODY` configuration option,
124otherwise a compile time error in the configuration file will occur.
125
126The application shall define at least one of the following configuration
127options
128
129* :ref:`CONFIGURE_RTEMS_INIT_TASKS_TABLE`,
130
131* :ref:`CONFIGURE_POSIX_INIT_THREAD_TABLE`, or
132
133* ``CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION``
134
135otherwise a compile time error in the configuration file will occur.
136
137If no Classic API initialization task and no POSIX API initialization thread
138is configured, then no :ref:`GlobalConstruction` is performed.
139
140.. Generated from spec:/acfg/if/idle-task-stack-size
141
142.. raw:: latex
143
144    \clearpage
145
146.. index:: CONFIGURE_IDLE_TASK_STACK_SIZE
147
148.. _CONFIGURE_IDLE_TASK_STACK_SIZE:
149
150CONFIGURE_IDLE_TASK_STACK_SIZE
151------------------------------
152
153.. rubric:: CONSTANT:
154
155``CONFIGURE_IDLE_TASK_STACK_SIZE``
156
157.. rubric:: OPTION TYPE:
158
159This configuration option is an integer define.
160
161.. rubric:: DEFAULT VALUE:
162
163If the :ref:`CONFIGURE_DISABLE_BSP_SETTINGS` configuration option is not defined and
164:c:macro:`BSP_IDLE_TASK_STACK_SIZE` is provided by the
165:term:`BSP`, then the default value is defined by
166:c:macro:`BSP_IDLE_TASK_STACK_SIZE`, otherwise the default value is
167defined by the :ref:`CONFIGURE_MINIMUM_TASK_STACK_SIZE` configuration option.
168
169.. rubric:: DESCRIPTION:
170
171The value of this configuration option defines the task stack size for an
172IDLE task.
173
174.. rubric:: NOTES:
175
176In SMP configurations, there is one IDLE task per configured processor, see
177:ref:`CONFIGURE_MAXIMUM_PROCESSORS`.
178
179.. rubric:: CONSTRAINTS:
180
181The following constraints apply to this configuration option:
182
183* The value of the configuration option shall be greater than or equal to a
184  BSP-specific and application-specific minimum value.
185
186* The value of the configuration option shall be small enough so that the IDLE
187  task stack area calculation carried out by ``<rtems/confdefs.h>`` does not
188  overflow an integer of type `size_t
189  <https://en.cppreference.com/w/c/types/size_t>`_.
190
191.. Generated from spec:/acfg/if/idle-task-storage-size
192
193.. raw:: latex
194
195    \clearpage
196
197.. index:: CONFIGURE_IDLE_TASK_STORAGE_SIZE
198.. index:: IDLE task storage size
199
200.. _CONFIGURE_IDLE_TASK_STORAGE_SIZE:
201
202CONFIGURE_IDLE_TASK_STORAGE_SIZE
203--------------------------------
204
205.. rubric:: CONSTANT:
206
207``CONFIGURE_IDLE_TASK_STORAGE_SIZE``
208
209.. rubric:: OPTION TYPE:
210
211This configuration option is an integer define.
212
213.. rubric:: DEFAULT VALUE:
214
215This configuration option has no default value.  If it is not specified, then
216the task storage area for each :term:`IDLE task` will allocated
217from the RTEMS Workspace or through a custom IDLE task stack allocator.
218
219.. rubric:: DESCRIPTION:
220
221If this configuration option is specified, then the task storage areas for
222the :term:`IDLE tasks <IDLE task>` are statically allocated by
223``<rtems/confdefs.h>``.  The value of this configuration option defines the
224size in bytes of the task storage area of each IDLE task in the system.
225
226.. rubric:: NOTES:
227
228By default, the IDLE task storage areas are allocated from the RTEMS
229Workspace.  Applications which do not want to use a heap allocator can use
230this configuration option to use statically allocated memory for the IDLE
231task storage areas.  The task storage area contains the task stack, the
232thread-local storage, and the floating-point context on architectures with a
233separate floating-point context.  The size of the thread-local storage area
234is defined at link time or by the :ref:`CONFIGURE_MAXIMUM_THREAD_LOCAL_STORAGE_SIZE`
235configuration option.  You have to estimate the actual thread-local storage
236size if you want to use this configuration option.  If the IDLE task stack
237size would be less than the value defined by the
238:ref:`CONFIGURE_IDLE_TASK_STACK_SIZE` configuration option, for example because the
239thread-local storage size is larger than expected, then the system terminates
240with the :ref:`INTERNAL_ERROR_CORE <FatalErrorSources>` fatal source and the
241:ref:`INTERNAL_ERROR_IDLE_THREAD_STACK_TOO_SMALL <internal_errors>` fatal code during
242system initialization.
243
244The value of this configuration option is passed to
245:ref:`InterfaceRTEMSTASKSTORAGESIZE` by ``<rtems/confdefs.h>`` to determine
246the actual size of the statically allocated area to take
247architecture-specific overheads into account.
248
249The
250
251* ``CONFIGURE_IDLE_TASK_STORAGE_SIZE``, and
252
253* :ref:`CONFIGURE_TASK_STACK_ALLOCATOR_FOR_IDLE`
254
255configuration options are mutually exclusive.
256
257.. rubric:: CONSTRAINTS:
258
259The value of the configuration option shall be greater than or equal to
260:ref:`CONFIGURE_IDLE_TASK_STACK_SIZE`.
Note: See TracBrowser for help on using the repository browser.