Hello,
I’m using FreeRTOS on a board I made with an AT90USB647 and the compiler issues a warning on line 422 of tasks.c:
FreeRTOS/tasks.c: In function ‘xTaskGenericCreate’:
FreeRTOS/tasks.c:422: error: cast from pointer to integer of different size
FreeRTOS/tasks.c:422: error: cast to pointer from integer of different size
in line 422 of tasks.c i can see:
_pxTopOfStack = ( portSTACK_TYPE * ) ( ( ( unsigned long ) pxTopOfStack ) & ( ( unsigned long ) ~portBYTE_ALIGNMENT_MASK ) );
_
in portmacro.h (based on portmacro.h in the ATMega323 example) i have:
#define portSTACK_TYPE unsigned portCHAR
is this the correct portSTACK_TYPE for the AVR uController?
What should i do? change portSTACK_TYPE or change line 422 of tasks.c?
If i replace ‘long’ by ‘int’ in line 422 the warning disapears and FreeRTOS works but is this correct?
Regards,
Bernardo Marques.
Compilation warning on AVR GCC
Compilation warning on AVR GCC
This warning has arrisen from a recent change and occurs on ports where the stack type is smaller than the pointer type. I think changing the unsigned long casts to portBASE_TYPE cases might be ok, but would have to check each port individually.
Regards.
Compilation warning on AVR GCC
Nope. It cannot be a cast to portBASE_TYPE, it will make it worse. I suppose that in AVR GCC a pointer has two bytes and the base type on the AVR is 8-bit. As pxTopOfStack must be casted to a 16-bit integer it must be to either int or portSHORT.