• Home
  • Annotate
  • current directory
Name Date Size #Lines LOC

..21-Aug-2025-

FreeRTOSConfig.h A D21-Aug-202511.4 KiB233100

FreeRTOSIPConfig.h A D21-Aug-202517.1 KiB31368

FreeRTOS_Plus_TCP_IPv6_Multi.props A D21-Aug-20251.5 KiB3433

FreeRTOS_Plus_TCP_IPv6_Multi.sln A D21-Aug-20251.1 KiB2726

Logging_WinSim.c A D21-Aug-202521.8 KiB554299

ReadMe.md A D21-Aug-20259.4 KiB213180

Read_Me_Build_Instructions.url A D21-Aug-2025187 76

TCPEchoClient_SingleTasks.c A D21-Aug-202523.2 KiB545332

TCPEchoClient_SingleTasks.h A D21-Aug-20251.7 KiB396

UDPEchoClient_SingleTasks.c A D21-Aug-202513.9 KiB300169

UDPEchoClient_SingleTasks.h A D21-Aug-20251.7 KiB385

WIN32.vcxproj A D21-Aug-202514.1 KiB224224

WIN32.vcxproj.filters A D21-Aug-202516.7 KiB354354

main.c A D21-Aug-202536.4 KiB1,002579

printf-stdarg.c A D21-Aug-202526.2 KiB1,054786

ReadMe.md

