Can't build project with custom board descrition (fatal error: board.h: No such file or directory) (AUD-6410)
Environment
- Audio development kit: ESP32-C3-Lyra-v2.0
- IDF version: v5.4
- ADF version: v2.7-105-g4200c64d
- Build system: CMake
- Compiler version: 14.2.0
- Operating system: Windows
- (Windows only) Environment type: IDE? (i dont know)
- Using an IDE?: VS Code 1.100.3 with ESP-IDF 1.9.1 plugin
Problem Description
Сan't build project with custom board description. I understand that the problem is in the configuration of the Cmake files, but I can't figure out what is wrong.
I found similar problems with other users but couldn't find a solution. 1 2
please help me 🥺
Expected Behavior
successful project build
Actual Behavior
The build ends with an error: fatal error: board.h: No such file or directory
Steps to Reproduce
- create project based on example play_http_mp3_example
- select esp32-c3 and ESP32-C3-Lyra-v2.0 as target
- try to compile... (great success✅)
- copy all files from esp-adf\components\audio_board\esp32_c3_lyra in to project folder (project_name/components/custom_board)
- Add Cmake/make/Kconfig files like in example
- Select custom audio board option in sdkconfig
- Try to build... (error❌)
fatal error: board.h: No such file or directory
Code to Reproduce This Issue
Build log
Hello P0nyHunt3r,
I am just a simple user of esp adf but maybe I can help.
Looking at your project, I think you should move "components/CMakeLists.txt" file inside the "components/custom_board" folder and change it to:
idf_component_register( SRCS "board.c" "board_pins_config.c" "C3_lyra_sys_pattern.c"
INCLUDE_DIRS .
PRIV_REQUIRES esp_peripherals audio_sal audio_hal esp_dispatcher display_service )
You shouldn't need the "components/Kconfig.projbuild" and "components/component.mk" files.
Hope that helps.
@rjoly-getraline I tried to do it this way, but it didn't work completely. log
I noticed that my "custom_board" folder appeared in the logs. The libraries that the example uses have "audio_board" in the CMakeList.
After renaming my component folder to the "audio_board", the example successfully built.
I don't think this is an elegant way. Maybe I'm missing something or the esp-adf example is outdated. 🥺
You can modify the CMakeLists.txt file as follows to add custom_board to the environment variable COMPONENT_ADD_INCLUDEDIRS:
# Edit following two lines to set component requirements (see docs)
set(COMPONENT_REQUIRES)
set(COMPONENT_PRIV_REQUIRES audio_sal audio_hal esp_dispatcher esp_peripherals display_service json)
message(STATUS "Use customs board component")
list(APPEND COMPONENT_ADD_INCLUDEDIRS ./)
set(COMPONENT_SRCS
./board.c
./board_pins_config.c
)
register_component()
IF (IDF_VERSION_MAJOR GREATER 3)
idf_component_get_property(audio_board_lib audio_board COMPONENT_LIB)
set_property(TARGET ${audio_board_lib} APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${COMPONENT_LIB})
ELSEIF (IDF_VERSION_MAJOR EQUAL 3)
set_property(TARGET idf_component_audio_board APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES $<TARGET_PROPERTY:${COMPONENT_TARGET},INTERFACE_INCLUDE_DIRECTORIES>)
ENDIF (IDF_VERSION_MAJOR GREATER 3)