ZC702 FreeRTOS TCP
Table of Contents
Files Required
The FreeRTOS TCP/IP stack can be downloaded from the FreeRTOSLabs website.Basic Project Structure
Create a FreeRTOS empty project in the SDK using the new application wizard.Import TCP stack to the application project (File -> Import) and select GCC compiler files and Zynq network interface files within the portable folder (Listed files bellow)
<FreeRTOS-Plus-TCP> All C Files <include> All Files <portable> <BufferManagement> BufferAllocation_1.c <Compiler> <GCC> All Files <NetworkInterface> <Zynq> All Files
Import memory related implementations from the Zynq Demo.
<FreeRTOS_Plus_TCP_and_FAT_Zynq_SDK> <RTOSDemo> <src> FreeRTOSIPConfig.h memcpy.c uncached_memory.c uncached_memory.h
Create a main.c file and copy the example code provided
Project Configuration
Configure compiler include paths to get the stack header files.Modify IP Stack configuration file (FreeRTOSIPConfig.h) modifying the following values
#define ipconfigUSE_LLMNR ( 0 ) #define ipconfigUSE_NBNS ( 0 ) //extern UBaseType_t uxRand(); //#define ipconfigRAND32() uxRand() #define ipconfigSUPPORT_OUTGOING_PINGS 0 //#include "DemoIPTrace.h"
Comment the following lines within uncached_memory.c to avoid compilation errors
//#include "UDPLoggingPrintf.h" //lUDPLoggingPrintf( "vInitialiseUncachedMemory: Can not allocate uncached memory\n" );
In order to be able to implement this example, the default amount of memory pool have to be increased in the FreeRTOS configuration (Modify BSP Settings), and the heap stack increased in the linker script.
Example Demo
Configure the target IP address in the main.c file according to your setupNote: Configure your host IP address and ensure that the target address is also in the same network address range
static const uint8_t ucIPAddress[ 4 ] = { 192, 168, 1, 100 }; static const uint8_t ucNetMask[ 4 ] = { 255, 255, 255, 0 }; static const uint8_t ucGatewayAddress[ 4 ] = { 192, 168, 1, 1 };
Create a debug configuration for the demo application and run in the target.
Check TCP/IP conectivity running a ping command from your host system to the target
Open a serial terminal and telnet terminal (ie. Kitty/Putty). Once the application is launched the initialization messages will be printed in the serial terminal. The demo consist in a echo server which would return the lines send from TCP client to the server.