From 1380786f704ba680afb53f246c367f81811222a1 Mon Sep 17 00:00:00 2001 From: Shubham Patil Date: Sat, 11 Feb 2023 20:16:55 +0530 Subject: [PATCH] [ESP32] Fix host setup failure on mac and some build docs (#24973) * [ESP32] Restrict only gdbgui to x64 linux On mac, we can download the gdbgui wheels as binary * [ESP32] Documentation changes * address review comments * restyle --- docs/guides/esp32/build_app_and_commission.md | 7 +- docs/guides/esp32/factory_data.md | 90 +++++++++---------- docs/guides/esp32/setup_idf_chip.md | 26 ++++-- scripts/requirements.esp32.txt | 22 ++--- 4 files changed, 75 insertions(+), 70 deletions(-) diff --git a/docs/guides/esp32/build_app_and_commission.md b/docs/guides/esp32/build_app_and_commission.md index 6fd2e2d0dbff45..eeb5f1296b49f2 100644 --- a/docs/guides/esp32/build_app_and_commission.md +++ b/docs/guides/esp32/build_app_and_commission.md @@ -53,9 +53,8 @@ functionality can still work fine. - Matter - Before running any other build command, the scripts/activate.sh environment - setup script should be sourced at the top level. This script set up a Python - environment with libraries used to build and test. + Activate the Matter environment. Below command needs to be executed after + sourcing `esp-idf/export.sh`. ``` $ cd path/to/connectedhomeip @@ -82,7 +81,7 @@ functionality can still work fine. - Set the Matter target to build ``` - $ idf.py set-target (Matter) + $ idf.py set-target (target chip) ``` All the example applications supports target chips: esp32, esp32s3, esp32c3 diff --git a/docs/guides/esp32/factory_data.md b/docs/guides/esp32/factory_data.md index 30be20cbb592c2..9818eec9880964 100644 --- a/docs/guides/esp32/factory_data.md +++ b/docs/guides/esp32/factory_data.md @@ -1,38 +1,15 @@ ## Using ESP32 Factory Data Provider By default applications uses test-mode or default commissionable data provider, -device attestation credentials provider, and device instance info provider. +device attestation credentials provider, device instance info provider, and +device info provider. To use different values for them you can use the ESP32 Factory Data Provider. -### Configuration Options - -Enable config option `CONFIG_ENABLE_ESP32_FACTORY_DATA_PROVIDER` to use ESP32 -specific implementation of CommissionableDataProvider and -DeviceAttestationCredentialsProvider. - -[Component config → CHIP Device Layer → Commissioning options → Use ESP32 -Factory Data Provider] - -Enable config option `CONFIG_ENABLE_ESP32_FACTORY_DATA_PROVIDER` to use ESP32 -specific implementation of DeviceInstanceInfoProvider. - -[Component config → CHIP Device Layer → Commissioning options → Use ESP32 Device -Instance Info Provider] - -ESP32 implementation reads factory data from nvs partition, chip-factory data -must be flashed into the configured nvs partition. Factory partition can be -configured using `CONFIG_CHIP_FACTORY_NAMESPACE_PARTITION_LABEL` option, default -is "nvs". +### Supported data -### Generate NVS Binary Image - -`scripts/tools/generate_esp32_chip_factory_bin.py` script generates the -chip-factory NVS binary image `partition.bin`. - -#### Supported data - -Script supports adding following data to the NVS binary image: +Following data can be added to the manufacturing partition using +`scripts/tools/generate_esp32_chip_factory_bin.py` script. - Commissionable data @@ -46,41 +23,62 @@ Script supports adding following data to the NVS binary image: - Certificate declaration - Device instance information + - Vendor id and name - Product id and name - Hardware version and version string - Serial Number - Unique identifier -Please check help for available options, -`scripts/tools/generate_esp32_chip_factory_bin.py` +- Device information + - Fixed Labels + - Supported locales + - Supported calendar types + +### Configuration Options -#### Dependency +Enable config option `CONFIG_ENABLE_ESP32_FACTORY_DATA_PROVIDER` to use ESP32 +specific implementation of `CommissionableDataProvider` and +`DeviceAttestationCredentialsProvider`. -Script has dependency on -[spake2p](https://github.com/project-chip/connectedhomeip/tree/master/src/tools/spake2p) -for generating spake2p parameters. +[Component config → CHIP Device Layer → Commissioning options → Use ESP32 +Factory Data Provider] -Build spake2p: +Enable config option `CONFIG_ENABLE_ESP32_DEVICE_INSTANCE_INFO_PROVIDER` to use +ESP32 specific implementation of `DeviceInstanceInfoProvider`. -``` -cd path/to/connectedhomeip -gn gen out/host -ninja -C out/host -cd - -``` +[Component config → CHIP Device Layer → Commissioning options → Use ESP32 Device +Instance Info Provider] -Add spake2p to \$PATH environment variable +Enable config option `CONFIG_ENABLE_ESP32_DEVICE_INFO_PROVIDER` to use ESP32 +specific implementation of `DeviceInfoProvider`. -``` -export PATH=$PATH:path/to/connectedhomeip/out/host -``` +[Component config → CHIP Device Layer → Commissioning options → Use ESP32 Device +Info Provider] + +ESP32 implementation reads factory data from nvs partition, chip-factory data +must be flashed into the configured nvs partition. Factory partition can be +configured using `CONFIG_CHIP_FACTORY_NAMESPACE_PARTITION_LABEL` option, default +is "nvs". + +[Component config -> CHIP Device Layer -> Matter Manufacturing Options -> +chip-factory namespace partition label] + +### Generate NVS Binary Image + +`scripts/tools/generate_esp32_chip_factory_bin.py` script generates the +chip-factory NVS binary image `partition.bin`. + +Please check help for available options, +`scripts/tools/generate_esp32_chip_factory_bin.py` #### Usage Below mentioned command generates the nvs image with test DAC with VID:0xFFF2 and PID:8000 and some examples values for other fields. +For more help please check `./generate_esp32_chip_factory_bin.py -h` + ``` ./generate_esp32_chip_factory_bin.py -d 3434 -p 99663300 \ --product-name ESP-lighting-app --product-id 0x8000 \ @@ -89,7 +87,7 @@ and PID:8000 and some examples values for other fields. --dac-cert path/to/connectedhomeip/credentials/test/attestation/Chip-Test-DAC-FFF2-8001-0008-Cert.der \ --dac-key path/to/connectedhomeip/credentials/test/attestation/Chip-Test-DAC-FFF2-8001-0008-Key.der \ --pai-cert path/to/connectedhomeip/credentials/test/attestation/Chip-Test-PAI-FFF2-8001-Cert.der \ - --cd path/to/connectedhomeip/credentials/test/certification-declaration/Chip-Test-CD-FFF2-8001.der \ + --cd path/to/connectedhomeip/credentials/test/certification-declaration/Chip-Test-CD-FFF2-8001.der ``` #### Flashing the generated NVS image diff --git a/docs/guides/esp32/setup_idf_chip.md b/docs/guides/esp32/setup_idf_chip.md index 4b1938e64c2d7f..27224cdbdb4cc4 100644 --- a/docs/guides/esp32/setup_idf_chip.md +++ b/docs/guides/esp32/setup_idf_chip.md @@ -57,22 +57,30 @@ step. - [Linux](https://github.com/project-chip/connectedhomeip/blob/master/docs/guides/BUILDING.md#installing-prerequisites-on-linux) - [macOS](https://github.com/project-chip/connectedhomeip/blob/master/docs/guides/BUILDING.md#installing-prerequisites-on-macos) -### Prepare for building +### Bootstrap Matter environment -Before running any other build command, the `scripts/activate.sh` environment -setup script should be sourced at the top level. This script takes care of -downloading GN, ninja, and setting up a Python environment with libraries used -to build and test. +Execute the below command to bootstrap Matter environment. This script takes +care of downloading GN, ninja, and setting up a Python environment with +libraries used to build and test. ``` -source scripts/activate.sh +source scripts/bootstrap.sh ``` -If this script says the environment is out of date, it can be updated by -running: +Whenever Matter environment is out of date, it can be updated by running above +command. + +For MacOS, `gdbgui` python package will not be installed using `bootstrap.sh` +script as it is restricted only for x64 Linux platforms. It is restricted +because, building wheels for `gevent` (dependency of `gdbgui`) fails on MacOS. + +Please run the below commands after every bootstrapping. + +Workaround is to install `gdbgui` wheels as binary: ``` -source scripts/bootstrap.sh +python3 -m pip install -c scripts/constraints.txt --no-cache --prefer-binary gdbgui==0.13.2.0 +deactivate ``` --- diff --git a/scripts/requirements.esp32.txt b/scripts/requirements.esp32.txt index 4bf5479986c5a2..44fd20ce9d6e7d 100644 --- a/scripts/requirements.esp32.txt +++ b/scripts/requirements.esp32.txt @@ -1,12 +1,12 @@ -click>=7.0 ; platform_machine != 'aarch64' and sys_platform == 'linux' -future>=0.15.2 ; platform_machine != 'aarch64' and sys_platform == 'linux' -pyparsing>=2.0.3,<2.4.0 ; platform_machine != 'aarch64' and sys_platform == 'linux' -idf-component-manager>=0.2.99-beta ; platform_machine != 'aarch64' and sys_platform == 'linux' +click>=7.0 +future>=0.15.2 +pyparsing>=2.0.3,<2.4.0 +idf-component-manager +pygdbmi<=0.9.0.2 +reedsolo>=1.5.3,<=1.5.4 +bitstring>=3.1.6 +ecdsa>=0.16.0 +kconfiglib==13.7.1 +construct==2.10.54 +python-socketio<5 gdbgui==0.13.2.0 ; platform_machine != 'aarch64' and sys_platform == 'linux' -pygdbmi<=0.9.0.2 ; platform_machine != 'aarch64' and sys_platform == 'linux' -reedsolo>=1.5.3,<=1.5.4 ; platform_machine != 'aarch64' and sys_platform == 'linux' -bitstring>=3.1.6 ; platform_machine != 'aarch64' and sys_platform == 'linux' -ecdsa>=0.16.0 ; platform_machine != 'aarch64' and sys_platform == 'linux' -kconfiglib==13.7.1 ; platform_machine != 'aarch64' and sys_platform == 'linux' -construct==2.10.54 ; platform_machine != 'aarch64' and sys_platform == 'linux' -python-socketio<5 ; platform_machine != 'aarch64' and sys_platform == 'linux'