From 059165fbf1c3ae8e87d2b06fed94bd3e39c1dbb8 Mon Sep 17 00:00:00 2001 From: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com> Date: Fri, 23 Aug 2024 12:47:47 +0530 Subject: [PATCH] Fix crash on Ubuntu 24.04 ARM64 (#1253) On Ubuntu 24.04 ARM64, PTHREAD_STACK_MIN is 0x20000 which does not fit in unsigned short, size of which is 2 bytes. Casting PTHREAD_STACK_MIN to unsigned short in FreeRTOSConfig.h results in configMINIMAL_STACK_SIZE getting defined to 0 which leads to SIGSEV. This change removes the not needed casting of PTHREAD_STACK_MIN to unsigned short. Signed-off-by: Gaurav Aggarwal --- FreeRTOS/Demo/Posix_GCC/FreeRTOSConfig.h | 2 +- FreeRTOS/Demo/Posix_GCC/main.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/FreeRTOS/Demo/Posix_GCC/FreeRTOSConfig.h b/FreeRTOS/Demo/Posix_GCC/FreeRTOSConfig.h index cc92b44778..d73a4a80bf 100644 --- a/FreeRTOS/Demo/Posix_GCC/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/Posix_GCC/FreeRTOSConfig.h @@ -43,7 +43,7 @@ #define configUSE_TICK_HOOK 1 #define configUSE_DAEMON_TASK_STARTUP_HOOK 1 #define configTICK_RATE_HZ ( 1000 ) /* In this non-real time simulated environment the tick frequency has to be at least a multiple of the Win32 tick frequency, and therefore very slow. */ -#define configMINIMAL_STACK_SIZE ( ( unsigned short ) PTHREAD_STACK_MIN ) /* The stack size being passed is equal to the minimum stack size needed by pthread_create(). */ +#define configMINIMAL_STACK_SIZE ( PTHREAD_STACK_MIN ) /* The stack size being passed is equal to the minimum stack size needed by pthread_create(). */ #define configTOTAL_HEAP_SIZE ( ( size_t ) ( 65 * 1024 ) ) #define configMAX_TASK_NAME_LEN ( 12 ) #define configUSE_TRACE_FACILITY 1 diff --git a/FreeRTOS/Demo/Posix_GCC/main.c b/FreeRTOS/Demo/Posix_GCC/main.c index 7f0fcf9fbc..e89da3b9e1 100644 --- a/FreeRTOS/Demo/Posix_GCC/main.c +++ b/FreeRTOS/Demo/Posix_GCC/main.c @@ -114,10 +114,10 @@ void vApplicationStackOverflowHook( TaskHandle_t pxTask, void vApplicationTickHook( void ); void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer, StackType_t ** ppxIdleTaskStackBuffer, - uint32_t * pulIdleTaskStackSize ); + configSTACK_DEPTH_TYPE * pulIdleTaskStackSize ); void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer, StackType_t ** ppxTimerTaskStackBuffer, - uint32_t * pulTimerTaskStackSize ); + configSTACK_DEPTH_TYPE * pulTimerTaskStackSize ); #if ( projENABLE_TRACING == 1 ) @@ -392,7 +392,7 @@ void vAssertCalled( const char * const pcFileName, * used by the Idle task. */ void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer, StackType_t ** ppxIdleTaskStackBuffer, - uint32_t * pulIdleTaskStackSize ) + configSTACK_DEPTH_TYPE * pulIdleTaskStackSize ) { /* If the buffers to be provided to the Idle task are declared inside this * function then they must be declared static - otherwise they will be allocated on @@ -420,7 +420,7 @@ void vApplicationGetIdleTaskMemory( StaticTask_t ** ppxIdleTaskTCBBuffer, * to provide the memory that is used by the Timer service task. */ void vApplicationGetTimerTaskMemory( StaticTask_t ** ppxTimerTaskTCBBuffer, StackType_t ** ppxTimerTaskStackBuffer, - uint32_t * pulTimerTaskStackSize ) + configSTACK_DEPTH_TYPE * pulTimerTaskStackSize ) { /* If the buffers to be provided to the Timer task are declared inside this * function then they must be declared static - otherwise they will be allocated on