Skip to content

Commit

Permalink
Removed mfg_tool, related cleanups, and documentation update
Browse files Browse the repository at this point in the history
`tools/mfg_tool` is moved to esp-matter-tools repo: https://github.com/espressif/esp-matter-tools/tree/main/mfg_tool.

It is released on pypi: https://pypi.org/project/esp-matter-mfg-tool and can be installed by running `pip install esp-matter-mfg-tool`
  • Loading branch information
shubhamdp authored and dhrishi committed Jun 7, 2024
1 parent d291284 commit e6d74cc
Show file tree
Hide file tree
Showing 14 changed files with 55 additions and 1,492 deletions.
5 changes: 5 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 07-May-2024

- `tools/mfg_tool.py` is moved to https://github.com/espressif/esp-matter-tools/tree/main/mfg_tool
and can be installed by running `python3 -m pip install esp-matter-mfg-tool`.

# 14-February-2024

- An optional argument, `max_val_size`, has been introduced to the `esp_matter::attribute::create()` API.
Expand Down
18 changes: 11 additions & 7 deletions docs/en/certification.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ A test CD signed by the test CD signing keys in `connectedhomeip <https://github

For Matter Certification Test, vendors should generate their own test Product Attestation Authority (PAA) certificate, Product Attestation Intermediate (PAI) certificate, and Device Attestation Certificate (DAC), but not use the default test PAA certificate in `connectedhomeip <https://github.com/espressif/connectedhomeip/tree/v1.0.0.2/credentials/test/attestation>`__ SDK repository. So you need to generate a PAA certificate, upload it to `TestNet <https://testnet.iotledger.io/>`__ following the instruction in `DCL Primer <https://groups.csa-iot.org/wg/matter-tsg/document/24705>`__, and use it to sign and attest PAI certificates which will be used to sign and attest the DACs. The PAI certificate, DAC, and DAC's private key should be stored in the product you submit to test.

Here are the steps to generate the certificates and keys using `chip-cert <https://github.com/espressif/connectedhomeip/tree/v1.0.0.2/src/tools/chip-cert/README.md>`__ and :project_file:`mfg_tool<tools/mfg_tool/README.md>`.
Here are the steps to generate the certificates and keys using `chip-cert`_ and `esp-matter-mfg-tool`_.

3.2.2.1 Generating PAA Certificate
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -68,29 +68,29 @@ Generate the vendor scoped PAA certificate and key, please make sure to change t
3.2.2.2 Generating Factory Partition Binary Files
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

After getting the PAA certificate and key, the factory partition binary files with PAI certificate, DAC, and DAC keys can be generated using mfg_tool.
After getting the PAA certificate and key, the factory partition binary files with PAI certificate, DAC, and DAC keys can be generated using esp-matter-mfg-tool.

- Install the requirements and export the dependent tools path if not done already

::

cd path/to/esp_matter/tools/mfg_tool
cd path/to/esp_matter
python3 -m pip install -r requirements.txt
export PATH=$PATH:$PWD/../../connectedhomeip/connectedhomeip/out/host
export PATH=$PATH:$PWD/connectedhomeip/connectedhomeip/out/host

- Generate factory partition binary files

::

./mfg_tool.py -n <count> -cn Espressif --paa -c /path/to/PAA_certificate -k /path/to/PAA_key \
esp-matter-mfg-tool -n <count> -cn Espressif --paa -c /path/to/PAA_certificate -k /path/to/PAA_key \
-cd /path/to/CD_file -v 0x131B --vendor_name Espressif -p 0x1234 \
--product-name Test-light --hw-ver 1 --hw-ver-str v1.0

.. note::

For more information about the arguments, you can use ``./mfg_tool.py --help``
For more information about the arguments, you can use ``esp-matter-mfg-tool --help``

