PlatformIO Community

platformIO always can't find the "FreeRTOS.h"

I’m trying to port freeRTOS to Longan Nano and when I try to build the project, platformIO always reports “src\FreeRTOS\timers.c:36:10: fatal error: FreeRTOS.h: No such file or directory”. But actually I have put the right include path in c_cpp_properties.json.


And in the error file line, I can use “ctrl+click” to enter the included head file “FreeRTOS.h”. But if I build it, it always fails.
Could you give me some hints to solve it?

c_cpp_properties.json is only used for Intellisense and it’s a generated file that will be overwritten every time you change platformio.ini. That’s what the warning at the top of the file refers to.

Instead, use build_flags in platformio.ini or even better structure your project such that PlatformIO finds it automatically. In your case, that could be to put the entire FreeRTOS code into the lib directory.

1 Like

Hi, @manuelbl,
Firstly, thank you for your reply.
Actually, I’v tried to put the entire FreeRTOS folder under /lib . platformIO seems not to search around and configure the src and header search dir. It still reports can’t find “FreeRTOS.h”. But when I defind the search folder by hand, it succed to build.
Below is the folder list and platformio.ini. Please have a check.

1 Like

Great to hear it’s working now.

The explicit include path is likely required because PlatformIO expects the header files to be in the same directory as the source file. But for FreeRTOS, they are in a dedicated include directory.

I think you can and should remove the lib_deps entry in platformio.ini as it should not be needed and might even look in places it shouldn’t.

1 Like

Thanks for your hints.

And if I remove lib_deps=FreeRTOS, the project will not build source files from FreeRTOS.

Hi, @manuelbl,
As you know, I’m trying to port the FreeRTOS to Longan Nano and succeed at last. During the porting, I get some help from GigaDevice, the MCU vendor. They give me a reference of SDK, and I compare it with the sdk of .platformio. It looks GigaDevice updates a bit of Start.s and Entry.S.
so I just recommend platformio team to update the SDK to the newest one.