Skip to content

Commit daeb695

Browse files
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>
1 parent 4785ae7 commit daeb695

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

portable/GCC/RISC-V/port.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
#ifdef configTASK_RETURN_ADDRESS
5555
#define portTASK_RETURN_ADDRESS configTASK_RETURN_ADDRESS
5656
#else
57-
#define portTASK_RETURN_ADDRESS 0
57+
#define portTASK_RETURN_ADDRESS NULL
5858
#endif
5959

6060
/* The stack used by interrupt service routines. Set configISR_STACK_SIZE_WORDS
@@ -99,7 +99,7 @@ size_t xCriticalNesting = ( size_t ) 0xaaaaaaaa;
9999
size_t * pxCriticalNesting = &xCriticalNesting;
100100

101101
/* Used to catch tasks that attempt to return from their implementing function. */
102-
size_t xTaskReturnAddress = ( size_t ) portTASK_RETURN_ADDRESS;
102+
ReturnFunctionType_t xTaskReturnAddress = ( ReturnFunctionType_t ) portTASK_RETURN_ADDRESS;
103103

104104
/* Set configCHECK_FOR_STACK_OVERFLOW to 3 to add ISR stack checking to task
105105
* stack checking. A problem in the ISR stack will trigger an assert, not call

portable/GCC/RISC-V/portmacro.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ typedef portSTACK_TYPE StackType_t;
6666
typedef portBASE_TYPE BaseType_t;
6767
typedef portUBASE_TYPE UBaseType_t;
6868
typedef portUBASE_TYPE TickType_t;
69+
typedef void (*ReturnFunctionType_t)( void );
6970

7071
/* Legacy type definitions. */
7172
#define portCHAR char

0 commit comments

Comments
 (0)