I have a “FreeRTOS lwIP Perf Server” application template modified as a UDP echo server running on a KCU105 Microblaze in the Xilinx SDK 2019.1, with freertos10_v1_3 and lwip211_v1_0 building from the BSP. However, when building lwIP 2.1.2 from source as a static library, the server fails (pxQueue equals 0) on configAssert( pxQueue ); in file queue.c, in functions xQueueGenericSend() and xQueueGenericSendFromISR().
The application sends and receives UDP packets successfully when using lwIP in the BSP, but eventhough the lwIP library builds from source and produces the .a library file, it fails on Queue Send functions.
Any input regarding this will be helpful. Thanks.
Below is the serial output, where queue.c line 753 is xQueueGenericSend()
and queue.c line 963 is xQueueGenericSend()
-----lwIP Socket Mode UDP Server Application------
Start PHY autonegotiation
Waiting for PHY to complete autonegotiation
Autonegotiation complete
Waiting for Link to be up; Polling for SGMII core Reg
auto-negotiated link speed: 1000
Configuring default IP 192.168.1.10
Board IP: 192.Assert failed in file queue.c, line 753
-----lwIP Socket Mode UDP Server Application------
Start PHY autonegotiation
Waiting for PHY to complete autonegotiation
Autonegotiation complete
Waiting for Link to be up; Polling for SGMII core Reg
auto-negotiated link speed: 1000
Configuring default IP 192.168.1.10
Assert failed in file queue.c, line 963
Here is an screenshot of the function call stack as well:
Where is the pxQueue variable declared? Within the lwIP code? Is that code? If so I would guess there is a startup code or linker issues - but it sounds like you are getting all your code and tools from Xilinx so I would suggest asking on their forum.
pxQueue is declared in FreeRTOS file queue.c, in both the xQueueGenericSend() and xQueueGenericSendFromISR() functions, and gets set to the xQueue parameter as seen in the code block below.
xQueueGenericSend() is called from within the lwIP function sys_mbox_trypost() in the lwIP file sys_arch.c. sys_mbox_trypost() calls xReturn = xQueueSend( *pxMailBox, &pxMessageToPost, ( portTickType ) 0 ); and xQueueSend() is defined as xQueueGenericSend() in queue.h in FreeRTOS.
sys_mbox_trypost() is called from the lwIP function tcpip_try_callback() in the file tcpip.c (functions are below). This function passes &tcpip_mbox which is declared in tcpip.c as a global variable: static sys_mbox_t tcpip_mbox;
Did you successfully call tcpip_init which also initializes tcpip_mbox ?
Since the FreeRTOS queue handle is NULL either the call is missing or something went wrong.
Did you enable lwIP asserts and FreeRTOS asserts including other debug checks like stack overflow checking ?