Esp32 ADF - Audio Dev Framework - Please Help

Ah you solved it faster than I could have had a look at it. Good that it’s working now :slight_smile: .

Anyway, thank you @maxgerhardt. I am totally new about platformIO. IDF manufacturer tool is too slow, ^^. Have a good weekend. ^^

Dear @maxgerhardt.
How we can change the default include path in platformIO.
Because compare with latest SDK of IDF, the structure tree of “bt” folder already different.
How we can deal with this? We make another library as we did with ADF or any better solution Mr.maxgerhardt. So sorry, I still don’t know your name :((


IDF

So the latest ESP-ADF needs the latest ESP-IDF now and you want to integrate it? The build structure has changed significantly and must be picked up by PlatformIO first in the GitHub - platformio/platform-espressif32: Espressif 32: development platform for PlatformIO platform. The build files there also controll all the subcomponents and include paths.

Many thanks for your reply, happy new year ^^.
Yes, I want to use the coex example: combine A2DP to stream the music and BLE to control the device. But this kind of project require the latest SDK version, so that why I need to merge the project.
So I will focus how to custom the platform first. Many thanks your advice ^^.

Hi there!

I have a similar setup: LyraT 4.3
I am very new to platformIO (I compiled ready made projects for a different board).
So far I read a lot of different guides (VSCode esp-idf, platformio, espressif) on how to setup an environment. The espressif native way seems to work ok, however I am greatly unhappy about non-existent IDE, so I would rather like to use something like VSCode with PlatformIO. In many guides I seem to miss crucial info, that seem very obvious to everybody else.

Having said that, I would be very grateful for input on setup.

To me the instructions above sound reasonable, yet, I do not understand many things that have to be done.
Would you or someone else be so kind as to point me to a step by step guide for ESP-ADF that details out things like:

  • build_unflags - what needs to be written in there in order to unflag the correct lib? Which lib needs to be flagged out, the IDF one or the ADF one?
  • Do I have to select the board from the platformio interface? There I do not find anything named lyrat or similar. Which board do I need to select? Or is the definition in the provided platformio.ini already sufficient?
  • Where in platformio.ini and how should I set the library search path?

Thanks a lot!!
Cheers

Hi all,

since this thread is kind of the main thread for ESP-ADF + pIO, I thought I’d share this for everyone who’s still struggling with getting it to work: Since pIO supports external components, it’s possible to just add the components of ESP-ADF to your project and it will compile just fine with a few lines added to platform.ini:

1.) Embed the duerOS profile binary in the firmware
board_build.embed_txtfiles = components/dueros_service/duer_profile

2.) Configure a supported board:
build_flags = -D CONFIG_ESP_LYRATD_MSC_V2_2_BOARD

3.) Fix an error in the linker-script generation (see this pIO thread and this related GitHub issue):
build_unflags = -Wl,--end-group

I created a GitHub repo with a pre-configured project containing the ESP-ADF TCP-Client example. It uses the most recent ESP-IDF version supported by pIO framework-espidf 3.40300.0 (4.3.0) with ESP-ADF v2.3.

Thanks @denmuellner for your post! This helped a lot.

If someone is looking for an example with Esp32 ADF, MAX98357A and PlatformIO, here is the Repo:

Cheers,
Felix

Hello,
Is there a hint on how to make a project with latest IDF and ADF version? i tried all the above, most wont work anymore, the last link GitHub - don41382/esp32-adf-max98357-with-platformio: This is a quick start example to use ESP32-ADF with the MAX98357A with platformio. will work if unmodified, but both IDF and ADF are very old version (IDF 4.3 and ADF 2.3) which makes it unsuitable, when i tried to simply modify the IDF version in platformio.ini it wont compile anymore due to errors with Failed to resolve component 'jsmn

1 Like

I am also keen on this in the latest version - did anyone get anywhere with this? Otherwise I will give it a go in spare time.

Been struggling with ADF for the past few hours. I’d like to share some progress.

I have tried every combination of platform from version 5.4.0 to 6.5.0 and ADF version v2.4 to v2.6 and master (49f80aaf by the time I’m writing this).

Here’s how I setup the environment:

  • Clone the ESP-ADF framework to the project root, and checkout to the specific tag. Don’t forget to update submodules after checking out a specific tag.
    git clone git@github.com:espressif/esp-adf.git && cd esp-adf
    git checkout v2.4 && git submodule update components
    
  • Add board_build.embed_txtfiles to platformio.ini as mentioned above:
    [env]
    platform = espressif32@6.0.1
    framework = espidf
    monitor_speed = 115200
    board_build.embed_txtfiles = esp-adf/components/dueros_service/duer_profile
    
    [env:esp32dev]
    board = esp32dev
    
  • Add ADF components to CMakeLists.txt in project root:
    cmake_minimum_required(VERSION 3.5)
    include($ENV{IDF_PATH}/tools/cmake/project.cmake)
    
    list(APPEND EXTRA_COMPONENT_DIRS "esp-adf/components")
    
    project(hello-world)
    

These combinations throw linker error:

  • ADF v2.4, platform 5.4.0
Linking .pio/build/esp32dev/firmware.elf
/Users/45gfg9/.platformio/packages/toolchain-xtensa-esp32@8.4.0+2021r2-patch5/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld: group ended before it began (--help for usage)
collect2: error: ld returned 1 exit status
*** [.pio/build/esp32dev/firmware.elf] Error 1

These combinations throw headers not found:

  • ADF v2.5, platform 5.4.0
  • ADF v2.6, platform 5.4.0
esp-adf/components/audio_recorder/recorder_sr.c:43:10: fatal error: model_path.h: No such file or directory
 #include "model_path.h"
          ^~~~~~~~~~~~~~

esp-adf/components/audio_stream/http_stream.c:43:10: fatal error: line_reader.h: No such file or directory
 #include "line_reader.h"
          ^~~~~~~~~~~~~~~

… which is expected not to work as denoted in ADF README.

These combinations fail while configuring project:

  • ADF master, platform 5.4.0
    Here a managed_components directory is created in the project root.
*** Two environments with different actions were specified for the same target: /Users/45gfg9/Documents/PlatformIO/Projects/230514-005219-espidf-hello-world/.pio/build/esp32dev/managed_components/espressif__esp-dsp/modules/support/cplx_gen/dsps_cplx_gen.o
(action 1: xtensa-esp32-elf-gcc -DPLATFORMIO=60113 -DARDUINO_ESP32_DEV -D_GNU_SOURCE -DIDF_VER=\"4.4.5\" -DESP_PLATFORM -D_POSIX_READER_WRITER_LOCKS -c -o dsps_cplx_gen.o dsps_cplx_gen.S)
(action 2: xtensa-esp32-elf-gcc -mlongcalls -ffunction-sections -fdata-sections -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wextra -Wno-unused-parameter -Wno-sign-compare -ggdb -Og -fmacro-prefix-map=/Users/45gfg9/Documents/PlatformIO/Projects/230514-005219-espidf-hello-world=. -fmacro-prefix-map=/Users/45gfg9/.platformio/packages/framework-espidf@3.40405.230623=IDF -fstrict-volatile-bitfields -Wno-error=unused-but-set-variable -fno-jump-tables -fno-tree-switch-conversion -DPLATFORMIO=60113 -DARDUINO_ESP32_DEV -D_GNU_SOURCE -DIDF_VER=\"4.4.5\" -DESP_PLATFORM -D_POSIX_READER_WRITER_LOCKS -c -o dsps_cplx_gen.o dsps_cplx_gen.S)
File "/Users/45gfg9/.platformio/platforms/espressif32@5.4.0/builder/frameworks/espidf.py", line 684, in compile_source_files

These combinations fail while configuring project:

  • ADF v2.4, platform from 6.0.0 to 6.5.0
  • ADF v2.5, platform from 6.0.0 to 6.5.0
CMake Error at /Users/45gfg9/.platformio/packages/framework-espidf/tools/cmake/build.cmake:245 (message):
  Failed to resolve component 'jsmn'.

These combinations fail while configuring project:

  • ADF master, platform from 6.0.0 to 6.2.0
*** Multiple ways to build the same target were specified for: /Users/45gfg9/Documents/PlatformIO/Projects/230514-005219-espidf-hello-world/.pio/build/esp32dev/managed_components/espressif__esp-dsp/modules/support/cplx_gen/dsps_cplx_gen.o  (from ['/Users/45gfg9/Documents/PlatformIO/Projects/230514-005219-espidf-hello-world/managed_components/espressif__esp-dsp/modules/support/cplx_gen/dsps_cplx_gen.c'] and from ['/Users/45gfg9/Documents/PlatformIO/Projects/230514-005219-espidf-hello-world/managed_components/espressif__esp-dsp/modules/support/cplx_gen/dsps_cplx_gen.S'])
File "/Users/45gfg9/.platformio/platforms/espressif32@6.0.0/builder/frameworks/espidf.py", line 665, in compile_source_files

These combinations throw compilation error:

  • ADF v2.6, platform from 6.0.0 to 6.1.0
  • ADF v2.6, platform 6.2.0

For these two, the errors aren’t exactly the same, but both are caused by ADF not correctly using FreeRTOS identifiers like:

In file included from esp-adf/components/audio_hal/driver/es8388/es8388.h:29,
                 from esp-adf/components/audio_hal/driver/es8388/es8388.c:28:
esp-adf/components/audio_hal/include/audio_hal.h:150:5: error: unknown type name 'xSemaphoreHandle'
  150 |     xSemaphoreHandle audio_hal_lock;                                                                         /*!< semaphore of codec */
      |     ^~~~~~~~~~~~~~~~
In file included from esp-adf/components/audio_board/lyrat_v4_3/board.h:31,
                 from esp-adf/components/audio_hal/driver/es8388/es8388.c:29:
esp-adf/components/esp_peripherals/include/esp_peripherals.h:78:32: error: unknown type name 'xTimerHandle'; did you mean 'TimerHandle_t'?
   78 | typedef void (*timer_callback)(xTimerHandle tmr);
      |                                ^~~~~~~~~~~~
      |                                TimerHandle_t
In file included from esp-adf/components/audio_board/lyrat_v4_3/board.h:31,
                 from esp-adf/components/audio_hal/driver/es8388/es8388.c:29:
esp-adf/components/esp_peripherals/include/esp_peripherals.h:371:88: error: unknown type name 'timer_callback'
  371 | esp_err_t esp_periph_start_timer(esp_periph_handle_t periph, TickType_t interval_tick, timer_callback callback);
      |                                                                                        ^~~~~~~~~~~~~~

These combinations fail while configuring project:

  • ADF v2.6, platform from 6.3.0 to 6.5.0
  • ADF master, platform from 6.3.0 to 6.5.0
CMake Error at /Users/45gfg9/.platformio/packages/framework-espidf/tools/cmake/component.cmake:250 (message):
  ERROR: 2 problems were found in the manifest file
  /Users/45gfg9/Documents/PlatformIO/Projects/230514-005219-espidf-hello-world/managed_components/espressif__nghttp/idf_component.yml:


  Invalid manifest format

  Unknown keys: sbom

  

  SUGGESTION: This component may be using a newer version of the component
  manager.

  You can try to update the component manager by running:

      /Users/45gfg9/.platformio/penv/.espidf-5.1.2/bin/python -m pip install --upgrade idf-component-manager

And I did what it said, upgraded idf-component-manager in the virtualenv, but the upgrade got reverted the next time I build, and the same error was thrown.

It’s frustrating that ADF v2.4 and platform 5.4.0 throw linking error, as this is what I’m trying to get working since I want to use Arduino. I’ll try around the next few days.

I am up to the same point below. Espressif 6.5.0 and ADF 2.6.

Did you get anywhere on this?

No, I didn’t advance much.

I believe the issue is the latset ESP32 IDF uses RTOS 8, and that has different class names.
There is this code FreeRTOSConfig.h that can set backwards compatiability:

#if CONFIG_FREERTOS_ENABLE_BACKWARD_COMPATIBILITY
#define configENABLE_BACKWARD_COMPATIBILITY 1

The problem is whenever I set CONFIG_FREERTOS_ENABLE_BACKWARD_COMPATIBILITY = 1 in sdkconfig.esp32dev it resets.

So either need to somehow change RTOS to an earlier version, or set that to true somehow.

ok in the sdkconfig I needed to put “y” instead of “1”

CONFIG_FREERTOS_ENABLE_BACKWARD_COMPATIBILITY=y

That sorts it out.