I would like to know if it is possible to use the IP stack provided by FreeRTOS without using FreeRTOS itself.
I’m building a bootloader that will receive a new application through an EThernet/IP interface but I don’t need the multitasking provided with FreeRTOS.
The FreeRTOS_IP.c file includes the FReeRTOS files
/* FreeRTOS includes. */ #include “FreeRTOS.h” #include “task.h” #include “queue.h” #include “semphr.h”
I’m afraid the FreeRTOS+ branded libraries are coupled to the FreeRTOS kernel. That is one of the ways we keep the code size down. So FreeRTOS+TCP does require the FreeRTOS kernel. The new ‘core’ branded libraries (such as coreMQTT) are completely decoupled from everything (TCP stack, TLS stack, FreeRTOS, or even multithreading).
Can I get the FreeRTOS IP stack from coreMQTT?
Is it the same? I’m using a STM32F767.
If I have to use the FreeRTOS + IP stack I assume that what is not used from FreeRTOS and IP stack will be discarded by the Linker. (I have to try to keep the code below 64K, and the IP stack is already around 30K)
coreMQTT can be used with any stack. See https://www.freertos.org/network-interface.html - so if you use the ST tools to create an lwIP project you can still sue coreMQTT. Alternatively, if you are using FreeRTOS anyway, you could use the FreeRTOS+TCP stack. The compiler will remove unused code - not if you are using GCC then you have to tell it to do that explicitly with the command line options - I forget exactly what they are but something like -fdata-sections and -ffunction-sections to the compiler, then --fgcc-sections to the linker.
Also as documented the code size of the stack can shrinked by omitting non-essential features like DNS or DHCP and using the optimizer.
Your application gets even smaller when using link-time-optimization ‘LTO’ provided by newer compilers like GCC.
In some of my projects, I use UDP to download a new image. TCP can be disabled in FreeRTOSIPConfig.h:
#define ipconfigUSE_TCP 0
If you use TCP, you can keep the code smaller by ommitting sliding TCP windows:
Note that FreeRTOS+TCP doesn’t use the FreeRTOS timers, so you can disable them in FreeRTOSConfig.h:
#define configUSE_TIMERS 0
And also, you can decide whether to use DNS, DHCP, ICMP/ping.
If you disable DHCP, the bootloader could use the IP-address which was assigned to the application.
Many other properties are disabled by default, see FreeRTOSIPConfigDefaults.h
the IP stack is already around 30K
It is difficult to do these measurements. arm-none-eabi-size will show the code size of each module, but it doesn’t know which functions will be linked. Like @rtel mentioned, unused function will not be linked into the project when -ffunction-sections ( compiler ) and -Wl,--gc-sections( linker ) are used.
If you’re interested in getting the code as small as possible, we can discuss things in this thread.
The image is about 200K, but could grow to a maximum of 500K.
All systems are in a LAN.
THe systems could be considered quite fast. The embedded system is based on a STM32F767ZI and the host is a Linux system.