Where can I find the example project FreeRTOS_Plus_TCP for STM32F4xxx?

FreeRtos community,
I have clone the git https://github.com/FreeRTOS/FreeRTOS-Labs.git
and https://github.com/FreeRTOS/FreeRTOS.git, together with the related submodules. But I failed to find the example project FreeRTOS_Plus_TCP_and_FAT_STM32F4xxx. I saw it was mentioned in the Library document and also in this forum.
Do I need clone a new git to get the project?
I just start to use FreeRTOS, so the question seems silly.


Hello Li, the last time I saw those demos on FreeRTOS.org, they sat in a ZIP file from 2016. That is too old, all libraries have changed since than.

However, I still maintain copies of those old projects, and I turned them into Makefile projects, so I can compile them from a command-line.

You can use them in Eclipse as well: import it as a Makefile project.

You find a ZIP-file here

Please open the directory stm32F40\Src, and have a look in config.mk.
It has defines as ipconfigUSE_HTTP and ipconfigUSE_FTP.
You will also find a lot of testing code, sorry for the mess.
But don’t hesitate to ask questions here if you don’t understand something.
Mentioned directory stm32F40\Src also contains the .cprojectand.project files for Eclipse.

Thank you for your source. It seems the USE_IPERF should be disables. Otherwise the link failed.
It seems your makefile includes some program/debug target. Are they based on openocd? If not, what’s your solution for that. I am also interested in setup some STM32 development environment without an IDE.


Using USE_IPERF should work, at least the sources is included as Common/Utilities/iperf_task_v3_0d.c.

IPERF needs some setting in your FreeRTOSIPConfig.h file. You find them in /stm32F40/Inc/FreeRTOSIPConfig.h.

It seems your makefile includes some program/debug target

As for debugging I used OpenSTM32 System Workbench, using openocd. Make sure you add the plugin and that you enter absole paths for both GDB and OpenOCD.

I often use bootloaders or a separate ST-LINK utility. In those cases I run Make from my editor to compile the project.

Here is a picture of possible OpenOCD settings:

I hope it works for you.

The link error with “USE_IPERF” is: undefined reference to `vListInsertGeneric’.
So you are not using “make debug” or “make program” to debug on the real target, right?


Ah yes, vListInsertGeneric() is defined in FreeRTOS_TCP_WIN.c and very recently it has become static because we thought that it was not used i any other module. I forgot about the utilities.

For now you can take away the static keyword in front of it ( also in the function header ).

Yes. Removing static will work. I had thought the file FreeRTOS_TCP_WIN.c is only for windows simulator. :slight_smile:

I had thought the file FreeRTOS_TCP_WIN.c is only for windows simulator.

That is a logical conclusion. But as you may have seen, it does the logic of TCP windowing mechanism.
It depends on the macro ipconfigUSE_TCP_WIN. When not defined, TCP will use a windows size of 1 segment, and so every segment must be acknowledged individually. That is a bit slower, but it saves on RAM: less buffering is needed.
When TCP windows are used, you can determine the window- and buffer size with a socket option FREERTOS_SO_WIN_PROPERTIES.
But I’m glad to hear that the Makefile project works for you!

Thank you for your quick and detailed replies. It makes the FreeRTOS so attactive.

I just use your code on my board. It seems something wrong. Here are the logs,can you see anything abnormal? If possible, can you share your logs? Thanks.

xPhyConfigure: No PHY’s detected.
prvIPTask started
xPhyReset: phyBMCR_RESET 0 ready
+TCP: advertise: 01E1 config 3100
prvEthernetUpdateConfig: LS mask 00 Force 1
Autonego ready: 00000004: full duplex 100 mbit high status
Network buffers: 14 lowest 14
Queue space: lowest 23
Link Status is high
DHCP Discover address c0a80172ip
prvInitialiseDHCP: start after 250 ticks
vDHCPProcess: discover
Network buffers: 13 lowest 13
Queue space: lowest 22
vDHCPProcess: discover
vDHCPProcess: timeout 10000 ticks
Network buffers: 12 lowest 12
TX DMA buffers: lowest 2
vDHCPProcess: discover
vDHCPProcess: timeout 20000 ticks
Network buffers: 11 lowest 11
TX DMA buffers: lowest 1
vDHCPProcess: giving up 40000 > 30000 ticks
IP Address:
Subnet Mask:
Gateway Address:
DNS Server Address:
prvServerWorkTask starts running
Socket 2020 -> 0ip:0 State eCLOSED->eTCP_LISTEN
TcpTester: Socket on port 2020
prvCommandTask started
xTelnetCreate: socket created: rc 0 port 23
Network buffers: 10 lowest 10
TX DMA buffers: lowest 0
Network buffers: 10 lowest 9


Seem I forgot to enable interrupt. Now the DHCP works

Very good, thanks for reporting back.

One more question about the network driver.
It seems we define vApplicationIPNetworkEventHook only to monitor the network up event. Suppose the network is not stable. And there may be several breaks since the device power up. Is it safe to ignore the network up/down event?
What’s more, I manually added the network up event check in vApplicationIPNetworkEventHook. It seems the function is not invoked after I un-plug the ethernet wire. There is just some PHY messages poped out after about 5 seconds.
It seems we don’t care about the network break at all.