The option ``-n`` (count) is the number of generated binaries. In the above command, mfg_tool will generate PAI certificate and key and then use them to generate ``count`` different DACs and keys. It will use the generated certificates and keys to generate ``count`` factory partition binaries with different DACs, discriminators, and setup pincodes. Flash the factory binary to the device's NVS partition. Then the device will send the vendor's PAI certificate and DAC to the commissioner during commissioning.
The option ``-n`` (count) is the number of generated binaries. In the above command, esp-matter-mfg-tool will generate PAI certificate and key and then use them to generate ``count`` different DACs and keys. It will use the generated certificates and keys to generate ``count`` factory partition binaries with different DACs, discriminators, and setup pincodes. Flash the factory binary to the device's NVS partition. Then the device will send the vendor's PAI certificate and DAC to the commissioner during commissioning.

3.2.2.3 Using Vendor's PAA in Test Harness(TH)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down Expand Up @@ -329,3 +329,7 @@ Here are some issues that you might meet in Matter Certification Test and quick
- ``TC-SU-2.7``

The StateTransition event ``Applying`` might be missed because the OTA reboot time is too short. You can cherry-pick the commit from the `fixing Pull Request <https://github.com/project-chip/connectedhomeip/pull/24379>`__ to fix the issue.


.. _`esp-matter-mfg-tool`: https://github.com/espressif/esp-matter-tools/tree/main/mfg_tool
.. _`chip-cert`: https://github.com/espressif/connectedhomeip/tree/master/src/tools/chip-cert/README.md
19 changes: 9 additions & 10 deletions docs/en/developing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,7 @@ If QR code is not visible, paste the below link into the browser and scan the QR
https://project-chip.github.io/connectedhomeip/qrcode.html?data=MT:Y.K9042C00KA0648G00

If you want to use different values for commissioning the device, please use the
`mfg-tool <https://github.com/espressif/esp-matter/tree/main/tools/mfg_tool#readme>`__
to generate the factory partition which has to be flashed on the device.
`esp-matter-mfg-tool`_ to generate the factory partition which has to be flashed on the device.
It also generates the new pairing code and QR code image using which you can commission the device.

2.3.1.2 Post Commissioning Setup
Expand Down Expand Up @@ -1065,15 +1064,15 @@ Export the dependent tools path

::

cd esp-matter/tools/mfg_tool
export PATH=$PATH:$PWD/../../connectedhomeip/connectedhomeip/out/host
cd esp-matter
export PATH=$PATH:$PWD/connectedhomeip/connectedhomeip/out/host


Generate the factory partition, please use the APPROPRIATE values for ``-v`` (Vendor Id), ``-p`` (Product Id), and ``-cd`` (Certification Declaration).

::

./mfg_tool.py --passcode 89674523 \
esp-matter-mfg-tool --passcode 89674523 \
--discriminator 2245 \
-cd TEST_CD_FFF1_8001.der \
-v 0xFFF1 --vendor-name Espressif \
Expand Down Expand Up @@ -1186,18 +1185,17 @@ This cluster provides an interface for controlling a characteristic of a device
This attribute is the list of supported modes that may be selected for the CurrentMode attribute. Each item in this list represents a unique mode as indicated by the Mode field of the ModeOptionStruct. Each entry in this list SHALL have a unique value for the Mode field.
ESP_MATTER uses factory partition to set the values of Supported Modes attribute.

2.9.2 Generate Factory Partition Using mfg_tool
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2.9.2 Generate Factory Partition Using esp-matter-mfg-tool
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Use `mfg_tool <https://github.com/espressif/esp-matter/blob/main/tools/mfg_tool/README.md>`__ to generate factory partition of the supported modes attribute.
Use `esp-matter-mfg-tool`_ to generate factory partition of the supported modes attribute.

2.9.2.1 Usage
^^^^^^^^^^^^^

::

