PlatformIO Community

Can't find include files

I’m trying to build a program for a Adafruit ESP32 feather. I have run some examples successfully but now I’m trying to compile in come other code I have and the compiler is not able to file some basic include files like string.h. I turned on verbosity and see the errors:

ignoring nonexistent directory “C:/Users/dseltz/.platformio/platforms/espressif32/builder/Â C:/Users/dseltz/Documents/PlatformIO/projects/MicroESP32Freetos/include/freertos”

I’m trying to specify my include directories in my platformio.ini file this way:

[env:featheresp32]
platform = espressif32
board = featheresp32
framework = arduino
build_flags =
    -DOSAPI_OS_DEF_H=\"osapi_os_freertos.h\"
    -DUDP_EXCLUDE_BUILTIN
    -TARGET="armFreeRTOSgcc"
    -I C:\Users\dseltz/Documents/PlatformIO/projects/MicroESP32Freetos/include/freertos
    -I C:/Users/dseltz/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/newlib
    -I C:/Users/dseltz/Documents/PlatformIO/projects/MicroESP32Freetos/include
    -I C:/Users/dseltz/Documents/PlatformIO/projects/MicroESP32Freetos/include/osapi
    -I C:/Users/dseltz/Documents/PlatformIO/projects/MicroESP32Freetos/src/dds_c/domain
    -I C:/Users/dseltz/Documents/PlatformIO/projects/MicroESP32Freetos/src/dds_c/infrastructure
    -I C:/Users/dseltz/Documents/PlatformIO/projects/MicroESP32Freetos/src/dds_c/publication
    -I C:/Users/dseltz/Documents/PlatformIO/projects/MicroESP32Freetos/src/dds_c/subscription
    -I C:/Users/dseltz/Documents/PlatformIO/projects/MicroESP32Freetos/src/dds_c/topic
    -I C:/Users/dseltz/Documents/PlatformIO/projects/MicroESP32Freetos/src/dds_c/type

What am I doing wrong?

I’m using Visual Studio Code with the Platformio extension.

Here is the error line:

C:/Users/dseltz/.platformio/packages/framework-arduinoespressif32/libraries/BLE/src/FreeRTOS.h:11:18: fatal error: string: No such file or directory

Sounds like the line #include <string> causes an error. Well, FreeRTOS has C codebase, and string is a C++ standard header, so that error seems to strange to me. Where I can find that “MicroESP32Freertos” library for inspection?

1 Like

Hi maxgerhardt,
The code base is DDS and I’ll see if I can make it available. It has already been run many times with Freertos when built with other platforms (not with a arduino platform yet). But I’ll check to see if maybe that is a problem.

Thanks for the help.

Dave

But what I don’t understand is:

  1. Why is it looking for FreeRTOS.h in the directory: C:/Users/dseltz/.platformio/packages/framework-arduinoespressif32/libraries/BLE/src/FreeRTOS.h. It is not in my include list.

  2. Why am I getting the message: "ignoring nonexistent directory “C:/Users/dseltz/.platformio/platforms/espressif32/builder/Â C:/Users/dseltz/Documents/PlatformIO/projects/MicroESP32Freetos/include/freertos”

But it’s autodetected by the library dependency finder since it actually has a FreeRTOS.h and also C++ wrappers for it: https://github.com/espressif/arduino-esp32/tree/master/libraries/BLE/src. There’s also the #include <string> (here), whic happens in C++ code, so that’s actually ok and the compiler should find it…

You should attempt to ignore that library by doing lib_ignore = BLE for the time being.

Why are you specifically including this SDK include path here?

Please also note that just including the include directory of the library will not actually build source code of it. You should include the FreeRTOS code differently, e.g. by the means of a library.

Then you also have to take care that the FreeRTOS V8.2.0, which is built into Arduino-ESP32, somehow isn’t built. (see https://github.com/espressif/arduino-esp32/tree/1efcd21ba91c08e702a0c6e47e00a2d0a8c06b84/tools/sdk/include/freertos/freertos). I see this as a rather difficult task, since this FreeRTOS also has plenty of modifications to support the dual-core nature of the chip (https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/freertos-smp.html) and other parts of the Arduino SDK are intertwined with it.

Maybe you want to start from scratch with like a baremetal framework?

Also did you mean -DTARGET=.." hereAnd Whyarm` as the target for an ESP32 / XTensa32 core?

So this folder 100% exists when you paste the path into an explorer?

HI maxgerhardt,
This is a great help. I don’t want to build any freertos code. I just need to run on top of it and need access to freertos.h which is references from my code.

I did try to add lib_ignore = BLE and remove two of the include paths:

[env:featheresp32]
platform = espressif32
board = featheresp32
framework = arduino
lib_ignore = BLE
build_flags =
    -DOSAPI_OS_DEF_H=\"osapi_os_freertos.h\"
    -DUDP_EXCLUDE_BUILTIN
    -TARGET="armFreeRTOSgcc"
    -I C:\Users\dseltz/Documents/PlatformIO/projects/MicroESP32Freetos/include/freertos
;    -I C:/Users/dseltz/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/newlib
    -I C:/Users/dseltz/Documents/PlatformIO/projects/MicroESP32Freetos/include
    -I C:/Users/dseltz/Documents/PlatformIO/projects/MicroESP32Freetos/include/osapi
    -I C:/Users/dseltz/Documents/PlatformIO/projects/MicroESP32Freetos/src/dds_c/domain
    -I C:/Users/dseltz/Documents/PlatformIO/projects/MicroESP32Freetos/src/dds_c/infrastructure
    -I C:/Users/dseltz/Documents/PlatformIO/projects/MicroESP32Freetos/src/dds_c/publication
    -I C:/Users/dseltz/Documents/PlatformIO/projects/MicroESP32Freetos/src/dds_c/subscription
    -I C:/Users/dseltz/Documents/PlatformIO/projects/MicroESP32Freetos/src/dds_c/topic
    -I C:/Users/dseltz/Documents/PlatformIO/projects/MicroESP32Freetos/src/dds_c/type

but I still get:

*GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072*
*Compiler executable checksum: f8c150667b22ef24be0575fd93addc63*
*In file included from include/osapi/osapi_os_freertos.h:30:0,*
*                 from include/osapi/osapi_os.h:43,*
*                 from include/osapi/osapi_config.h:109,*
*                 from include/osapi/osapi_types.h:34,*
*                 from include/cdr/cdr_stream.h:36,*
*                 from src\cdr\stream\md5.c:111:*
*C:/Users/dseltz/.platformio/packages/framework-arduinoespressif32/libraries/BLE/src/FreeRTOS.h:11:18: fatal error: string: No such file or directory*

This points to: #include "<string>"

And yes the path: C:/Users/dseltz/Documents/PlatformIO/projects/MicroESP32Freetos/include/freertos exists.

Hi @maxgerhardt I have created a small reproducer that I can share if you have time to look at it. How would I share it?

You could use github or a google drive upload, for example.

Here is the example PlatformIO project: https://drive.google.com/open?id=17OYKPYrndNy3JlnibPJmfiH8teT4RfQQ

Thanks for the help