Example FreeRTOS+UDP Project
For the FreeRTOS Win32 Simulator


On this page:



Source Code and Project Files

This demo application is available in the following directory of the offical FreeRTOS zip file download:
FreeRTOS-Plus/Demo/FreeRTOS_Plus_UDP_and_CLI_Windows_Simulator


Target Hardware

The project uses the FreeRTOS Windows simulator. The Windows simulator provides a convenient evaluation platform, but it does not exhibit real time behaviour. Simulated time is much slower than real time.


Compiler / Tool Chain

The project is pre-configured to build with the free Express edition of Microsoft Visual C++ (MSVC). MSVC Express Edition 2010 was used.


Functionality

The demo includes the following standard demo files:
  1. The two echo client tasks
  2. A command console with IP stack specific commands

The project can optionally be built to also include:


Command Console Input and Output

FreeRTOS+UDP is used to allow the command console to be accessed via a UDP terminal. See the Usage Instructions section below.


Build Instructions

  1. Download the zip file that contains the source code and project files. Extract the zip file into a convenient location, ensuring the directory structure is maintained.

    Note: The directory structure is designed to fit into the standard FreeRTOS .zip file download, making it seem non-optimal when seen in isolation.

  2. Open the Visual Studio solution file FreeRTOS_Plus_UDP_with_CLI.sln from within the Visual Studio IDE. The solution file is located in the "FreeRTOS-Plus/Demo_Projects_Using_FreeRTOS_Simulator/FreeRTOS_Plus_UDP_with_CLI" directory.

  3. The demo uses WinPCap to create a virtual network connection by accessing raw Ethernet data on a real network connection. Many computers have more than one real network port. Set configNETWORK_INTERFACE_TO_USE to tell the demo which real port should be used to create the virtual port.

    configNETWORK_INTERFACE_TO_USE is defined in FreeRTOSConfig.h. Available port numbers are displayed on the console when the application is executed (see the image in the Usage Instructions section below).

  4. Follow the instructions provided on the Echo Client example documentation page to set up an echo server and set the address of the echo server in FreeRTOSConfig.h. Alternatively simple local client and server tasks can be created by setting mainCREATE_SIMPLE_UDP_CLIENT_SERVER_TASKS to 1 in main.c.

  5. The virtual port has its own MAC address. Set the constants configMAC_ADDR0 to configMAC_ADDR5 to ensure the MAC address used by the virtual network connection is unique on the network. The constants are located at the bottom of FreeRTOSConfig.h.

  6. If IP address assignment is managed by a DHCP server then no further configuration is required.

    If IP address assignment is not managed by a DHCP server then set ipconfigUSE_DHCP to 0 in FreeRTOSIPConfig.h, then edit the constants at the bottom of FreeRTOSConfig.h that set the default values for a static IP address, DNS server address, gateway address and netmask to ensure they are valid for the Ethernet network. The IP address will be valid if the first three octets of the IP address match the first three octets of other IP addresses on the same network - each IP address must be unique on the network.

  7. Select "Build Solution" from the IDE's Build menu (or press F7) to build the application.



Debug Instructions

The standard Visual Studio key used to start a debug session and break on entry to main() is F10.

The same host computer is used to build the application, debug the application, and (because the FreeRTOS Win32 simulator is used) run the application. There are no special debugging instructions.


Usage Instructions