Espressif ESP32-S2 Programming Manual page 867

Table of Contents

Advertisement

Chapter 2. API Reference
( 1UL
|
portPRIVILEGE_BIT
portPRIVILEGE_BIT
cStackBuffer,//
//
xRegions
-
//
the task,
with
//
different memory alignment requirements
documentation
//
for
full
information.
{
//
Base address
{ cReadWriteArray,
{ cReadOnlyArray,
{ cPrivilegedOnlyAccessArray,
WRITE }
}
};
int
main( void )
{
TaskHandle_t xHandle;
//
Create a task
//
is
requested (the second parameter
//
demonstration purposes
xTaskCreateRestricted( &xRegTest1Parameters, &xHandle );
//
Start the
scheduler.
vTaskStartScheduler();
//
Will only get here
//
and/or
timer
for( ;; );
}
Only available when configSUPPORT_STATIC_ALLOCATION is set to 1.
xTaskCreateRestrictedStatic() should only be used in systems that include an MPU implementation.
Internally, within the FreeRTOS implementation, tasks use two blocks of memory. The first block is used to
hold the task's data structures. The second block is used by the task as its stack. If a task is created using
xTaskCreateRestricted() then the stack is provided by the application writer, and the memory used to hold the
task's data structure is automatically dynamically allocated inside the xTaskCreateRestricted() function. If a
task is created using xTaskCreateRestrictedStatic() then the application writer must provide the memory used
to hold the task's data structures too. xTaskCreateRestrictedStatic() therefore allows a memory protected
task to be created without using any dynamic memory allocation.
return pdPASS if the task was successfully created and added to a ready list, otherwise an error code defined
in the file projdefs.h
Parameters
• pxTaskDefinition: Pointer to a structure that contains a member for each of the normal
xTaskCreate() parameters (see the xTaskCreate() API documentation) plus an optional stack buffer
and the memory region definitions. If configSUPPORT_STATIC_ALLOCATION is set to 1 the
structure contains an additional member, which is used to point to a variable of type StaticTask_t -
which is then used to hold the task's data structure.
• pxCreatedTask: Used to pass back a handle by which the created task can be referenced.
Example usage:
//
Create an TaskParameters_t structure that defines the task to be
//
The StaticTask_t variable
Espressif Systems
),//
uxPriority
if
the task should run
puxStackBuffer
-
the buffer to be used
Allocate up to three separate memory regions
appropriate access
from
the
const structure defined
as
its
not
if
there was insufficient memory to create the idle
task.
is
only included
Submit Document Feedback
-
task priority,
in
a privileged
permissions.
Different processors have
-
refer to the
Length
Parameters
32,
portMPU_REGION_READ_WRITE },
32,
portMPU_REGION_READ_ONLY },
128,
portMPU_REGION_PRIVILEGED_READ_
above.
is not
NULL) but
actually
used.
in
the structure when
856
(continued from previous page)
set
the␣
state.
as
the task
stack.
for
access by
FreeRTOS␣
The task handle
in
this case just
for
created.
(continues on next page)
Release v4.4

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ESP32-S2 and is the answer not in the manual?

Table of Contents

Save PDF