From f60e36e45d0d7ea84febc8d1ea5f4e70f68cb3ec Mon Sep 17 00:00:00 2001 From: Anand Kumar Date: Fri, 12 Jun 2026 11:51:38 +0530 Subject: [PATCH] Fix: Replace size_t with uint32_t in TaskNotify*.c for 16-bit device support (#1401) --- FreeRTOS/Demo/Common/Minimal/TaskNotify.c | 8 ++++---- FreeRTOS/Demo/Common/Minimal/TaskNotifyArray.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/FreeRTOS/Demo/Common/Minimal/TaskNotify.c b/FreeRTOS/Demo/Common/Minimal/TaskNotify.c index 67a3d8b1a0f..5226b15ad7d 100644 --- a/FreeRTOS/Demo/Common/Minimal/TaskNotify.c +++ b/FreeRTOS/Demo/Common/Minimal/TaskNotify.c @@ -105,7 +105,7 @@ static uint32_t ulTimerNotificationsReceived = 0UL, ulTimerNotificationsSent = 0 static TimerHandle_t xTimer = NULL; /* Used by the pseudo random number generating function. */ -static size_t uxNextRand = 0; +static uint32_t uxNextRand = 0; /*-----------------------------------------------------------*/ @@ -121,7 +121,7 @@ void vStartTaskNotifyTask( void ) &xTaskToNotify ); /* Used to pass a handle to the task out is needed, otherwise set to NULL. */ /* Pseudo seed the random number generator. */ - uxNextRand = ( size_t ) prvRand; + uxNextRand = ( uint32_t ) prvRand; } /*-----------------------------------------------------------*/ @@ -712,10 +712,10 @@ BaseType_t xAreTaskNotificationTasksStillRunning( void ) static UBaseType_t prvRand( void ) { - const size_t uxMultiplier = ( size_t ) 0x015a4e35, uxIncrement = ( size_t ) 1; + const uint32_t uxMultiplier = ( uint32_t ) 0x015a4e35, uxIncrement = ( uint32_t ) 1; /* Utility function to generate a pseudo random number. */ uxNextRand = ( uxMultiplier * uxNextRand ) + uxIncrement; - return( ( uxNextRand >> 16 ) & ( ( size_t ) 0x7fff ) ); + return( ( uxNextRand >> 16 ) & ( ( uint32_t ) 0x7fff ) ); } /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Demo/Common/Minimal/TaskNotifyArray.c b/FreeRTOS/Demo/Common/Minimal/TaskNotifyArray.c index 35ccef83261..c2dad880ebd 100644 --- a/FreeRTOS/Demo/Common/Minimal/TaskNotifyArray.c +++ b/FreeRTOS/Demo/Common/Minimal/TaskNotifyArray.c @@ -137,7 +137,7 @@ static TimerHandle_t xIncrementingIndexTimer = NULL; static TimerHandle_t xNotifyWhileSuspendedTimer = NULL; /* Used by the pseudo random number generating function. */ -static size_t uxNextRand = 0; +static uint32_t uxNextRand = 0; /* Used to communicate when to send a task notification to the tick hook tests. */ static volatile BaseType_t xSendNotificationFromISR = pdFALSE; @@ -166,7 +166,7 @@ void vStartTaskNotifyArrayTask( void ) &xTaskToNotify ); /* Used to pass a handle to the task out if needed, otherwise set to NULL. */ /* Pseudo seed the random number generator. */ - uxNextRand = ( size_t ) prvRand; + uxNextRand = ( uint32_t ) prvRand; } /*-----------------------------------------------------------*/ @@ -1209,10 +1209,10 @@ BaseType_t xAreTaskNotificationArrayTasksStillRunning( void ) static UBaseType_t prvRand( void ) { - const size_t uxMultiplier = ( size_t ) 0x015a4e35, uxIncrement = ( size_t ) 1; + const uint32_t uxMultiplier = ( uint32_t ) 0x015a4e35, uxIncrement = ( uint32_t ) 1; /* Utility function to generate a pseudo random number. */ uxNextRand = ( uxMultiplier * uxNextRand ) + uxIncrement; - return( ( uxNextRand >> 16 ) & ( ( size_t ) 0x7fff ) ); + return( ( uxNextRand >> 16 ) & ( ( uint32_t ) 0x7fff ) ); } /*-----------------------------------------------------------*/