cd tools/mfg_tool
./mfg_tool.py -cn "My bulb" -v 0xFFF2 -p 0x8001 --pai \
esp-matter-mfg-tool -cn "My bulb" -v 0xFFF2 -p 0x8001 --pai \
-k path/to/esp-matter/connectedhomeip/connectedhomeip/credentials/test/attestation/Chip-Test-PAI-FFF2-8001-Key.pem \
-c path/to/esp-matter/connectedhomeip/connectedhomeip/credentials/test/attestation/Chip-Test-PAI-FFF2-8001-Cert.pem \
-cd path/to/esp-matter/connectedhomeip/connectedhomeip/credentials/test/certification-declaration/Chip-Test-CD-FFF2-8001.der \
Expand Down Expand Up @@ -1457,3 +1455,4 @@ The controller example offers two options for the Attestation Trust Storage whic
.. _`step by step installation guide`: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/linux-macos-setup.html
.. _`Prerequisites for ESP-IDF`: https://docs.espressif.com/projects/esp-idf/en/v5.0.1/esp32/get-started/index.html#step-1-install-prerequisites
.. _`Prerequisites for Matter`: https://github.com/espressif/connectedhomeip/blob/v1.1-branch/docs/guides/BUILDING.md#prerequisites
.. _`esp-matter-mfg-tool`: https://github.com/espressif/esp-matter-tools/tree/main/mfg_tool
4 changes: 2 additions & 2 deletions docs/en/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ How to use Rotating Device Identifier

- Enable the Rotating Device Identifier support in menuconfig.
- Add the ``--enable-rotating-device-id`` and add the ``--rd-id-uid`` to specify the ``Rotating ID Unique ID``
when use the mfg_tool.py to generate partition.bin file.
when use the ``esp-matter-mfg-tool`` to generate partition.bin file.

Difference between Rotating ID Unique ID and Unique ID

Expand Down Expand Up @@ -232,7 +232,7 @@ is not released after the commissioning process, and the free RAM won't go up.
A1.10 How to generate Matter Onboarding Codes (QR Code and Manual Pairing Code)
-------------------------------------------------------------------------------

When creating a factory partition using ``mfg_tool.py``, both the QR code and manual pairing codes are generated.
When creating a factory partition using ``esp-matter-mfg-tool``, both the QR code and manual pairing codes are generated.

Along with that, there are two more methods for generating Matter onboarding codes:

Expand Down
25 changes: 14 additions & 11 deletions docs/en/production.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,9 @@ assists an *OTA requestor* to get upgraded. The SDK examples support Matter OTA
requestor role out of the box. The OTA provider could be a manufacturer specific
phone app or any Matter node that has internet connectivity.

Alternatively, `ESP RainMaker OTA <https://rainmaker.espressif.com/docs/ota.html>`__
service can also be used to upgrade the firmware on the devices remotely. As opposed to the Matter OTA, ESP RainMaker OTA allows you the flexibility of delivering the OTA upgrades incrementally or to groups of devices.
Alternatively, `ESP RainMaker OTA`_ service can also be used to upgrade the firmware
on the devices remotely. As opposed to the Matter OTA, ESP RainMaker OTA allows you
the flexibility of delivering the OTA upgrades incrementally or to groups of devices.


4.3 Manufacturing
Expand All @@ -101,13 +102,12 @@ For commissioning a device into the Matter Fabric, the device requires the follo
- **Spake2+ parameters**: work as a proof of possession.

These details are generally programmed in the manufacturing partition that is unique
per device. ESP-Matter provides a utility (mfg_tool.py) to create these partition images
per device. ESP-Matter provides a utility (esp-matter-mfg-tool) to create these partition images
on a per-device basis for mass manufacturing purposes.

When using the utility, by default, the above details will be included in the generated manufacturing partition image. The utility also has a provision to include additional details in the same image by using CSV files.

Details about using the mass manufacturing utility can be found here:
:project_file:`mfg_tool<tools/mfg_tool/README.md>`.
Details about using the mass manufacturing utility can be found here: `esp-matter-mfg-tool`_

4.3.2 Pre-Provisioned Modules
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand All @@ -120,8 +120,8 @@ programming the partition into the device at your end.

Please contact your Espressif contact person for more information.

4.3.3 The mfg_tool Example
~~~~~~~~~~~~~~~~~~~~~~~~~~
4.3.3 The esp-matter-mfg-tool Example
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In Espressif Matter Prep-provisioning modules, the DAC key pair, DAC and PAI certificates are pre-flashed by default.

Expand All @@ -139,25 +139,25 @@ This is the example to generate factory images after pre-provisioning:

::