1# FreeRTOS+TCP IPv6 Multi-Endpoint Demo
2
3The IPv6_Multi_WinSim Visual studio demo showcases the Multiple Interfaces (or
4rather multiple endpoints) functionality of the FreeRTOS+TCP library.
5The Windows Simulator environment doesn't actually have multiple
6interfaces which can be used by FreeRTOS and thus, this demo shows
7the use of different endpoints (IP-addresses).
8
9## Setting up the workspace
10
11Clone the repo along with submodules used:
12
13```
14git clone https://github.com/FreeRTOS/FreeRTOS.git --recurse-submodules
15```
16
17If you have cloned the repo without using the `--recurse-submodules`
18argument, you need to run:
19
20```
21git submodule update --init --recursive
22```
23
24The FreeRTOS+TCP Multiple Interface Visual Studio project file is
25[FreeRTOS_Plus_TCP_IPv6_Multi.sln](FreeRTOS_Plus_TCP_IPv6_Multi.sln).
26
27
28## Prerequisites
29
301. The host PC needs to be connected to the network using an Ethernet cable.
312. Set `configNETWORK_INTERFACE_TYPE_TO_USE` in the [FreeRTOSConfig.h](FreeRTOSConfig.h)
32   file to the name of the network interface to use , e.g. "Realtek". You can run the
33   demo once to print all the available network interfaces.
34
35## Running the demo
36
37This demo provides 4 examples:
381. The TCP Echo Client Example
392. The TCP Echo Server Example
403. The UDP Echo Client Example
414. The CLI Example
42
43### Running The TCP Echo Client Example
44
451. Set `mainCREATE_TCP_ECHO_TASKS_SINGLE` to 1 in the [main.c](main.c) file.
461. Clone the [FreeRTOS-Libraries-Integration-Tests](https://github.com/FreeRTOS/FreeRTOS-Libraries-Integration-Tests/tree/main)
47   repo on the host where you want to run the echo server:
48   ```
49   git clone https://github.com/FreeRTOS/FreeRTOS-Libraries-Integration-Tests.git
50   ```
511. Run the TCP echo server available at [tools/echo_server](https://github.com/FreeRTOS/FreeRTOS-Libraries-Integration-Tests/tree/main/tools/echo_server)
52   by running the following command:
53   ```
54   go run echo_server.go
55   ```
561. Set `configECHO_SERVER_ADDR_STRING` in the [FreeRTOSConfig.h](FreeRTOSConfig.h)
57   file to the IP address of host on which you started echo server in the above
58   step.
591. Set `configECHO_SERVER_PORT` in the [FreeRTOSConfig.h](FreeRTOSConfig.h)
60   file to the echo server port. If you followed step 1 and 2 above to run the
61   echo server, the port number is `9000` which can be changed in the
62   [config.json](https://github.com/FreeRTOS/FreeRTOS-Libraries-Integration-Tests/blob/main/tools/echo_server/config.json#L5)
63   file.
641. Build the project and run. You should see the output like the following:
65   ```
66   161 18.678 [echo_00        ] -------- Starting New Iteration --------
67   162 18.916 [echo_00        ] FreeRTOS_connect returns 0
68   163 19.136 [echo_00        ] FreeRTOS_send: 3289/3289
69   164 19.376 [echo_00        ] Instance[0]: Good 27/27 shutdown 240
70   165 19.376 [echo_00        ] 3 x 3480 = 10440 Exchange 3289/3289
71   166 19.376 [echo_00        ] --------------------------------------
72   ```
73
74### Running The TCP Echo Server Example
75
761. Set `mainCREATE_TCP_ECHO_SERVER_TASK` to 1 in the [main.c](main.c) file.
771. Build the project and run.
78   ```
79   0 0.167 [IP-task        ] uxNetworkIsUp = 1
80   1 0.167 [IP-task        ] uxNetworkIsUp = 2
81   2 1.727 [IP-task        ] uxNetworkIsUp = 3
82   3 1.727 [IP-task        ] IPv4 address = 192.168.1.83
83   ```
841. Echo server should now be running and ready to accept incoming connections
85   on port number 7. You can connect the echo server using any client. For example,
86   you can use `nc` command to connect:
87   ```
88   nc 192.168.1.83 7
89   Hello
90   Hello
91   World
92   World
93   ```
94   Note that `192.168.1.83` is the IP address assigned to one of our endpoints as
95   can be seen in the output of step 2. We send the string "Hello" and then "World"
96   and we get the same strings back.
97
98### Running The UDP Echo Client Example
99
1001. Set `mainCREATE_UDP_ECHO_TASKS_SINGLE` to 1 in the [main.c](main.c) file.
1011. Clone the [FreeRTOS-Libraries-Integration-Tests](https://github.com/FreeRTOS/FreeRTOS-Libraries-Integration-Tests/tree/main)
102   repo on the host where you want to run the echo server:
103   ```
104   git clone https://github.com/FreeRTOS/FreeRTOS-Libraries-Integration-Tests.git
105   ```
1061. Set `use_udp` to `true` in the
107   [tools/echo_server/config.json](https://github.com/FreeRTOS/FreeRTOS-Libraries-Integration-Tests/blob/main/tools/echo_server/config.json) file.
1081. Run the UDP echo server available at [tools/echo_server](https://github.com/FreeRTOS/FreeRTOS-Libraries-Integration-Tests/tree/main/tools/echo_server)
109   by running the following command:
110   ```
111   go run echo_server.go
112   ```
1131. Set `configECHO_SERVER_ADDR_STRING` in the [FreeRTOSConfig.h](FreeRTOSConfig.h)
114   file to the IP address of host on which you started echo server in the above
115   step.
1161. Set `configECHO_SERVER_PORT` in the [FreeRTOSConfig.h](FreeRTOSConfig.h)
117   file to the echo server port. If you followed step 1 and 2 above to run the
118   echo server, the port number is `9000` which can be changed in the
119   [config.json](https://github.com/FreeRTOS/FreeRTOS-Libraries-Integration-Tests/blob/main/tools/echo_server/config.json#L5)
120   file.
1211. Build the project and run. You should see the output like the following:
122   ```
123   12 15.722 [echo_00        ] -------- Starting New Iteration --------
124   13 15.880 [echo_00        ] [Echo Client] Data was received correctly.
125   14 17.880 [echo_00        ] [Echo Client] Data was received correctly.
126   15 19.620 [echo_00        ] [Echo Client] Data was received correctly.
127   16 21.380 [echo_00        ] [Echo Client] Data was received correctly.
128   17 23.160 [echo_00        ] [Echo Client] Data was received correctly.
129   18 24.840 [echo_00        ] Exchange (Sent/Received) : 100/99
130   19 24.840 [echo_00        ] --------------------------------------
131   ```
132
133### Running The CLI Example
134
1351. Set `mainCREATE_CLI_TASK` to 1 in the [main.c](main.c) file.
1361. Uncomment the commands that you want to execute in the
137   `pcCommandList` array in the [main.c](main.c) file. By default,
138   only the `ifconfig` command is enabled.
1391. Set `ipconfigHAS_PRINTF` to 1 in the [FreeRTOSIPConfig.h](FreeRTOSIPConfig.h)
140   file.
1411. Build the project and run. You should see the output like the following:
142   ```
143   44 3.742 [cli            ]
144   45 3.742 [cli            ]
145   46 3.742 [cli            ] /*==================== ifconfig (1/1) ====================*/
146   47 3.742 [cli            ]
147   48 3.742 [cli            ] Interface eth0
148   49 3.742 [cli            ] IP-address : 192.168.1.83
149   50 3.742 [cli            ] Default IP : 192.168.2.114
150   51 3.742 [cli            ] End-point  : up = yes method DHCP
151   52 3.742 [cli            ] Net mask   : 255.255.255.0
152   53 3.742 [cli            ] GW         : 192.168.1.1
153   54 3.742 [cli            ] DNS-0      : 192.168.1.1
154   55 3.742 [cli            ] DNS-1      : 0.0.0.0
155   56 3.742 [cli            ] Broadcast  : 192.168.1.255
156   57 3.742 [cli            ] MAC address: 00-11-22-33-44-41
157   58 3.742 [cli            ]
158   59 3.742 [cli            ] IP-address : 2001:470:ed44::4d6d:0:3c15:0
159   60 3.742 [cli            ] End-point  : up = yes method static
160   61 3.742 [cli            ] Prefix     : 2001:470:ed44::/64
161   62 3.742 [cli            ] GW         : fe80::ba27:ebff:fe5a:d751
162   63 3.742 [cli            ] DNS-0      : 2001:4860:4860::8888
163   64 3.742 [cli            ] DNS-1      : fe80::1
164   65 3.742 [cli            ] MAC address: 00-11-22-33-44-41
165   66 3.742 [cli            ]
166   67 3.742 [cli            ] IP-address : fe80::7009
167   68 3.742 [cli            ] End-point  : up = yes method static
168   69 3.742 [cli            ] Prefix     : fe80::/10
169   70 3.742 [cli            ] GW         : ::
170   71 3.742 [cli            ] DNS-0      : ::
171   72 3.742 [cli            ] DNS-1      : ::
172   73 3.742 [cli            ] MAC address: 00-11-22-33-44-41
173   74 3.742 [cli            ]
174   ```
175
176## Advanced Topics
177
178### Using static IP configuration
179
180Set `ipconfigUSE_DHCP` to 0 and set the following in the
181[FreeRTOSConfig.h](FreeRTOSConfig.h) file:
182
183* `configIP_ADDR0/3`         : Set to the IP address. It is used when DHCP is disabled.
184* `configNET_MASK0/3`        : Set to the appropriate network mask.
185* `configGATEWAY_ADDR0/3 `   : Set to the Default Gateway address.
186* `configDNS_SERVER_ADDR0/3` : Set to the DNS Server address.
187
188Note that we have only tested this demo with `ipconfigUSE_DHCPv6`
189set to 0.
190
191### Enabling debug logs
192
193Set `ipconfigHAS_PRINTF` and `ipconfigHAS_DEBUG_PRINTF` to 1 in the
194[FreeRTOSIPConfig.h](FreeRTOSIPConfig.h) file.
195
196### Using Zero Copy
197
198The UDP Echo Client demo also demonstrates the UDP zero copy which can be enabled
199by setting `USE_ZERO_COPY` to 1 at the top of the
200[UDPEchoClient_SingleTasks.c](UDPEchoClient_SingleTasks.c) file.
201
202### Using the project in a different source tree
203
204The following macros in the [FreeRTOS_Plus_TCP_IPv6_Multi.props](FreeRTOS_Plus_TCP_IPv6_Multi.props)
205file can be updated to se this project in a different source tree:
206
207* FREERTOS_SOURCE_DIR    : The location of the FreeRTOS Kernel source files.
208* FREERTOS_INCLUDE_DIR   : The location of the FreeRTOS Kernel header files.
209* DEMO_COMMON_SOURCE_DIR : The location of the "common" directory of the demos.
210* PLUS_TCP_SOURCE_DIR    : The location of the FreeRTOS+TCP source files.
211* PLUS_TCP_INCLUDE_DIR>  : The location of the FreeRTOS+TCP header files.
212* UTILITIES_SOURCE_DIR   : The location of the tcp_utilities directory.
213