Hello,
we are using the FreeRTOS-Plus-TCP library in our firrmware on the Xilinx ZynqMP UltraScale CortexR5 processor. The version of the FreeRTOS+TCP is V2.3.2 LTS Patch 1 and of the FreeRTOS Kernel V10.4.3.
The Cortex-R5 has a Floating point unit, which we are also making use of it. We also compile our firmware with the -mfloat-abi=hard -mfpu=vfpv3-d16
flags, which enable the compiler to use the FPU for optimizations. For the FreeRTOS-Kernel we use the portable/GCC/ARM_CR5
port.
So, we had the following issue with FreeRTOS + TCP library. At first everything was working fine and all as expecting. However, after some time down the line of the firmware development we had an issue in our release build, which we compile with -O2
. The assertion configASSERT( !( ( pvItemToQueue == NULL ) && ( pxQueue->uxItemSize != ( UBaseType_t ) 0U ) ) );
in the function xQueueGenericSend(...)
in queue.c
file would kick, when an ethernet link couldnât be established.
After some digging, we find out that the cause of the assertion was that the pvItemToQueue
was NULL
, however the pxQueue->uxItemSize
was 8
. This lead us to root cause of the issue which was when the xSendEventStructToIPTask(...)
function would be called by the FreeRTOS_NetworkDown( void )
function in the FreeRTOS-IP.c
file, the above assertion would kick.
After some more digging, we find out that the compiler made some FPU optimizations in the IP-Task, however nowhere was declared that the IP-Task made use of the FPU-Registers. This would lead to not save/restored FPU registers in the IP-Task, which was at last the cause of the above issue.
After adding the line vPortTaskUsesFPU();
at top of the prvIPTask()
-function, the issue was resolved.
static void prvIPTask( void * pvParameters )
{
IPStackEvent_t xReceivedEvent;
TickType_t xNextIPSleep;
FreeRTOS_Socket_t * pxSocket;
struct freertos_sockaddr xAddress;
vPortTaskUsesFPU();
/* Just to prevent compiler warnings about unused parameters. */
( void ) pvParameters;
/* A possibility to set some additional task properties. */
iptraceIP_TASK_STARTING();
.....
Now, my question would be, how can we fix this issue, if you also of course think that this is the underlying issue, without making any changes to the library sources, as we want to keep them âcleanâ, to avoid any merge conflicts when we do update the library.
A suggestion from my side would be to add a flag in the FreeRTOSIPConfig.h
, something in the lines of ipconfigIP_TASK_USES_FPU
, which then would guard the above call to vPortTaskUsesFPU
in the IP-Task.
Thank you in advance.
Kind Regards,
Christos