From 6c8315511ba1f2837eafa7af43245858ab5fcd79 Mon Sep 17 00:00:00 2001 From: Marius Vikhammer Date: Mon, 19 Aug 2024 16:45:19 +0800 Subject: [PATCH] docs(freertos): update freertos comments to reflect that stack size is in bytes Closes https://github.com/espressif/esp-idf/issues/11600 --- .../FreeRTOS-Kernel-SMP/include/freertos/task.h | 8 ++++---- .../FreeRTOS-Kernel-SMP/portable/linux/port.c | 6 +++--- .../FreeRTOS-Kernel/include/freertos/task.h | 15 +++++++-------- .../FreeRTOS-Kernel/portable/linux/port_idf.c | 6 +++--- 4 files changed, 17 insertions(+), 18 deletions(-) diff --git a/components/freertos/FreeRTOS-Kernel-SMP/include/freertos/task.h b/components/freertos/FreeRTOS-Kernel-SMP/include/freertos/task.h index 4ecc60acf4..698a0063ea 100644 --- a/components/freertos/FreeRTOS-Kernel-SMP/include/freertos/task.h +++ b/components/freertos/FreeRTOS-Kernel-SMP/include/freertos/task.h @@ -493,7 +493,7 @@ typedef enum * xHandle = xTaskCreateStatic( * vTaskCode, // Function that implements the task. * "NAME", // Text name for the task. - * STACK_SIZE, // Stack size in words, not bytes. + * STACK_SIZE, // Stack size in bytes. * ( 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. @@ -565,7 +565,7 @@ typedef enum * { * 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. + * 100, // usStackDepth - the stack size DEFINED IN BYTES. * 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. @@ -659,7 +659,7 @@ typedef enum * { * 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. + * 100, // usStackDepth - the stack size DEFINED IN BYTES. * 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. @@ -2372,7 +2372,7 @@ char * pcTaskGetName( TaskHandle_t xTaskToQuery ) PRIVILEGED_FUNCTION; * * WARN: This function assumes that the pcWriteBuffer is of length * configSTATS_BUFFER_MAX_LENGTH. This function is there only for - * backward compatiblity. New applications are recommended to use + * backward compatibility. New applications are recommended to use * vTaskGetRunTimeStatistics and supply the length of the pcWriteBuffer * explicitly. * diff --git a/components/freertos/FreeRTOS-Kernel-SMP/portable/linux/port.c b/components/freertos/FreeRTOS-Kernel-SMP/portable/linux/port.c index aba16051f0..c36b6ea828 100644 --- a/components/freertos/FreeRTOS-Kernel-SMP/portable/linux/port.c +++ b/components/freertos/FreeRTOS-Kernel-SMP/portable/linux/port.c @@ -333,7 +333,7 @@ BaseType_t xPortSetInterruptMask( void ) void vPortClearInterruptMask( BaseType_t xMask ) { - // Only reenable interrupts if xMask is 0 + // Only re-enable interrupts if xMask is 0 uxInterruptLevel = xMask; if (uxInterruptLevel == 0 && uxCriticalNestingIDF == 0) { vPortEnableInterrupts(); @@ -720,7 +720,7 @@ void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer, /* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer. * Note that, as the array is necessarily of type StackType_t, - * configMINIMAL_STACK_SIZE is specified in words, not bytes. */ + * configMINIMAL_STACK_SIZE is specified in bytes. */ *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE; } #endif // configSUPPORT_STATIC_ALLOCATION == 1 @@ -748,7 +748,7 @@ void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer, /* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer. * Note that, as the array is necessarily of type StackType_t, - * configMINIMAL_STACK_SIZE is specified in words, not bytes. */ + * configMINIMAL_STACK_SIZE is specified in bytes. */ *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH; } #endif // configSUPPORT_STATIC_ALLOCATION == 1 diff --git a/components/freertos/FreeRTOS-Kernel/include/freertos/task.h b/components/freertos/FreeRTOS-Kernel/include/freertos/task.h index 976894ee6b..a2bf05e248 100644 --- a/components/freertos/FreeRTOS-Kernel/include/freertos/task.h +++ b/components/freertos/FreeRTOS-Kernel/include/freertos/task.h @@ -6,7 +6,7 @@ * * SPDX-License-Identifier: MIT * - * SPDX-FileContributor: 2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileContributor: 2023-2024 Espressif Systems (Shanghai) CO LTD * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in @@ -452,10 +452,9 @@ typedef enum * Example usage: * @code{c} * - * // Dimensions of 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. + * // 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. #define STACK_SIZE 200 * * // Structure that will hold the TCB of the task being created. @@ -488,7 +487,7 @@ typedef enum * xHandle = xTaskCreateStatic( * vTaskCode, // Function that implements the task. * "NAME", // Text name for the task. - * STACK_SIZE, // Stack size in words, not bytes. + * STACK_SIZE, // Stack size in bytes. * ( 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. @@ -574,7 +573,7 @@ typedef enum * { * 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. + * 100, // usStackDepth - the stack size DEFINED IN BYTES. * 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. @@ -657,7 +656,7 @@ typedef enum * { * 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. + * 100, // usStackDepth - the stack size DEFINED IN BYTES. * 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. diff --git a/components/freertos/FreeRTOS-Kernel/portable/linux/port_idf.c b/components/freertos/FreeRTOS-Kernel/portable/linux/port_idf.c index 04ad59fdb8..49050845b0 100644 --- a/components/freertos/FreeRTOS-Kernel/portable/linux/port_idf.c +++ b/components/freertos/FreeRTOS-Kernel/portable/linux/port_idf.c @@ -50,7 +50,7 @@ static void main_task(void* args) int main(int argc, const char **argv) { - // This makes sure that stdio is always syncronized so that idf.py monitor + // This makes sure that stdio is always synchronized so that idf.py monitor // and other tools read text output on time. setvbuf(stdout, NULL, _IONBF, 0); @@ -118,7 +118,7 @@ void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer, /* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer. * Note that, as the array is necessarily of type StackType_t, - * configMINIMAL_STACK_SIZE is specified in words, not bytes. */ + * configMINIMAL_STACK_SIZE is specified in bytes. */ *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE; } #endif // configSUPPORT_STATIC_ALLOCATION == 1 @@ -146,7 +146,7 @@ void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer, /* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer. * Note that, as the array is necessarily of type StackType_t, - * configMINIMAL_STACK_SIZE is specified in words, not bytes. */ + * configMINIMAL_STACK_SIZE is specified in bytes. */ *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH; } #endif // configSUPPORT_STATIC_ALLOCATION == 1