./mfg_tool.py -cd ~/test_cert/CD/Chip-CD-131B-1000.der -v 0x131B --vendor-name ESP -p 0x1000 --product-name light --hw-ver 1 --hw-ver-str v1.0 --mfg-date 2022-10-25 --passcode 19861989 --discriminator 601 --serial-num esp32c_dev3
esp-matter-mfg-tool -cd ~/test_cert/CD/Chip-CD-131B-1000.der -v 0x131B --vendor-name ESP -p 0x1000 --product-name light --hw-ver 1 --hw-ver-str v1.0 --mfg-date 2022-10-25 --passcode 19861989 --discriminator 601 --serial-num esp32c_dev3

- **Generate multiple generic factory images**

::

./mfg_tool.py -n 10 -cd ~/test_cert/CD/Chip-CD-131B-1000.der -v 0x131B --vendor-name ESP -p 0x1000 --product-name light --hw-ver 1 --hw-ver-str v1.0 --mfg-date 2022-10-25
esp-matter-mfg-tool -n 10 -cd ~/test_cert/CD/Chip-CD-131B-1000.der -v 0x131B --vendor-name ESP -p 0x1000 --product-name light --hw-ver 1 --hw-ver-str v1.0 --mfg-date 2022-10-25

- **Generate factory image with rotating device unique identify**

::

./mfg_tool.py -cd ~/test_cert/CD/Chip-CD-131B-1000.der -v 0x131B --vendor-name ESP -p 0x1000 --product-name light --hw-ver 1 --hw-ver-str v1.0 --mfg-date 2022-10-25 --passcode 19861989 --discriminator 601 --serial-num esp32c_dev3 --enable-rotating-device-id --rd-id-uid c0398f4980b07c9460f71c5421e1a3c5
esp-matter-mfg-tool -cd ~/test_cert/CD/Chip-CD-131B-1000.der -v 0x131B --vendor-name ESP -p 0x1000 --product-name light --hw-ver 1 --hw-ver-str v1.0 --mfg-date 2022-10-25 --passcode 19861989 --discriminator 601 --serial-num esp32c_dev3 --enable-rotating-device-id --rd-id-uid c0398f4980b07c9460f71c5421e1a3c5

- **Generate multiple factory images with csv and mcsv**

::

./mfg_tool.py -cd ~/test_cert/CD/Chip-CD-131B-1000.der -v 0x131B --vendor-name ESP -p 0x1000 --product-name light --hw-ver 1 --hw-ver-str v1.0 --enable-rotating-device-id --mfg-date 2022-10-25 --csv mfg.csv --mcsv mfg_m.csv
esp-matter-mfg-tool -cd ~/test_cert/CD/Chip-CD-131B-1000.der -v 0x131B --vendor-name ESP -p 0x1000 --product-name light --hw-ver 1 --hw-ver-str v1.0 --enable-rotating-device-id --mfg-date 2022-10-25 --csv mfg.csv --mcsv mfg_m.csv

- **The example of csv and mcsv file**
- CSV:
Expand All @@ -173,3 +173,6 @@ This is the example to generate factory images after pre-provisioning:
| esp32c_dev6,c0398f4980b07c9460f71c5421e1a3c8,1237
| esp32c_dev7,c0398f4980b07c9460f71c5421e1a3c9,1238

.. _`esp-matter-mfg-tool`: https://github.com/espressif/esp-matter-tools/tree/main/mfg_tool
.. _`ESP RainMaker OTA`: https://rainmaker.espressif.com/docs/ota.html
5 changes: 0 additions & 5 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ echo "Exit Matter environment"
echo ""
deactivate

echo ""
echo "Installing python dependencies for mfg_tool"
echo ""
python3 -m pip install -r ${ESP_MATTER_PATH}/tools/mfg_tool/requirements.txt

echo ""
echo "Installing python dependencies for Matter"
echo ""
Expand Down
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ jinja2==3.0.1

# https://github.com/psf/requests/blob/main/HISTORY.md#2300-2023-05-03
urllib3<2

