Skip to content

Commit 06f2183

Browse files
committed
Add matter over Thread
Dockerize local environment
1 parent e61a2de commit 06f2183

File tree

7 files changed

+90
-19
lines changed

7 files changed

+90
-19
lines changed

.gitmodules

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,3 @@
1010
[submodule "vendor/boschsensortec/BME68x_SensorAPI"]
1111
path = vendor/boschsensortec/BME68x_SensorAPI
1212
url = https://github.com/boschsensortec/BME68x_SensorAPI
13-
[submodule "vendor/esp-matter"]
14-
path = vendor/esp-matter
15-
url = https://github.com/espressif/esp-matter.git
16-
branch = release/v1.4

README.md

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -315,14 +315,16 @@ Follow these steps to set up your Smart IoT Sensor:
315315

316316
### Building the Firmware
317317

318-
1. **Install ESP-IDF**
319-
320-
Follow the [ESP-IDF Getting Started Guide](https://docs.espressif.com/projects/esp-idf/en/v5.3.1/esp32/get-started/index.html) to set up the development environment.
321-
318+
1. **Build dockerized environment**
319+
```bash
320+
docker build ./ci/docker/ -t esp_idf_xiao_esp32c6_sensor:latest
321+
```
322322
2. **Configure the Project**
323323

324324
```bash
325-
idf.py menuconfig
325+
docker run --rm -it -v $PWD:/opt/esp/project \
326+
-w /opt/esp/project \
327+
esp_idf_xiao_esp32c6_sensor:latest idf.py menuconfig
326328
```
327329

328330
- Set Wi-Fi credentials
@@ -332,7 +334,16 @@ Follow these steps to set up your Smart IoT Sensor:
332334
3. **Build and Flash**
333335

334336
```bash
335-
idf.py build
337+
docker run --rm -t -v $PWD:/opt/esp/project \
338+
-w /opt/esp/project \
339+
esp_idf_xiao_esp32c6_sensor:latest idf.py build
340+
```
341+
342+
```bash
343+
docker run --device=<TARGET_PORT> \
344+
--rm -v $PWD:/opt/esp/project \
345+
-w /opt/esp/project \
346+
-it esp_idf_xiao_esp32c6_sensor:latest \
336347
idf.py -p <TARGET_PORT> flash
337348
```
338349

ci/docker/Dockerfile

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
ARG IDF_VERSION="v5.3.1"
2+
ARG IDF_INSTALL_TARGETS="esp32c6"
3+
ARG DEBIAN_FRONTEND=noninteractive
4+
5+
FROM espressif/idf:${IDF_VERSION} AS esp-idf
6+
7+
ARG ESP_MATTER_CLONE_URL=https://github.com/espressif/esp-matter.git
8+
ARG ESP_MATTER_CHECKOUT_REF=release/v1.4
9+
10+
RUN : \
11+
&& apt-get update \
12+
&& DEBIAN_FRONTEND=${DEBIAN_FRONTEND} apt-get install -fy --no-install-recommends \
13+
libgirepository1.0-dev \
14+
libssl-dev \
15+
pkg-config \
16+
python3 \
17+
python3-pip \
18+
&& apt-get clean \
19+
&& apt-get autoremove -y \
20+
&& rm -rf /var/lib/apt/lists/* \
21+
&& : # last line
22+
23+
WORKDIR /opt/esp
24+
ENV ESP_MATTER_PATH=/opt/esp/esp-matter
25+
26+
RUN set -x \
27+
&& mkdir -p $ESP_MATTER_PATH \
28+
&& cd $ESP_MATTER_PATH \
29+
&& git init \
30+
&& git remote add origin $ESP_MATTER_CLONE_URL \
31+
&& git fetch origin --depth=1 ${ESP_MATTER_CHECKOUT_REF} \
32+
&& git checkout FETCH_HEAD \
33+
&& git submodule update --init --depth 1 \
34+
&& cd ./connectedhomeip/connectedhomeip \
35+
&& ./scripts/checkout_submodules.py --platform esp32 linux --shallow \
36+
&& cd ../.. \
37+
&& ./install.sh \
38+
&& : # last line
39+
40+
COPY entrypoint.sh /opt/esp/entrypoint.sh
41+
ENTRYPOINT [ "/opt/esp/entrypoint.sh" ]
42+
CMD [ "/bin/bash" ]
43+
44+
WORKDIR /opt/esp/esp-matter

ci/docker/entrypoint.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
source $IDF_PATH/export.sh
5+
source $ESP_MATTER_PATH/export.sh
6+
7+
exec "$@"

main/CMakeLists.txt

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
if(CONFIG_SENSOR_CONNECTION_MATTER_OVER_THREAD)
2-
set(ESP_MATTER_SDK_PATH "../vendor/esp-matter")
2+
set(ESP_MATTER_SDK_PATH "/opt/esp/esp-matter")
33

44
get_filename_component(
55
MATTER_SDK_PATH ${ESP_MATTER_SDK_PATH}/connectedhomeip/connectedhomeip/
@@ -480,21 +480,33 @@ if(CONFIG_SENSOR_CONNECTION_MATTER_OVER_THREAD)
480480
endif()
481481
endif()
482482

483-
idf_component_register(
484-
INCLUDE_DIRS
485-
${INCLUDE_DIRS_LIST}
483+
list(APPEND INCLUDE_DIRS_LIST "${ESP_MATTER_SDK_PATH}/examples/common"
484+
"${MATTER_SDK_PATH}/config/esp32/components"
485+
"${ESP_MATTER_SDK_PATH}/components")
486+
487+
list(
488+
APPEND
489+
INCLUDE_DIRS_LIST
486490
"."
487491
"../vendor/embedded-i2c-sgp41"
488492
"../vendor/gas-index-algorithm/sensirion_gas_index_algorithm"
489493
"../vendor/boschsensortec/BME280_SensorAPI"
490-
"../vendor/boschsensortec/BME68x_SensorAPI"
491-
SRC_DIRS
492-
${SRC_DIRS_LIST}
494+
"../vendor/boschsensortec/BME68x_SensorAPI")
495+
496+
list(
497+
APPEND
498+
SRC_DIRS_LIST
493499
"."
494500
"../vendor/embedded-i2c-sgp41"
495501
"../vendor/gas-index-algorithm/sensirion_gas_index_algorithm"
496502
"../vendor/boschsensortec/BME280_SensorAPI"
497-
"../vendor/boschsensortec/BME68x_SensorAPI"
503+
"../vendor/boschsensortec/BME68x_SensorAPI")
504+
505+
idf_component_register(
506+
INCLUDE_DIRS
507+
${INCLUDE_DIRS_LIST}
508+
SRC_DIRS
509+
${SRC_DIRS_LIST}
498510
EXCLUDE_SRCS
499511
${EXCLUDE_SRCS_LIST}
500512
PRIV_INCLUDE_DIRS

sdkconfig.defaults

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
CONFIG_IDF_TARGET="esp32c6"
2+
13
#
24
# Partition Table
35
#

vendor/esp-matter

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)