fatal error: driver/gpio.h: No such file or directory

hoo_wave
Posts: 14
Joined: Mon Dec 11, 2023 2:57 am

fatal error: driver/gpio.h: No such file or directory

Postby hoo_wave » Thu Feb 01, 2024 1:49 am

I copy the UART/uart_echo demo as one of my project components,but i came across this issue when i complie it:
fatal error: driver/gpio.h: No such file or directory

this is the C file include :

Code: Select all

#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "driver/gpio.h"
#include "driver/uart.h"
#include "sdkconfig.h"
#include "esp_log.h"
this is the CMakeList.txt in directory components/uart,I even add the INCLUDE_DIRS "E:/esp/esp-idf/components/",but it didn't work

Code: Select all

idf_component_register(SRCS "pmfbj_uart.c"
                    INCLUDE_DIRS "."
                    INCLUDE_DIRS "E:/esp/esp-idf/components/")
this is the .vscode/c_cpp_properties.json

Code: Select all

{
    "configurations": [
        {
            "name": "ESP-IDF",
            "compilerPath": "${config:idf.toolsPath}\\tools\\riscv32-esp-elf\\esp-12.2.0_20230208\\riscv32-esp-elf\\bin\\riscv32-esp-elf-gcc.exe",
            "includePath": [
                "${config:idf.espIdfPath}/components/**",
                "${config:idf.espIdfPathWin}/components/**",
                "${config:idf.espAdfPath}/components/**",
                "${config:idf.espAdfPathWin}/components/**",
                "${workspaceFolder}/**"
            ],
            "browse": {
                "path": [
                    "${config:idf.espIdfPath}/components",
                    "${config:idf.espIdfPathWin}/components",
                    "${config:idf.espAdfPath}/components/**",
                    "${config:idf.espAdfPathWin}/components/**",
                    "${workspaceFolder}"
                ],
                "limitSymbolsToIncludedHeaders": false
            }
        }
    ],
    "version": 4
}
this is the terminal output,I can't find the driver directory in it

Code: Select all

FAILED: esp-idf/uart/CMakeFiles/__idf_uart.dir/pmfbj_uart.c.obj 
E:\esp\.espressif\tools\riscv32-esp-elf\esp-12.2.0_20230208\riscv32-esp-elf\bin\riscv32-esp-elf-gcc.exe -DESP_PLATFORM -DIDF_VER=\"v5.1.1\" -DSOC_MMU_PAGE_SIZE=CONFIG_MMU_PAGE_SIZE -D_GNU_SOURCE -D_POSIX_READER_WRITER_LOCKS -IE:/H3/passthrough_module/code/build/config -IE:/H3/passthrough_module/code/components/uart -IE:/esp/esp-idf/components -IE:/esp/esp-idf/components/newlib/platform_include -IE:/esp/esp-idf/components/freertos/FreeRTOS-Kernel/include -IE:/esp/esp-idf/components/freertos/FreeRTOS-Kernel/portable/riscv/include -IE:/esp/esp-idf/components/freertos/esp_additions/include/freertos -IE:/esp/esp-idf/components/freertos/esp_additions/include -IE:/esp/esp-idf/components/freertos/esp_additions/arch/riscv/include -IE:/esp/esp-idf/components/esp_hw_support/include -IE:/esp/esp-idf/components/esp_hw_support/include/soc -IE:/esp/esp-idf/components/esp_hw_support/include/soc/esp32c3 -IE:/esp/esp-idf/components/esp_hw_support/port/esp32c3/. -IE:/esp/esp-idf/components/esp_hw_support/port/esp32c3/private_include -IE:/esp/esp-idf/components/heap/include -IE:/esp/esp-idf/components/log/include -IE:/esp/esp-idf/components/soc/include -IE:/esp/esp-idf/components/soc/esp32c3 -IE:/esp/esp-idf/components/soc/esp32c3/include -IE:/esp/esp-idf/components/hal/esp32c3/include -IE:/esp/esp-idf/components/hal/include -IE:/esp/esp-idf/components/hal/platform_port/include -IE:/esp/esp-idf/components/esp_rom/include -IE:/esp/esp-idf/components/esp_rom/include/esp32c3 -IE:/esp/esp-idf/components/esp_rom/esp32c3 -IE:/esp/esp-idf/components/esp_common/include -IE:/esp/esp-idf/components/esp_system/include -IE:/esp/esp-idf/components/esp_system/port/soc -IE:/esp/esp-idf/components/esp_system/port/include/riscv -IE:/esp/esp-idf/components/esp_system/port/include/private -IE:/esp/esp-idf/components/riscv/include -IE:/esp/esp-idf/components/lwip/include -IE:/esp/esp-idf/components/lwip/include/apps -IE:/esp/esp-idf/components/lwip/include/apps/sntp -IE:/esp/esp-idf/components/lwip/lwip/src/include -IE:/esp/esp-idf/components/lwip/port/include -IE:/esp/esp-idf/components/lwip/port/freertos/include -IE:/esp/esp-idf/components/lwip/port/esp32xx/include -IE:/esp/esp-idf/components/lwip/port/esp32xx/include/arch -march=rv32imc_zicsr_zifencei  -fdiagnostics-color=always -ffunction-sections -fdata-sections -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=unused-but-set-variable -Wno-error=deprecated-declarations -Wextra -Wno-unused-parameter -Wno-sign-compare -Wno-enum-conversion -gdwarf-4 
-ggdb -nostartfiles -Og -fmacro-prefix-map=E:/H3/passthrough_module/code=. -fmacro-prefix-map=E:/esp/esp-idf=/IDF -fstrict-volatile-bitfields -fno-jump-tables -fno-tree-switch-conversion -DconfigENABLE_FREERTOS_DEBUG_OCDAWARE=1 -std=gnu17 -Wno-old-style-declaration -MD -MT esp-idf/uart/CMakeFiles/__idf_uart.dir/pmfbj_uart.c.obj -MF esp-idf\uart\CMakeFiles\__idf_uart.dir\pmfbj_uart.c.obj.d -o esp-idf/uart/CMakeFiles/__idf_uart.dir/pmfbj_uart.c.obj -c E:/H3/passthrough_module/code/components/uart/pmfbj_uart.c
E:/H3/passthrough_module/code/components/uart/pmfbj_uart.c:12:10: fatal error: driver/gpio.h: No such file or directory        
   12 | #include "driver/gpio.h"
      |          ^~~~~~~~~~~~~~~
compilation terminated.

User avatar
ok-home
Posts: 78
Joined: Sun May 02, 2021 7:23 pm
Location: Russia Novosibirsk
Contact:

Re: fatal error: driver/gpio.h: No such file or directory

Postby ok-home » Thu Feb 01, 2024 2:30 am

Hi
Add REQUIRES

Code: Select all

idf_component_register(SRCS "pmfbj_uart.c"
                INCLUDE_DIRS "."
   		REQUIRES    driver

hoo_wave
Posts: 14
Joined: Mon Dec 11, 2023 2:57 am

Re: fatal error: driver/gpio.h: No such file or directory

Postby hoo_wave » Thu Feb 01, 2024 2:50 am

ok-home wrote:
Thu Feb 01, 2024 2:30 am
Hi
Add REQUIRES

Code: Select all

idf_component_register(SRCS "pmfbj_uart.c"
                INCLUDE_DIRS "."
   		REQUIRES    driver
Thanks for your reply! It works for me

Who is online

Users browsing this forum: Bing [Bot] and 140 guests