Linux simulator build fails: FreeRTOS.h: No such file or directory

I’m following the instructions at to build the linux simulator, but the make fails. Is there a configuration step missing from the instructions on the page above?

$ git clone

Cloning into 'FreeRTOS'...
Updating files:  96% (11921/12338)
Updating files: 100% (12338/12338), done.

$ cd FreeRTOS/FreeRTOS/Demo/Posix_GCC/

$ make

mkdir -p build
gcc -ggdb3 -O0 -DprojCOVERAGE_TEST=0 -D_WINDOWS_ -I. -I/home/grante/freertos/FreeRTOS/FreeRTOS/Source/include -I/home/grante/freertos/FreeRTOS/FreeRTOS/Source/portable/ThirdParty/GCC/Posix -I/home/grante/freertos/FreeRTOS/FreeRTOS/Source/portable/ThirdParty/GCC/Posix/utils -I/home/grante/freertos/FreeRTOS/FreeRTOS/Demo/Common/include -I/home/grante/freertos/FreeRTOS/FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/Include -MMD -c code_coverage_additions.c -o build/code_coverage_additions.o
code_coverage_additions.c:35:10: fatal error: FreeRTOS.h: No such file or directory
   35 | #include "FreeRTOS.h"
      |          ^~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:79: build/code_coverage_additions.o] Error 1


Hi @Grant_Edwards

The FreeRTOS.h is a submodule in the FreeRTOS/Source folder. To pull the code in, use the git submodule command $ git submodule update --init --recursive in the FreeRTOS repository. That should resolve your issue.



Thanks! I should have thought of that (it explains why the clone went so quickly). The git update did indeed allow the demo to build properly. Another option is adding --recurse-submodules to the initial clone command to do it in one step.

I’m curious: rather than grabbing all the submodules, is there an easy way to determine which ones are actually needed?


FWIW, it looks like the only submodule required is FreeRTOS/Source. Grabbing just that submodule saves about half a gigabyte of disk space.

For example:

$ git clone

$ git -C FreeRTOS submodule update --init -- FreeRTOS/Source

$ make -C FreeRTOS/FreeRTOS/Demo/Posix_GCC

$ ./FreeRTOS/FreeRTOS/Demo/Posix_GCC/build/posix_demo

Yes that’s true, for just running the Kernel demo this is all you need. We have added sub modules that are needed for the various demos in FreeRTOS, so in this case you won’t need those.