How to add custom board config?

serjy1710
Posts: 1
Joined: Wed Apr 14, 2021 2:15 pm

How to add custom board config?

Postby serjy1710 » Wed Apr 14, 2021 2:31 pm

Hello friends,
Pls. give me advice or sample, how to add my custom board config into ESP-ADF project proper way?
I've tried to choose "Custom audio board" in "Audio HAL" section of SDK Config, and add "MyBoard" component in project "components" folder, with customized "board.h", "board.c", "board_defs" etc.
Component use basic CMakeLists.txt.
But, when i try to compile project, i get a lot of errors from other ESP-ADF components with the same reason: ".espressif/esp-adf/components/display_service/led_bar/led_bar_ws2812.c:27:10: fatal error: board.h: No such file or directory
#include "board.h""

As i guess, i could add my custom board definition in common storage ".espressif\esp-adf\components\audio_board", and edit CMakeLists.txt for this "component", but i'm not sure it's proper way to edit ESP-ADF config files. I suppose, should be a right way to add my own component without such modification, using predefined way.
Unfortunately, i can't find any docs about custom board implementation..
Could anyone show me this way, o give a link to sample project?

Thank you very much!

quenolio
Posts: 3
Joined: Mon Nov 02, 2020 8:34 am

Re: How to add custom board config?

Postby quenolio » Thu Apr 29, 2021 9:39 am

Hi serjy1710,

The way I have done that is simply create new folder in your project components (such as "MyBoard"). Next copy content of one of supported boards (in ADF components/audio_board. Ex. lyrat_v4_3) and copy include folder from the same ADF source (with board_pins_config.h). Next you can copy or create CMakeLists.txt and component.mk files and make sure they will have if(CONFIG_AUDIO_BOARD_CUSTOM) statement. Examples below. I used ADF v2.1.

CMakeLists.txt

Code: Select all

# 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)

if(CONFIG_AUDIO_BOARD_CUSTOM)
message(STATUS "Current board name is " CONFIG_AUDIO_BOARD_CUSTOM)
list(APPEND COMPONENT_ADD_INCLUDEDIRS .)
set(COMPONENT_SRCS "board.c" "board_pins_config.c")
endif()

register_component()

IF (IDF_VER MATCHES "v4.")
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_VER MATCHES "v3.")
set_property(TARGET idf_component_audio_board APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES  $<TARGET_PROPERTY:${COMPONENT_TARGET},INTERFACE_INCLUDE_DIRECTORIES>)

set(CFLAGS -std=c11  -Wall -Wextra -pedantic -Werror)
set(CXXFLAGS -std=c++11 -Wall -Wextra -pedantic -Werror)

ENDIF (IDF_VER MATCHES "v4.")
component.mk

Code: Select all

ifdef CONFIG_AUDIO_BOARD_CUSTOM

COMPONENT_ADD_INCLUDEDIRS += .
COMPONENT_SRCDIRS += .

endif
At the end select "Custom audio board" in "Audio HAL" section of SDK Config. Please make sure that creating custom board component from existing one will compile and work and then you can modify your custom board code to your preferences.

Hope this will work for you :D

werty37
Posts: 3
Joined: Sun Jan 16, 2022 6:18 am

Re: How to add custom board config?

Postby werty37 » Sun Jan 23, 2022 2:03 pm

Tried following the instructions but for some reason, the board won't show up in menuconfig. I am using an ESP32 Audio Kit v2.2 3378 by Aithinker.

Appended the following to component.mk

Code: Select all

# Added AI THINKER V2.2 3378
ifdef CONFIG_ESP_AI_THINKER_V2_2_3378_BOARD
COMPONENT_ADD_INCLUDEDIRS += ./ai_thinker_v2_2_3378
COMPONENT_SRCDIRS += ./ai_thinker_v2_2_3378
endif
#
Appended the following to CMakeLists.txt

Code: Select all

# Added AI THINKER V2.2 3378
ifdef CONFIG_ESP_AI_THINKER_V2_2_3378_BOARD
COMPONENT_ADD_INCLUDEDIRS += ./ai_thinker_v2_2_3378
COMPONENT_SRCDIRS += ./ai_thinker_v2_2_3378
endif
#
Here is my board files path,
Image

Here is the menuconfig audio board screen
Image

Where am I going wrong? Any pointers please?

Who is online

Users browsing this forum: No registered users and 20 guests