# mfg_tool
esp-matter-mfg-tool
1 change: 0 additions & 1 deletion tools/jenkins/Jenkinsfile.esp_matter.firmware
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ pipeline {
catchError() {
script {
def esp_matter = load "${WORKSPACE}/tools/jenkins/esp_matter.groovy"
esp_matter.script_artifacts_create()
esp_matter.tools_artifacts_create()
}
}
Expand Down
43 changes: 0 additions & 43 deletions tools/jenkins/esp_matter.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -166,49 +166,6 @@ def firmware_build_save() {
'''
}

def script_artifacts_create() {
sh '''
PACKAGE_SCRIPT_PATH=${PACKAGE_PATH}/Script
SCRIPTS_DIRECTORY_NAME=manufacturing_scripts
SCRIPTS_PATH=${PACKAGE_SCRIPT_PATH}/${SCRIPTS_DIRECTORY_NAME}
mkdir -p ${SCRIPTS_PATH}
# esp-idf
mkdir -p ${SCRIPTS_PATH}/esp-idf
mkdir -p ${SCRIPTS_PATH}/esp-idf/components
mkdir -p ${SCRIPTS_PATH}/esp-idf/components/nvs_flash
cp -r ${IDF_PATH}/components/nvs_flash/nvs_partition_generator ${SCRIPTS_PATH}/esp-idf/components/nvs_flash/
mkdir -p ${SCRIPTS_PATH}/esp-idf/tools
cp -r ${IDF_PATH}/tools/mass_mfg ${SCRIPTS_PATH}/esp-idf/tools/
# esp-matter
mkdir -p ${SCRIPTS_PATH}/esp-matter
mkdir -p ${SCRIPTS_PATH}/esp-matter/tools
cp -r ${ESP_MATTER_PATH}/tools/mfg_tool ${SCRIPTS_PATH}/esp-matter/tools/
mkdir -p ${SCRIPTS_PATH}/esp-matter/connectedhomeip
mkdir -p ${SCRIPTS_PATH}/esp-matter/connectedhomeip/connectedhomeip
mkdir -p ${SCRIPTS_PATH}/esp-matter/connectedhomeip/connectedhomeip/scripts
mkdir -p ${SCRIPTS_PATH}/esp-matter/connectedhomeip/connectedhomeip/scripts/tools
cp -r ${ESP_MATTER_PATH}/connectedhomeip/connectedhomeip/scripts/tools/spake2p ${SCRIPTS_PATH}/esp-matter/connectedhomeip/connectedhomeip/scripts/tools
mkdir -p ${SCRIPTS_PATH}/esp-matter/connectedhomeip/connectedhomeip/src
mkdir -p ${SCRIPTS_PATH}/esp-matter/connectedhomeip/connectedhomeip/src/setup_payload
cp -r ${ESP_MATTER_PATH}/connectedhomeip/connectedhomeip/src/setup_payload/python ${SCRIPTS_PATH}/esp-matter/connectedhomeip/connectedhomeip/src/setup_payload
mkdir -p ${SCRIPTS_PATH}/esp-matter/connectedhomeip/connectedhomeip/credentials
cp -r ${ESP_MATTER_PATH}/connectedhomeip/connectedhomeip/credentials/test ${SCRIPTS_PATH}/esp-matter/connectedhomeip/connectedhomeip/credentials
cp -r ${ESP_MATTER_PATH}/connectedhomeip/connectedhomeip/credentials/production ${SCRIPTS_PATH}/esp-matter/connectedhomeip/connectedhomeip/credentials
cp -r ${ESP_MATTER_PATH}/connectedhomeip/connectedhomeip/credentials/development ${SCRIPTS_PATH}/esp-matter/connectedhomeip/connectedhomeip/credentials
# script_description
mkdir -p ${SCRIPTS_PATH}/script_description
cp ${SCRIPTS_PATH}/esp-matter/tools/mfg_tool/requirements.txt ${SCRIPTS_PATH}/script_description/
cp ${SCRIPTS_PATH}/esp-matter/tools/mfg_tool/README.md ${SCRIPTS_PATH}/script_description/
'''
}

def tools_artifacts_create() {
sh '''
PACKAGE_TOOLS_PATH=${PACKAGE_PATH}/Tools
Expand Down
Loading

0 comments on commit e6d74cc

Please sign in to comment.