I think this must be complaining about casting from pxTopOfStack to unsigned long. Presumably pxTopOfStack is of type portSTACK_TYPE *, which is unsigned short *.
Yes, it’s just a simple warning, tasks seem to execute fine. I’d like to get rid of it however, or at least understand why no one else seems to get this warning.
Hm! My first FreeRTOS report! There is a duplication of “#define tskIDLE_PRIORITY”
The first is in task.h : 127
The second is in tasks.c : 75
Hardly critical, but hey! A dupe’s a dupe. Also shouldn’t it be “task.c” instead of “tasks.c”, to keep in line with the rest of your naming convention?
Hmm. That looks like a ‘temporary’ line that should have been removed. I have deleted the one in tasks.c. Thanks for pointing that out.
With regard to the header file name - yes that was a mistake that was made many, many years ago and is annoying. I have always left it because to change it would break peoples code.
I made the following change to tasks.c. It preserves the “unsigned long” type used by the code. (Alternatively, I think “unsigned long” could be replace by uintptr_t if you rely on the C99 standard.)
<somewhere near top of file>
/*
* Union to allow application of alignment mask to "top of stack"
* pointer without compiler warnings.
*/
typedef union topOfStackConversion
{
portSTACK_TYPE *pxTopOfStack;
unsigned long ulTopOfStack;
} topOfStackConv;
<inside of xTaskGenericCreate>
topOfStackConv xTopOfStack;
...
#if( portSTACK_GROWTH < 0 )
{
xTopOfStack.pxTopOfStack = pxNewTCB->pxStack + ( usStackDepth - 1 );
xTopOfStack.ulTopOfStack &= ( unsigned long ) ~portBYTE_ALIGNMENT_MASK;
pxTopOfStack = xTopOfStack.pxTopOfStack;
}
#else
I should add that I only tested this with the AVR GCC tools for an ATxmega128A1. I did a brief search, but other than my original reference, I did not find any guarantees about the alignment of the different types in the union. I don’t suggest you blindly use this without testing it on your specific platform.