Hi,
If I have code in the 'components' section of a project, how do I access esp-idf headers? Everything builds fine until I include say nvs_flash.h
Then I get a file not found error when I build. Is there a cmakelists.txt configuration that exposes esp-idf to source in the /components folder? The same #include <nvs_flash.h> works fine in /main of course.
Can't reference IDF headers from /components
Re: Can't reference IDF headers from /components
Hi,
Are you using the CMake build system (this is the default in IDF v4.0 and newer)?
CMake components have to declare which other IDF components they depend on. We do this to optimize the build process. So your new component needs to declare that it depends on the nvs_flash component.
For master branch, you can read about the process here:
https://docs.espressif.com/projects/esp ... quirements
If you're using ESP-IDF v3.x with CMake, the process is slightly different.
Are you using the CMake build system (this is the default in IDF v4.0 and newer)?
CMake components have to declare which other IDF components they depend on. We do this to optimize the build process. So your new component needs to declare that it depends on the nvs_flash component.
For master branch, you can read about the process here:
https://docs.espressif.com/projects/esp ... quirements
If you're using ESP-IDF v3.x with CMake, the process is slightly different.
Re: Can't reference IDF headers from /components
Thanks Angus, very helpful!
I now follow that the /components in my project requires explicit access to each esp-idf component.
I'm using IDF v4.0, so for anyone reading this, there were two things:
1) Adding necessary IDF components with a REQUIRES addition to cmakelists.txt
2) I also forget to enable Bluetooth in menuconfig.
Both changes were needed for successful compilation and linking.
I now follow that the /components in my project requires explicit access to each esp-idf component.
I'm using IDF v4.0, so for anyone reading this, there were two things:
1) Adding necessary IDF components with a REQUIRES addition to cmakelists.txt
- idf_component_register(SRCS "app_prov.c" "app_prov_handlers.c"
- REQUIRES nvs_flash bt wifi_provisioning)
Both changes were needed for successful compilation and linking.
Who is online
Users browsing this forum: No registered users and 88 guests