Development matter lock: After modifying the zap file, an error occurred when generating C++ source code

use nrfConnectSDK v2.3.0:

cheng@gavin MINGW64 /d/ncs/v2.3.0/modules/lib/matter ((v2.3.0))
$ python ./scripts/tools/zap/generate.py ../../../../igloo/matter_module_only_x1/lock/src/lock.zap
Searching for zcl file from D:\ncs\v2.3.0\modules\lib\matter\../../../../igloo/matter_module_only_x1/lock/src/lock.zap
Error: C:\tools\zap\zap-win\resources\app.asar\zcl-builtin\silabs\zcl.json does not exists or is not a file.

cheng@gavin MINGW64 /d/ncs/v2.3.0/modules/lib/matter ((v2.3.0))
$ python ./scripts/tools/zap/generate.py ../../../../igloo/matter_module_only_x1/lock/src/lock.zap -t src/app/zap-templates/app-templates.json -o ../../../igloo/matter_module_only_x1/lock/src/zap-generated
Searching for zcl file from D:\ncs\v2.3.0\modules\lib\matter\../../../../igloo/matter_module_only_x1/lock/src/lock.zap
Error: C:\tools\zap\zap-win\resources\app.asar\zcl-builtin\silabs\zcl.json does not exists or is not a file.

tips:

1.open: Adding clusters to Matter application — nRF Connect SDK 2.3.0 documentation (nordicsemi.com)

2.Browse to: Use the modified ZAP file to generate the C++ code that contains the selected clusters by running the following command, where samples/matter/sensor stands for the path where you copied the template sample in the first step of this guide:

