FreeRTOS+TCP with MicroBlaze_Kintex7_EthernetLite

logicanalyzer wrote on Thursday, March 24, 2016:

The FreeRTOSV8.2.3 MicroBlaze_Kintex7_EthernetLite demo has a emaclite driver for lwIP.

I want to use FreeRTOS+TCP instead. Is there a FreeRTOS+TCP compatible driver for for the Xilinx emaclite core?

If not, how difficult would it be to adapt the lwIP emaclite driver to FreeRTOS+TCP?

– John

heinbali01 wrote on Friday, March 25, 2016:

Hi John,

Have you had a look at the porting guide already?

Your function xNetworkInterfaceInitialise() will be called at regular intervals until it returns pdPASS. So as long as the interface is not ready (e.g. PHY Link Status low), you return pdFAIL.

Once it has returned pdPASS, two things will happen:

  • The xNetworkInterfaceOutput() function will be called by the IP-task to have packets sent.

  • Your driver will poll RX messages and add them to a queue to the IP-task. It should also test the PHY status.

You could start with e.g. one of these drivers:


Make a choice between one of these source files:


Once it works, you can look at optimisations, such as:

#define ipconfigDRIVER_INCLUDED_TX_IP_CHECKSUM  ( 1 )
#define ipconfigDRIVER_INCLUDED_RX_IP_CHECKSUM  ( 1 )
#define ipconfigUSE_LINKED_RX_MESSAGES          ( 1 )
#define ipconfigZERO_COPY_RX_DRIVER             ( 1 )
#define ipconfigZERO_COPY_TX_DRIVER             ( 1 )

If you have specific questions about porting you can also write to us directly


heinbali01 wrote on Friday, March 25, 2016:

After I pressed “Post” in my last message, it said that there was a parsing error. That is now repaired

logicanalyzer wrote on Friday, March 25, 2016:

Thanks for the reply. Let me restate my question.

The FreeRTOSV8.2.3 release has a demo for the Xinlix MicroBlaze processor on a Xilinx KC705 FPGA development board. The MicroBlazeKintex7_EthernetLite demo uses the light weight IP stack (“lwIP”) and the Xilinx “emaclite” driver.

I want to use FreeRTOS+TCP instead of lwIP. Is there any chance of using the lwIP “emaclite” driver with FreeRTOS+TCP? Or is the FreeRTOS+TCP driver model so different that the lwIP driver can’t be used, and a new, FreeRTOS+TCP compatible driver must be developed?

Alternately, is there a Xilinx emaclite driver for FreeRTOS+TCP?

rtel wrote on Saturday, March 26, 2016:

In any TCP/IP stack the drivers can be viewed at two levels:

  1. The low level network input and output functions
  2. The functions that interface the low level network input and output
    functions with the TCP/IP stack.

The hardest part is getting (1) to work. In this case Xilinx provide
this for you, and it is the Xilinx low level drivers that are used in
the lwIP example.

(2) is just wrapping the low level drivers in a function that has the
prototype and behaviour expected by the TCP/IP stack - which is a lot
simpler than writing and debugging the drivers in the first place. The
prototype of these interface functions is not compatible between lwIP
and FreeRTOS+TCP, but as you don’t need to create the low level input
and output functions, it should not be difficult porting to
FreeRTOS+TCP. Hein has already linked to the porting documentation, and
there are several examples in the FreeRTOS+TCP download.

As always, start with the easiest thing first - don’t try and do
anything cleaver like have a 100% zero copy driver. Just get the code
working in the simplest way possible and only after it is working assess
whether it meets your performance acquirements, and only if it does not
meet your performance requirements adapt the simple working driver into
something more complex.