How to add gpio component
Posted: Thu Nov 21, 2024 12:38 am
This should be very simple... I have over 30 years of embedded devlopment experience with makefiles of various flavors.
I've started with the hello_world example project from the IDF tree. Compiled and flashed it fine and it works.
Now I want to add a simple GPIO toggle LED to the same project. I copy a few lines of code from the example generic_gpio project. I get the compilation error can't find some GPIO definitions. Some googling has me adding 'REQUIRES driver' to the hello_world project CMakeList.txt file. What I find interesting is that the generic_gpio project DOESN'T have the REQUIRES line in its file. I compiled that project without errors.
My CMakeList.txt now looks like this:
When I compile, I now get the error "No such file or directory: "esp_flash.h"!?!?
Somehow adding the REQUIRES command seems to mess up the include paths that did work? And why does one project need the REQUIRES line and another doesn't? Any idea what's going on?
Thanks
Kevin
I've started with the hello_world example project from the IDF tree. Compiled and flashed it fine and it works.
Now I want to add a simple GPIO toggle LED to the same project. I copy a few lines of code from the example generic_gpio project. I get the compilation error can't find some GPIO definitions. Some googling has me adding 'REQUIRES driver' to the hello_world project CMakeList.txt file. What I find interesting is that the generic_gpio project DOESN'T have the REQUIRES line in its file. I compiled that project without errors.
My CMakeList.txt now looks like this:
Code: Select all
idf_component_register(SRCS "hello_world_main.c"
INCLUDE_DIRS "."
REQUIRES driver)
Somehow adding the REQUIRES command seems to mess up the include paths that did work? And why does one project need the REQUIRES line and another doesn't? Any idea what's going on?
Thanks
Kevin