You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
I have searched the issue tracker for a similar issue and not found a similar issue.
General issue report
there are contradictory statements/notes in the code examples of some task functions.
one time the stack depth is described as This is the number of words the stack will hold, not the number of bytes. or usStackDepth - the stack size DEFINED IN WORDS.
but further down the stack depth is described as Stack size in bytes, not words.
// Dimensions the buffer that the task being created will use as its stack.// NOTE: This is the number of words the stack will hold, not the number of// bytes. For example, if each stack item is 32-bits, and this is set to 100,// then 400 bytes (100 * 32-bits) will be allocated.#defineSTACK_SIZE 200
// Structure that will hold the TCB of the task being created.StaticTask_txTaskBuffer;
// Buffer that the task being created will use as its stack. Note this is// an array of StackType_t variables. The size of StackType_t is dependent on// the RTOS port.StackType_txStack[ STACK_SIZE ];
// Function that implements the task being created.voidvTaskCode( void*pvParameters )
{
// The parameter value is expected to be 1 as 1 is passed in the// pvParameters value in the call to xTaskCreateStaticPinnedToCore().configASSERT( ( uint32_t ) pvParameters==1UL );
for( ;; )
{
// Task code goes here.
}
}
// Function that creates a task.voidvOtherFunction( void )
{
TaskHandle_txHandle=NULL;
// Create the task pinned to core 0 without using any dynamic memory allocation.xHandle=xTaskCreateStaticPinnedToCore(
vTaskCode, // Function that implements the task."NAME", // Text name for the task.STACK_SIZE, // Stack size in bytes, not words.
( void* ) 1, // Parameter passed into the task.tskIDLE_PRIORITY,// Priority at which the task is created.xStack, // Array to use as the task's stack.&xTaskBuffer, // Variable to hold the task's data structure.0 ); // Specify the task's core affinity// puxStackBuffer and pxTaskBuffer were not NULL, so the task will have// been created, and xHandle will be the task's handle. Use the handle// to suspend the task.vTaskSuspend( xHandle );
}
// Dimensions the buffer that the task being created will use as its stack.// NOTE: This is the number of bytes the stack will hold, not the number of// words as found in vanilla FreeRTOS.#defineSTACK_SIZE 200
// Structure that will hold the TCB of the task being created.StaticTask_txTaskBuffer;
// Buffer that the task being created will use as its stack. Note this is// an array of StackType_t variables. The size of StackType_t is dependent on// the RTOS port.StackType_txStack[ STACK_SIZE ];
// Function that implements the task being created.voidvTaskCode( void*pvParameters )
{
// The parameter value is expected to be 1 as 1 is passed in the// pvParameters value in the call to xTaskCreateStatic().configASSERT( ( uint32_t ) pvParameters==1UL );
for( ;; )
{
// Task code goes here.
}
}
// Function that creates a task.voidvOtherFunction( void )
{
TaskHandle_txHandle=NULL;
// Create the task without using any dynamic memory allocation.xHandle=xTaskCreateStatic(
vTaskCode, // Function that implements the task."NAME", // Text name for the task.STACK_SIZE, // Stack size in bytes, not words.
( void* ) 1, // Parameter passed into the task.tskIDLE_PRIORITY,// Priority at which the task is created.xStack, // Array to use as the task's stack.&xTaskBuffer ); // Variable to hold the task's data structure.// puxStackBuffer and pxTaskBuffer were not NULL, so the task will have// been created, and xHandle will be the task's handle. Use the handle// to suspend the task.vTaskSuspend( xHandle );
}
// Create an TaskParameters_t structure that defines the task to be created.staticconstTaskParameters_txCheckTaskParameters=
{
vATask, // pvTaskCode - the function that implements the task."ATask", // pcName - just a text name for the task to assist debugging.100, // usStackDepth - the stack size DEFINED IN WORDS.NULL, // pvParameters - passed into the task function as the function parameters.
( 1UL | portPRIVILEGE_BIT ),// uxPriority - task priority, set the portPRIVILEGE_BIT if the task should run in a privileged state.cStackBuffer,// puxStackBuffer - the buffer to be used as the task stack.// xRegions - Allocate up to three separate memory regions for access by// the task, with appropriate access permissions. Different processors have// different memory alignment requirements - refer to the FreeRTOS documentation// for full information.
{
// Base address Length Parameters
{ cReadWriteArray, 32, portMPU_REGION_READ_WRITE },
{ cReadOnlyArray, 32, portMPU_REGION_READ_ONLY },
{ cPrivilegedOnlyAccessArray, 128, portMPU_REGION_PRIVILEGED_READ_WRITE }
}
};
intmain( void )
{
TaskHandle_txHandle;
// Create a task from the const structure defined above. The task handle// is requested (the second parameter is not NULL) but in this case just for// demonstration purposes as its not actually used.xTaskCreateRestricted( &xRegTest1Parameters, &xHandle );
// Start the scheduler.vTaskStartScheduler();
// Will only get here if there was insufficient memory to create the idle// and/or timer task.for( ;; );
}
The text was updated successfully, but these errors were encountered:
github-actionsbot
changed the title
[DOC] Contradictory statements according stack depth units in example code
[DOC] Contradictory statements according stack depth units in example code (IDFGH-10342)
Jun 6, 2023
Answers checklist.
General issue report
there are contradictory statements/notes in the code examples of some task functions.
one time the stack depth is described as
This is the number of words the stack will hold, not the number of bytes.
orusStackDepth - the stack size DEFINED IN WORDS.
but further down the stack depth is described as
Stack size in bytes, not words.
very confusing.
here some finds:
at xTaskCreateStaticPinnedToCore
at xTaskCreateStatic
at vTaskAllocateMPURegions
The text was updated successfully, but these errors were encountered: