ESP-IDF Matter in PlatformIO

Hello,

I’ve working on a ESP32 project that will use Matter as the communication protocol based on this project. I’ve been implementing in ESP-IDF but would like to implement in PlatformIO. Is there the ability to transfer over an organic ESP-IDF project into PlatformIO? Is there some steps I can read/follow which can help?

Thanks!

The official espressif32 examples have a lot of ESP-IDF examples that are organic ESP-IDF projects. Also see docs and docs.

Thanks for the information. I spent yesterday working through the CMakeLists and linking all of the different core connecthomeip directories. Most of the transferred build now seems to be working, but I keep running into the following error.

CMake Error at third_party/connectedhomeip/config/esp32/components/chip/CMakeLists.txt:204 (message):
  The 'gn' command was not found.  Make sure you have GN installed.Or have
  followed necessary build preparations stated in BUILDING.md.

The associated lines of that error are:

# CHIP build as an external project.
find_program(GN_EXECUTABLE gn)
if (${GN_EXECUTABLE} STREQUAL GN_EXECUTABLE-NOTFOUND)
    message(FATAL_ERROR "The 'gn' command was not found. Make sure you have GN installed."
                        "Or have followed necessary build preparations stated in BUILDING.md.")
endif()

Do you know if the GN build system is an option with PlatformIO? Or maybe a way I could point to the installation that I completed in the Build Matter README.md.

Do you have the program installed globally? Then it should also be available to PIO.

I think so, I tried installing globally as well as right at the PlatformIO project structure. Both times the same error came up.

Is gn available in the PIO CLI? And in regular Windows+R → cmd.exe?

No it isn’t, but I’m running on MAC. GN returns $ gn -bash: gn: command not found In PIO CLI it isn’t either as far as I can tell. `Usage: pio [OPTIONS] COMMAND [ARGS]…

Options:
–version Show the version and exit.
-c, --caller TEXT Caller ID (service)
–no-ansi Do not print ANSI control characters
-h, --help Show this message and exit.

Commands:
access Manage resource access
account Manage PlatformIO account
boards Board Explorer
check Static Code Analysis
ci Continuous Integration
debug Unified Debugger
device Device manager & Serial/Socket monitor
home GUI to manage PlatformIO
org Manage organizations
pkg Unified Package Manager
project Project Manager
remote Remote Development
run Run project targets (build, upload, clean, etc.)
settings Manage system settings
system Miscellaneous system commands
team Manage organization teams
test Unit Testing
upgrade Upgrade PlatformIO Core to the latest version`

I’m pretty new at PlatformIO, so I could easily be missing something simple.

Did you ever figure this out? I have the same issue that i can’t find a way to get esp-matter running in platformIO. I have cloned the repository into my project and ran all scripts but get this error when trying to include the headers in my main.cpp:

In file included from esp-matter/components/esp_matter/esp_matter_cluster.h:17,
from esp-matter/components/esp_matter/esp_matter_endpoint.h:17,
from src/main.cpp:1:
esp-matter/components/esp_matter/esp_matter_core.h:17:10: fatal error: app/DeviceProxy.h: No such file or directory
#include <app/DeviceProxy.h>

Any idea what’s missing?

That file is in the connectedhomeip submodule, (connectedhomeip/src/app/DeviceProxy.h at 3106fce31ba8a672910a31dcf5c83e0a129608f4 · espressif/connectedhomeip · GitHub), did you make sure to init / clone the submodules of esp-matter too? The install guide has a way for a shallow clone: https://docs.espressif.com/projects/esp-matter/en/latest/esp32/developing.html#getting-the-repositories

Hm no I’m giving up on that one. Tried for a few hours now, cannot get it to work in PlatformIO. I did came up to the point where I had the ESP-Matter repo clone (shallowly) per docs and the install.sh script went through completelly, I copied the examples/light projects into PlatformIO, added the configs to tell it where the esp-matter folder was downloaded (set(ENV{ESP_MATTER_PATH} /home/max/matter_exp/esp-matter)), then I had to rename chip.cpp to chip2.cpp in the files and in the CMake referneces because both chip.c and chip.cpp would generate the same chip.o file, then I had to sudo apt install generate-ninja to ge the gn command globally, and now I’m stuck on 1: cannot open lib/address_resolve/AddressResolve_DefaultImpl.h: No such file.

Recommandation: Use native ESP-IDF / CMake, this is not ready yet.

1 Like

For anyone looking through topics, I’ve been trying this as well:

Anyone has any progress on this? I tried many ways with no success. and stuck with same error:

Any help will be appreciated.

Better try with the native CMake build system as Espressif intents. This seems to need waaaay more work.