CMakeLists.txt and #include for spi_master.h

Jorgen
Posts: 51
Joined: Fri Dec 09, 2022 11:39 am

CMakeLists.txt and #include for spi_master.h

Postby Jorgen » Sun Dec 10, 2023 11:32 am

Dear all,
I have imported a framework 5.1.1 project into framework 5.1.2, and now the linker can't find some header files. I used the File-> Import facility.

I need the header files spi_master.h and spi_common.h, but how do I get them included? I have tried several permutations, but none works.
The path of the header files is: /frameworks/esp-idf-v5.1.2/components/driver/spi/include/driver/spi_master.h and the same for spi_common.h.

My CMakeLists.txt for the component needing the spi is:
idf_component_register{ SRCS "SDC.c" INCLUDE_DIRS "include" REQUIRES "driver" "esp_timer"}

In the source file SDC.c is: #include "esp_timer.h" #include "driver/spi_master.h" #include "driver/spi_common.h"

CMake finds the esp_timer.h but not spi_master.h and not spi_common.h.

How do I get spi_master.h and spi_common.h included?

I have tried to use REQUIRES "driver/spi" within idf_component_register, but that results in several error messages in red ink from the builder.

I use the Espressif IDE as is, and I use the C language.

Regards
Jorgen

ESP_Sprite
Posts: 9730
Joined: Thu Nov 26, 2015 4:08 am

Re: CMakeLists.txt and #include for spi_master.h

Postby ESP_Sprite » Mon Dec 11, 2023 12:51 am

Not sure if it's just a copy/paste error, but:
idf_component_register{ SRCS "SDC.c" INCLUDE_DIRS "include" REQUIRES "driver" "esp_timer"}
I think you should use normal brackets () rather than curly braces {} there.

Who is online

Users browsing this forum: No registered users and 90 guests