I am new to the ESP32 board and I am trying to get my development environment setup using PlatformIO using VScode. I have been reading over the docs to understand the project structure. There are “components” in the build structure which essentially act like configurations specifically related to the ESP32 firmware. Right now, I am trying to build and run the blink example code from the espressif32 github but I cannot get my PlatformIO project to recognize a required component for it.
The example component specifies which pin the LED is on and there is a typedef in the main.c script directly references it. I need this component included in the project structure correctly to be able to compile it successfully.
In the platformIO documentation there is information on how to add 3rd party components to a project. I am supposed to add it to the optional ‘components’ directory of my project. No “components” folder was automatically generated in my case. If I create one myself and insert the Kconfig.projbuild
file into this directory, the compiler will still tell me that the typedef macro is not valid when trying to build the project so it still not recognizing it.
The PlatformIO docs additionally do not specify how you can create your own components instead of using already written ones. Within the ESP-IDF documentation, there is a mention that can create a new component using the idf.py create-component
command. However when entering this into the project’s terminal, it throws an error saying that it cannot find idf.py.
From what I understand, PlatformIO uses a different build structure than ESP-IDF-- sort of like a wrapper. I noticed that when you go to the PlatformIO project tasks menus and select the “Run Menuconfig” option, this is what gets entered into the terminal:
> Executing task: C:\Users\Aspen\.platformio\penv\Scripts\pio.exe run --target menuconfig --environment esp32-s2-saola-1 <
When I try and run pio.exe
with the same idf.py create-component
argument, it throws an error saying that it is an invalid argument. pio.exe
is not a python script, it’s an executable. So I can’t look at the possible arguments related to this particular framework in the source code or anything like that. But I can probably safely assume that it is not compatible with the same idf.py
arguments except for menuconfig
which seems to be supported.
What do I have to do in order to get components included into my project?
How can I create a brand new component with a newly generated cmakelists.txt
that is included into the project?
How can I check what version of the framework PlatformIO is using for the project?
Note: I had issues updating PlatformIO on windows 7. It does not seem to like version 2.3 so I am still on version 2.2.1. PlatformIO core is 5.1.0 and Home is 3.3.3, which still seems to be the latest.