Parents
  • Hi,

    Searching for zcl file from D:\ncs\v2.3.0\modules\lib\matter\../../../../igloo/matter_module_only_x1/lock/src/lock.zap
    Error: C:\tools\zap\zap-win\resources\app.asar\zcl-builtin\silabs\zcl.json does not exists or is not a file.

    The Zap tool is created with Linux in mind so it might not be perfectly compatible with Windows, and there might be errors in the paths such as the one you observe. Specifically what error occurs is when the tool expects a linux based location with /, while Windows expects \. 

    If you change the path of the file mentioned in the error to"path": "../../../../../modules/lib/matter/src/app/zap-templates/zcl/zcl.json" (or the slashes the other way around depending on what the OS you're usingexpects), it should work. 

    Kind regards,
    Andreas

  • Hi,
    I have the same issue but I'm working at linux(ubuntu). I use a command line from "nRF Connect for Desktop V4.1.2" -> "Toolchaim Manager v1.2.5" -> " open terminal".

     I didn't fully understand the advice "If you change the path..." Where I should change the path? In ZAP tool or in command line? and how?

    I followed according this article: https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.4.1/nrf/protocols/matter/getting_started/adding_clusters.html

    1. ZAP installation: (https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.4.1/nrf/protocols/matter/getting_started/tools.html#ug-matter-tools-installing-zap)
    1.1 Download the ZAP package containing pre-compiled executables and libraries and extract it...
    Here I used python3
    1.2. ...
    1.3. Add the ZAP packages location to the system PATH environment variables.

    2. Open zap file. In my case it was:
    zap ~/Projects/matter2/examples/nordic/light-bulb/light_bulb/src/light_bulb.zap

    Then I added only one Endpoint with temperature sensor.

    7. Save the file ...

    My output file was : light_bulb.2.1.zap

    Here I should mentioned that "Add custom ZCL" window showed me zcl.json file in the similar path as it is in your picture ".../app.asar/zcl-builtin/silabs/zcl.json"

    8. Use the modified ZAP file to generate the C++ code..
    Here I tried more options but everything failed:

    ubuntu@ubuntu-2204:~/Projects/nordic-4.1.2/v2.4.1/modules/lib/matter$ ./scripts/tools/zap/generate.py ~/Projects/matter2/examples/nordic/light-bulb/light_bulb/src/light_bulb.2.1.zap -t  ./src/app/zap-templates/app-templates.json -o ~/Projects/matter2/examples/nordic/light-bulb/light_bulb/src/zap2
    Searching for zcl file from /home/ubuntu/Projects/matter2/examples/nordic/light-bulb/light_bulb/src/light_bulb.2.1.zap
    Error: /home/ubuntu/Projects/nordic-4.1.2/v2.4.1/modules/lib/matter/zap/zap-linux/resources/app.asar/zcl-builtin/silabs/zcl.json does not exists or is not a file.

    or


    ubuntu@ubuntu-2204:~/Projects/nordic-4.1.2/v2.4.1/modules/lib/matter$ ./scripts/tools/zap/generate.py ~/Projects/matter2/examples/nordic/light-bulb/light_bulb/src/light_bulb.2.1.zap -t  ./src/app/zap-templates/zcl/zcl.json -o ~/Projects/matter2/examples/nordic/light-bulb/light_bulb/src/zap2
    Searching for zcl file from /home/ubuntu/Projects/matter2/examples/nordic/light-bulb/light_bulb/src/light_bulb.2.1.zap
    Error: /home/ubuntu/Projects/nordic-4.1.2/v2.4.1/modules/lib/matter/zap/zap-linux/resources/app.asar/zcl-builtin/silabs/zcl.json does not exists or is not a file.

    I tried to generate/regenerate it from ZAP tool but the output folder was always empty. I tried to change the path to zcl.json in ZAP according to the advice "...matter/src/app/zap-templates/zcl/zcl.json" but the file has probably a different content and ZAP rejected it.

  • It seems that I fix it. The problem was in output ZAP file. In my case: light_bulb.2.1.zap. The file contains the section:

      "package": [
        {
          "pathRelativity": "relativeToZap",
          "path": "../../../../../nordic-4.1.2/v2.4.1/modules/lib/matter/zap/zap-linux/resources/app.asar/zcl-builtin/silabs/zcl.json",
          "type": "zcl-properties",
          "category": "zigbee",
          "version": 1,
          "description": "ZigbeePro test data"
        }
      ],

    but the input ZAP file ( light_bulb.zap) contains the section:

      "package": [
        {
          "pathRelativity": "relativeToZap",
          "path": "../../../../../modules/lib/matter/src/app/zap-templates/zcl/zcl.json",
          "type": "zcl-properties",
          "category": "matter",
          "version": 1,
          "description": "Matter SDK ZCL data"
        },
        {
          "pathRelativity": "relativeToZap",
          "path": "../../../../../modules/lib/matter/src/app/zap-templates/app-templates.json",
          "type": "gen-templates-json",
          "version": "chip-v1"
        }
      ],


    Unfortunately, it is still wrong but it is a bit closer. The right section should contains the updated paths:

      "package": [
        {
          "pathRelativity": "relativeToZap",
          "path": "../../../../../nordic-4.1.2/v2.4.1/modules/lib/matter/src/app/zap-templates/zcl/zcl.json",
          "type": "zcl-properties",
          "category": "matter",
          "version": 1,
          "description": "Matter SDK ZCL data"
        },
        {
          "pathRelativity": "relativeToZap",
          "path": "../../../../../nordic-4.1.2/v2.4.1/modules/lib/matter/src/app/zap-templates/app-templates.json",
          "type": "gen-templates-json",
          "version": "chip-v1"
        }
      ],


    Now, it is possible to generate c/cpp code from ZAP file. When I solved it, I immediately faced to another problem with ZAP tool with following steps:
    - open input file: light_bulb.zap

    - no modification

    - save output file: light_bulb.1.zap

    file sizes:
    light_bulb.zap -> 257.7kB

    light_bulb.1.zap -> 74.2kB

    The output file is only fragment of the original file or in other words it is a completely different file which leads to a different data model.

    What can be wrong?

  • Aha, ZAP tool obtains paths to JSON files from ZAP file. Thus the correct procedure is following:

    - update paths in light_bulb.zap

    - open input file: light_bulb.zap in ZAP tool

    - no modification

    - save output file: light_bulb.1.zap in ZAP tool

    Finally, files light_bulb.zap and light_bulb.1.zap will have the same size 257.7kB

Reply Children
No Data
Related