lwip for Zynq

seanbzd wrote on Monday, May 11, 2015:

Is there a lwip package available from freertos that I can use on my microzed? I tried to follow instructions from http://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_TCP/TCP_Networking_Tutorial_Adding_Source_Files.html but I’m stuck on step 2 talking about “creating network drivers for other chips”. The downloaded package says “To_Be_Released_Soon.txt” for this step. Any ideas? Thanks.

heinbali01 wrote on Tuesday, May 12, 2015:

Hi Sean,

A driver for FreeRTOS+TCP (not lwIP) is almost ready. It is developed and tested on a Microzed. TCP runs very fast with a nett speed up to 10 MB/sec (on a 100 mbit LAN).

If you like drop an email to http://www.freertos.org/RTOS-contact-and-support.html and we will send you the driver as it is now.

Regards.

rtel wrote on Tuesday, May 12, 2015:

Sean - I’m not sure if you realise, but the title of your post mentions lwIP, but the link in your post is to FreeRTOS+TCP - which are completely different products.

If you want lwIP then there is a demo in the FreeRTOS .zip file download (http://www.freertos.org/RTOS-Xilinx-Zynq.html), if you want FreeRTOS+TCP then we can send you the code (as per Hein’s post).

Regards.

heinbali01 wrote on Tuesday, May 12, 2015:

And if you decide to use lwIP, you may also contact us :slight_smile:
I’m curious about the experiences with the EMAC drivers that are used for lwIP.

Thanks,
Hein

seanbzd wrote on Tuesday, May 12, 2015:

My mistake, for some reason I thought TCP was part of the lwip. I’m interested in freeRTOS+TCP for now. As suggested, i sent an email to the support group asking for it. Thanks.

heinbali01 wrote on Tuesday, May 12, 2015:

When reading your post, many people will think: TCP is part of lwIP!

Some history:

lwIP (light-weight IP) and uIP (micro-IP) are both TCP/IP stacks, originally developed by Adam Dunkels. They are libraries for embedded applications which allow you to communicate through Ethernet / Internet. The libraries have been ported to many platforms and they are supported by, but not depending on FreeRTOS.

Since about half a year, FreeRTOS has its own TCP/IP-stack which is called FreeRTOS+TCP. It supports TCP, UDP, ICMP and it includes higher protocols like DHCP, nameservers (DNS, LLMNR, NBNS) and HTTP and FTP.

Regards.

seanbzd wrote on Thursday, May 14, 2015:

Hein, Thanks for the clarification.

I have imported the FreeRTOS+TCP project I received over email from Richard. The HW platform says it is for ZC702. I have Microzed xc7z010 board I’m using. I’ve built the project I received, customized IP Address, default gateway etc…and when I try to run it, the application is having problems like, allocating heap memory, creating Queues in the main() etc…should the project as-is not expected to work on the board that I have? probably a stupid question but i am more of a application programmer.

rtel wrote on Thursday, May 14, 2015:

Hein has sent you a hardware project for the Microzed xc7z010.

Regards.

seanbzd wrote on Thursday, May 14, 2015:

Thanks. I was able to get the standalone project I received from Hein work build and work. Now I’m trying to port just the TCP portion of it into my application. But it has references to the FreeRTOS+FAT. It is not clear to me whether this is needed for TCP to work? I would like to port the minimum set possible into my application because I’m only interested in TCP.

rtel wrote on Thursday, May 14, 2015:

FreeRTOS+FAT is only needed if you want to run the FTP or HTTP servers.

Regards.

heinbali01 wrote on Friday, May 15, 2015:

Hi Sean,

In order to include TCP/UDP into your Xilinx application you only need to include these source files:

TCP/IP stack:
    FreeRTOS-Plus-TCP\FreeRTOS_ARP.c
    FreeRTOS-Plus-TCP\FreeRTOS_DHCP.c
    FreeRTOS-Plus-TCP\FreeRTOS_DNS.c
    FreeRTOS-Plus-TCP\FreeRTOS_IP.c
    FreeRTOS-Plus-TCP\FreeRTOS_Sockets.c
    FreeRTOS-Plus-TCP\FreeRTOS_Stream_Buffer.c
    FreeRTOS-Plus-TCP\FreeRTOS_TCP_IP.c
    FreeRTOS-Plus-TCP\FreeRTOS_TCP_WIN.c
    FreeRTOS-Plus-TCP\FreeRTOS_UDP_IP.c
    FreeRTOS-Plus-TCP\portable\BufferManagement\BufferAllocation_1.c

Port for Xilinx:
    FreeRTOS-Plus-TCP\portable\NetworkInterface\Zynq\NetworkInterface.c
    FreeRTOS-Plus-TCP\portable\NetworkInterface\Zynq\uncached_memory.c
    FreeRTOS-Plus-TCP\portable\NetworkInterface\Zynq\x_emacpsif_dma.c
    FreeRTOS-Plus-TCP\portable\NetworkInterface\Zynq\x_emacpsif_hw.c
    FreeRTOS-Plus-TCP\portable\NetworkInterface\Zynq\x_emacpsif_physpeed.c

As you are one of the first users of this port, please keep us informed about how things are going.

Your platform has a lot of fast DDR RAM. If you want really high-speed TCP connections, allow bigger buffers.

/* Define the size of RX stream buffer for TCP sockets. */
#define ipconfigTCP_RX_BUF_LEN                ( 65536 )

/* Define the size of TX stream buffer for TCP sockets. */
#define ipconfigTCP_TX_BUF_LEN                ( 65536 )

/* The number of available network buffer descriptors.
Depends on how many concurrent TCP connections there will be. */
#define ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS    36

/* Normally the maximum allowed value for MTU: */
#define ipconfigNETWORK_MTU                      1500

If performance is important, just play with the parameters (see also the socket option FREERTOS_SO_WIN_PROPERTIES). You can also look at the communication with a capture program like Wireshark.

Regards.