Porting a TCP/IP stack - FreeRTOS

Porting a TCP/IP stack

This section provides instruction for porting and testing on-board TCP/IP stacks. If your platform offloads TCP/IP and TLS functionality to a separate network processor or module, you can skip this porting section and visit Porting the Network Transport Interface.

FreeRTOS+TCP is a native TCP/IP stack for the FreeRTOS kernel. FreeRTOS+TCP is developed and maintained by the FreeRTOS engineering team and is the recommended TCP/IP stack to use with FreeRTOS. For more information, see Porting FreeRTOS+TCP. Alternatively, you can use the third-party TCP/IP stack lwIP . The testing instruction provided in this section uses the transport interface tests for TCP plain text, and is not dependent on the specific implemented TCP/IP stack.

Porting FreeRTOS+TCP

FreeRTOS+TCP is a native TCP/IP stack for the FreeRTOS kernel. For more information, see FreeRTOS.org.


To port the FreeRTOS+TCP library, you need the following:


Before you start porting the FreeRTOS+TCP library, check the GitHub directory to see if a port to your board already exists.

If a port does not exist, do the following:

  1. Follow the Porting FreeRTOS+TCP to a Different Microcontroller instructions on FreeRTOS.org to port FreeRTOS+TCP to your device.

  2. If necessary, follow the Porting FreeRTOS+TCP to a New Embedded C Compiler instructions on FreeRTOS.org to port FreeRTOS+TCP to a new compiler.

  3. Implement a new port that uses the vendor-supplied Ethernet or Wi-Fi drivers in a file called NetworkInterface.c. Visit the GitHub repository for a template.

After you create a port, or if a port already exists, create FreeRTOSIPConfig.h, and edit the configuration options so they are correct for your platform. For more information about the configuration options, see FreeRTOS+TCP Configuration on FreeRTOS.org.


Whether you use FreeRTOS+TCP library or a third party library, follow the steps below for testing:

  • Provide an implementation for connect/disconnect/send/receive APIs in transport interface tests.

  • Setup an echo server in plain text TCP connection mode, and run transport interface tests.


To officially qualify a device for FreeRTOS, if your architecture requires to port a TCP/IP software stack, you need to validate the device's ported source code against transport interface tests in plain text TCP connection mode with AWS IoT Device Tester. Follow the instructions in Using AWS IoT Device Tester for FreeRTOS in the FreeRTOS User Guide to set up AWS IoT Device Tester for port validation. To test a specific library's port, the correct test group must be enabled in the device.json file in the Device Tester configs folder.