Per request, I’ve started a new thread to discuss this issue I’ve been having. This is for a Zynq PicoZed 7030 project using Vitis.
In a nutshell, this function calls fails:
xListeningSocket = FreeRTOS_socket( FREERTOS_AF_INET4, <== this call fails
FREERTOS_SOCK_STREAM , FREERTOS_IPPROTO_TCP );
configASSERT( xListeningSocket != FREERTOS_INVALID_SOCKET );
Based on the documentation, it seems this is because of insufficient heap memory.
I found heap size setting in the Board Support Package Settings. I changed it to 1M from 64k and recompiled, but I still get the same error.
I’m looking for configSUPPORT_DYNAMIC_ALLOCATION defines, but haven’t found it yet in Vitis. Which file would this be found it?
I declared this in my FreeRTOSIPConfig.h file: #define configSUPPORT_DYNAMIC_ALLOCATION 1
Recompiling and rerunning this still gives my the error.
Can you step through the code and see why is it returningFREERTOS_INVALID_SOCKET? If it is because of this pvPortMallocSocket call, you need to find which FreeRTOS heap are you using and increase the heap size accordingly.
You do not need to call it but the function FreeRTOS_socket internally calls it. Can you look at the files in your project and find out which FreeRTOS heap are you using? Alternatively, share your complete project and we can look at that.
After calling FreeRTOS_IPInit_Multi(); you need to start the scheduler by calling vTaskStartScheduler. And then the following function gets called with eNetworkEvent = eNetworkUp when the network is ready.
I see main is calling vTaskStartScheduler() before any tasks are created. I thought at least one task had to be created before starting the scheduler?
The comments in vApplicationIPNetworkEventHook_Multi() says this gets called when the network connects or disconnects. How does that work? In this function, I see a xTaskCreate() where creates task prvEchoClientTask() which has the FreeRTOS_socket call.
So, I’m calling these functions now. I had to define ipconfigNIC_LINKSPEED_AUTODETECT for proper initialization.
xTaskCreate(prvIPTask) <== task created here
I see prvTask has a ipFOREVER() loop with prvProcessIPEventsAndTimers() inside. There is a bunch of event decoding going on in here:
eNetworkDownEvent <== this should only occur once when establishing connection
Debugging this, I see eNetworkDownEvent on the first pass only which I think is correct. I see a bunch of eNoEvent with an occasional eARPTimerEvent. Is this correct?
I don’t see my assigned IP address when looking at the attached devices on my router. Should I? When can I ping it?
Do I still need to call FreeRTOS_socket(), FreeRTOS_setsockopt(), FreeRTOS_bind(), etc?
Yes, eNoEvent will occur when the xQueueReceive call to IP task’s event queue times out. This timeout will enable the timers to be processed (vCheckNetworkTimers) without indefinetely waiting for an event if there isn’t any.
As mentioned by @aggarg in the previous post please check if the call to vApplicationIPNetworkEventHook_Multi is enabled by setting ipconfigUSE_NETWORK_EVENT_HOOK in the FreeRTOSIPConfig.h file and is getting called once the network is up.