Page 1 of 1

Issues while trying to add a custom board

Posted: Mon Dec 09, 2024 7:24 pm
by AndreaS73
Ubuntu 24.10, with ESP-IDF 5.3.0 and ESP-ADF from branch `master`.
Here are the steps I followed:

1. installed VSCode and ESP-IDF extension and ESP-ADF framework
2. created a new project based upon the example template `esp-adf/examples/player/pipeline_a2dp_source_stream`
3. compiled and check there are no errors (I didn't change anything from the original sample code)
4. now I want to switch from the default dev board to my custom one, so in the SDK options I set Audio HAL > Audio board > Custom auido board
5. in my source tree, I created a `components/myboard`
6. copied all the files from `esp-adf/components/audio_board/lyrat_v4_3/` to the above directory
7. added `CMakeLists.txt` and `component.mk` (see below)
8. adjusted my project's `CMakeLists.txt`, clean and build

Project tree:

Code: Select all

    $ tree . -L 3
    .
    ├── build [cutted]
    ├── CMakeLists.txt
    ├── components
    │   └── myboard
    │       ├── board.c
    │       ├── board_def.h
    │       ├── board.h
    │       ├── board_pins_config.c
    │       ├── board_pins_config.h
    │       ├── CMakeLists.txt
    │       └── component.mk
    ├── dependencies.lock
    ├── main
    │   ├── CMakeLists.txt
    │   ├── component.mk
    │   ├── Kconfig.projbuild
    │   └── main.c
    ├── Makefile
    ├── managed_components [cutted]
    ├── partitions_bt_source_example.csv
    ├── sdkconfig
    ├── sdkconfig.defaults
    ├── sdkconfig.defaults.esp32
    └── sdkconfig.old
and here is the content of the relevant files:

**Project CMakeLists.txt**

Code: Select all

    cmake_minimum_required(VERSION 3.5)
    
    set(EXTRA_COMPONENT_DIRS components)
    
    include($ENV{ADF_PATH}/CMakeLists.txt)
    include($ENV{IDF_PATH}/tools/cmake/project.cmake)
    
    project(myproject)
**main CMakeLists.txt**

Code: Select all

   set(COMPONENT_SRCS "main.c")
    set(COMPONENT_ADD_INCLUDEDIRS . ../components)
    set(COMPONENT_REQUIRES audio_hal audio_board myboard audio_pipeline)
    set(COMPONENT_PRIV_REQUIRES )
    register_component()
**myboard CMakeLists.txt**

Code: Select all

  set(COMPONENT_REQUIRES)
    set(COMPONENT_PRIV_REQUIRES audio_sal audio_hal esp_dispatcher esp_peripherals)
    
    if (CONFIG_AUDIO_BOARD_CUSTOM)
    message(STATUS "Current board name is " MyBoard)
    list(APPEND COMPONENT_ADD_INCLUDEDIRS .)
    set(COMPONENT_SRCS "board.c" "board_pins_config.c")
    endif()
    
    register_component()
**myboard component.mk**

Code: Select all

    ifdef CONFIG_AUDIO_BOARD_CUSTOM    
    COMPONENT_ADD_INCLUDEDIRS += .
    COMPONENT_SRCDIRS += .    
    endif
When I compiled it fails, returning a lot of errors like this:

Code: Select all

    /home/mark/dev/esp/esp-adf/components/audio_hal/driver/zl38063/api_lib/vproc_common.c:19:10: fatal error: board.h: No such file or directory
       19 | #include "board.h"
One for each driver being compiled, where `board.h` should be the one under `myboard` directory.

I thougth I properly added the include directives, but surely I'm missing something.
What I should add in those files in order the internal library can find the new `board.h` file?