RISC-V: fix xTaskReturnAddress type

xTaskReturnAddress holds a [function] pointer, never an integer address.
Use a proper exclusive function pointer type for this variable.
Furthermore, use NULL instead of 0 for an invalid function pointer value

This typedef could be made more generic for FreeRTOS-Kernel and not
just for RISC-V; vApplicationTaskExit used to be declared/defined in
previous versions and ideally could just be brought back.

Signed-off-by: Hesham Almatary <Hesham.Almatary@cl.cam.ac.uk>
This commit is contained in:
Hesham Almatary 2026-02-18 07:35:40 +00:00 committed by Patrick Cook
parent 807283ba03
commit ab6ccbb04e
2 changed files with 3 additions and 2 deletions

View file

@ -54,7 +54,7 @@
#ifdef configTASK_RETURN_ADDRESS
#define portTASK_RETURN_ADDRESS configTASK_RETURN_ADDRESS
#else
#define portTASK_RETURN_ADDRESS 0
#define portTASK_RETURN_ADDRESS NULL
#endif
/* The stack used by interrupt service routines. Set configISR_STACK_SIZE_WORDS
@ -99,7 +99,7 @@ size_t xCriticalNesting = ( size_t ) 0xaaaaaaaa;
size_t * pxCriticalNesting = &xCriticalNesting;
/* Used to catch tasks that attempt to return from their implementing function. */
size_t xTaskReturnAddress = ( size_t ) portTASK_RETURN_ADDRESS;
ReturnFunctionType_t xTaskReturnAddress = ( ReturnFunctionType_t ) portTASK_RETURN_ADDRESS;
/* Set configCHECK_FOR_STACK_OVERFLOW to 3 to add ISR stack checking to task
* stack checking. A problem in the ISR stack will trigger an assert, not call

View file

@ -66,6 +66,7 @@ typedef portSTACK_TYPE StackType_t;
typedef portBASE_TYPE BaseType_t;
typedef portUBASE_TYPE UBaseType_t;
typedef portUBASE_TYPE TickType_t;
typedef void (*ReturnFunctionType_t)( void );
/* Legacy type definitions. */
#define portCHAR char