[Matter] Changing or adding Endpoints/Clusters to Matter-Template example with the zap tool leads to compiling errors

Hi Nordic Guys,

hope you can help following issue (I think the issue is still mentioned in Ticket https://devzone.nordicsemi.com/f/nordic-q-a/87410/corrupt-matter-zcl-file-generation-matter-template-project, Case ID: 288305).

I try to extend the matter-template example from the nRF SDK. Out off the box the example compiles, build and links The application can be copied to the nRF5340DK board and works.

If I add a new endpoint, like it is described in https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/ug_matter_gs_adding_clusters.html#ug-matter-creating-accessory and let the generator.py script do its work, the result is an unbuild-able application.

See the following build-output:

/Users/bennynestler/workspaces/matter/nRFConnect/matter-template/src/zap-generated/endpoint_config.h:570:3: error: conversion from '<brace-enclosed initializer list>' to 'EmberAfDefaultOrMinMaxAttributeValue' is ambiguous
  570 |   }
      |   ^
/opt/nordic/ncs/v2.0.2/modules/lib/matter/src/app/util/attribute-storage.cpp:102:71: note: in expansion of macro 'GENERATED_ATTRIBUTES'
  102 | constexpr const EmberAfAttributeMetadata generatedAttributes[]      = GENERATED_ATTRIBUTES;
      |                                                                       ^~~~~~~~~~~~~~~~~~~~
In file included from /opt/nordic/ncs/v2.0.2/modules/lib/matter/src/app/util/af-types.h:58,
                 from /opt/nordic/ncs/v2.0.2/modules/lib/matter/src/app/util/af.h:69,
                 from /opt/nordic/ncs/v2.0.2/modules/lib/matter/src/app/util/common.h:45,
                 from /opt/nordic/ncs/v2.0.2/modules/lib/matter/src/app/util/attribute-storage.cpp:42:
/opt/nordic/ncs/v2.0.2/modules/lib/matter/src/app/util/attribute-metadata.h:104:15: note: candidate: 'constexpr EmberAfDefaultOrMinMaxAttributeValue::EmberAfDefaultOrMinMaxAttributeValue(const EmberAfAttributeMinMaxValue*)'
  104 |     constexpr EmberAfDefaultOrMinMaxAttributeValue(const EmberAfAttributeMinMaxValue * ptr) : ptrToMinMaxValue(ptr) {}
      |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/nordic/ncs/v2.0.2/modules/lib/matter/src/app/util/attribute-metadata.h:103:15: note: candidate: 'constexpr EmberAfDefaultOrMinMaxAttributeValue::EmberAfDefaultOrMinMaxAttributeValue(uint16_t)'
  103 |     constexpr EmberAfDefaultOrMinMaxAttributeValue(uint16_t val) : defaultValue(val) {}
      |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/nordic/ncs/v2.0.2/modules/lib/matter/src/app/util/attribute-metadata.h:102:15: note: candidate: 'constexpr EmberAfDefaultOrMinMaxAttributeValue::EmberAfDefaultOrMinMaxAttributeValue(const uint8_t*)'
  102 |     constexpr EmberAfDefaultOrMinMaxAttributeValue(const uint8_t * ptr) : ptrToDefaultValue(ptr) {}
      |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/nordic/ncs/v2.0.2/modules/lib/matter/src/app/util/attribute-metadata.h:100:7: note: candidate: 'constexpr EmberAfDefaultOrMinMaxAttributeValue::EmberAfDefaultOrMinMaxAttributeValue(const EmberAfDefaultOrMinMaxAttributeValue&)'
  100 | union EmberAfDefaultOrMinMaxAttributeValue
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/nordic/ncs/v2.0.2/modules/lib/matter/src/app/util/attribute-metadata.h:100:7: note: candidate: 'constexpr EmberAfDefaultOrMinMaxAttributeValue::EmberAfDefaultOrMinMaxAttributeValue(EmberAfDefaultOrMinMaxAttributeValue&&)'
In file included from /opt/nordic/ncs/v2.0.2/modules/lib/matter/src/app/util/config.h:83,
                 from /opt/nordic/ncs/v2.0.2/modules/lib/matter/src/app/util/af.h:56,
                 from /opt/nordic/ncs/v2.0.2/modules/lib/matter/src/app/util/common.h:45,
                 from /opt/nordic/ncs/v2.0.2/modules/lib/matter/src/app/util/attribute-storage.cpp:42:

The error repeats several times as result of the inclusion of header files.

  • Hi,

    The other clusters are required clusters. Some are mandatory for all Matter devices, and others are for Temperature sensor device specifically. You can read about the required clusters for different device types in the Matter Device Library specification.

    The error messages are related to OTA and not the other clusters. I am not sure why you are getting this error, but I will look into it and get back to you tomorrow.

    Best regards,

    Marte

  • Hi  ,

    yes, I already thought that it was an OTA error. 

    But the error appears, since I edit the original zap-file.

    The steps are the following:

    1.) Create new matter-template application

    2.) Build it with a configuration of your choice (I use the nRF5340DK) --> Build success

    3.) Change the src/template.zap file and add endpoint 1 (Device = Matter Temperature Sensor (0x0302)).

    4.) Use the generate.py script to create necessary cpp- and header- files

    5.) Rebuild with the same configuration --> Build fails with the mentioned error.

    [18/55] Building CXX object CMakeFiles/app.dir/opt/nordic/ncs/v2.1.0/modules/lib/matter/src/app/clusters/ota-requestor/DefaultOTARequestor.cpp.obj
    FAILED: CMakeFiles/app.dir/opt/nordic/ncs/v2.1.0/modules/lib/matter/src/app/clusters/ota-requestor/DefaultOTARequestor.cpp.obj 
    ccache /opt/nordic/ncs/toolchains/v2.1.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-g++ -DCHIP_HAVE_CONFIG_H -DKERNEL -DMBEDTLS_CONFIG_FILE=\"nrf-config.h\" -DMBEDTLS_USER_CONFIG_FILE=\"nrf-config-user.h\" -DNRF5340_XXAA_APPLICATION -DNRF_802154_ACK_TIMEOUT_ENABLED=1 -DNRF_802154_ECB_PRIORITY=-1 -DNRF_802154_ENCRYPTION_ENABLED=1 -DNRF_802154_IE_WRITER_ENABLED=1 -DNRF_802154_INTERNAL_RADIO_IRQ_HANDLING=0 -DNRF_802154_PENDING_EXTENDED_ADDRESSES="" -DNRF_802154_PENDING_SHORT_ADDRESSES="" -DNRF_802154_RX_BUFFERS=16 -DNRF_802154_SECURITY_WRITER_ENABLED=1 -DNRF_802154_SWI_PRIORITY=1 -DNRF_802154_TX_STARTED_NOTIFY_ENABLED=1 -DNRF_802154_USE_RAW_API=1 -DNRF_SKIP_FICR_NS_COPY_TO_RAM -DUSE_PARTITION_MANAGER=1 -DZCBOR_ASSERT -D_FORTIFY_SOURCE=2 -D__LINUX_ERRNO_EXTENSIONS__ -D__PROGRAM_START -D__ZEPHYR__=1 -I../src -I/opt/nordic/ncs/v2.1.0/nrf/samples/matter/common/src -I/opt/nordic/ncs/v2.1.0/modules/lib/matter/third_party/nlio/repo/include -I/opt/nordic/ncs/v2.1.0/modules/lib/matter/zzz_generated/app-common -I/opt/nordic/ncs/v2.1.0/zephyr/include/zephyr -I/opt/nordic/ncs/v2.1.0/zephyr/include -Izephyr/include/generated -I/opt/nordic/ncs/v2.1.0/zephyr/soc/arm/nordic_nrf/nrf53 -I/opt/nordic/ncs/v2.1.0/zephyr/lib/libc/newlib/include -I/opt/nordic/ncs/v2.1.0/zephyr/lib/util/fnmatch/. -I/opt/nordic/ncs/v2.1.0/zephyr/soc/arm/nordic_nrf/common/. -I/opt/nordic/ncs/v2.1.0/zephyr/subsys/bluetooth -I/opt/nordic/ncs/v2.1.0/zephyr/subsys/net/lib/sockets/. -I/opt/nordic/ncs/v2.1.0/zephyr/subsys/net/lib/openthread/platform/. -I/opt/nordic/ncs/v2.1.0/zephyr/subsys/settings/include -I/opt/nordic/ncs/v2.1.0/nrf/include -I/opt/nordic/ncs/v2.1.0/modules/lib/zcbor/include -I/opt/nordic/ncs/v2.1.0/modules/hal/cmsis/CMSIS/Core/Include -I/opt/nordic/ncs/v2.1.0/modules/hal/nordic/nrfx -I/opt/nordic/ncs/v2.1.0/modules/hal/nordic/nrfx/drivers/include -I/opt/nordic/ncs/v2.1.0/modules/hal/nordic/nrfx/mdk -I/opt/nordic/ncs/v2.1.0/zephyr/modules/hal_nordic/nrfx/. -Imodules/libmetal/libmetal/lib/include -I/opt/nordic/ncs/v2.1.0/modules/lib/open-amp/open-amp/lib/include -I/opt/nordic/ncs/v2.1.0/modules/crypto/tinycrypt/lib/include -I/opt/nordic/ncs/v2.1.0/nrfxlib/openthread/include -Imodules/nrfxlib/nrfxlib/nrf_security/src/include/generated -I/opt/nordic/ncs/v2.1.0/nrfxlib/nrf_security/include -I/opt/nordic/ncs/v2.1.0/nrfxlib/nrf_security/include/mbedtls -I/opt/nordic/ncs/v2.1.0/nrfxlib/nrf_security/include/psa -I/opt/nordic/ncs/v2.1.0/mbedtls/include -I/opt/nordic/ncs/v2.1.0/mbedtls/include/mbedtls -I/opt/nordic/ncs/v2.1.0/mbedtls/include/psa -I/opt/nordic/ncs/v2.1.0/mbedtls/library -I/opt/nordic/ncs/v2.1.0/nrfxlib/nrf_security/../crypto/nrf_oberon/include -I/opt/nordic/ncs/v2.1.0/nrfxlib/nrf_security/../crypto/nrf_oberon/include/mbedtls -I/opt/nordic/ncs/v2.1.0/nrfxlib/nrf_security/../crypto/nrf_oberon/include/psa -I/opt/nordic/ncs/v2.1.0/nrfxlib/crypto/nrf_oberon/include/mbedtls -I/opt/nordic/ncs/v2.1.0/nrfxlib/crypto/nrf_oberon/include -I/opt/nordic/ncs/v2.1.0/nrfxlib/softdevice_controller/include -I/opt/nordic/ncs/v2.1.0/nrfxlib/nrf_802154/serialization/include -I/opt/nordic/ncs/v2.1.0/nrfxlib/nrf_802154/serialization/include/platform -I/opt/nordic/ncs/v2.1.0/nrfxlib/nrf_802154/serialization/include/serialization -I/opt/nordic/ncs/v2.1.0/nrfxlib/nrf_802154/serialization/include/host -I/opt/nordic/ncs/v2.1.0/zephyr/include/zephyr/posix -I/opt/nordic/ncs/v2.1.0/modules/lib/matter/src -I/opt/nordic/ncs/v2.1.0/modules/lib/matter/src/include -I/opt/nordic/ncs/v2.1.0/modules/lib/matter/src/lib -I/opt/nordic/ncs/v2.1.0/modules/lib/matter/third_party/nlassert/repo/include -Imodules/connectedhomeip/gen/include -isystem /opt/nordic/ncs/v2.1.0/nrfxlib/crypto/nrf_cc312_platform/include "-DCHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=<lib/address_resolve/AddressResolve_DefaultImpl.h>" -Os -fcheck-new -std=c++14 -Wno-register -fno-exceptions -fno-rtti -imacros /Users/bennynestler/workspaces/matter/nRFConnect/original_template/build/zephyr/include/generated/autoconf.h -ffreestanding -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m33 -mthumb -mabi=aapcs -mfpu=fpv5-sp-d16 -mfloat-abi=hard -mfp16-format=ieee -imacros /opt/nordic/ncs/v2.1.0/zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-main -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -fno-asynchronous-unwind-tables -fno-pie -fno-pic -fno-reorder-functions -fno-defer-pop -fmacro-prefix-map=/Users/bennynestler/workspaces/matter/nRFConnect/original_template=CMAKE_SOURCE_DIR -fmacro-prefix-map=/opt/nordic/ncs/v2.1.0/zephyr=ZEPHYR_BASE -fmacro-prefix-map=/opt/nordic/ncs/v2.1.0=WEST_TOPDIR -ffunction-sections -fdata-sections -specs=nano.specs -std=gnu++17 -D_SYS__PTHREADTYPES_H_ -MD -MT CMakeFiles/app.dir/opt/nordic/ncs/v2.1.0/modules/lib/matter/src/app/clusters/ota-requestor/DefaultOTARequestor.cpp.obj -MF CMakeFiles/app.dir/opt/nordic/ncs/v2.1.0/modules/lib/matter/src/app/clusters/ota-requestor/DefaultOTARequestor.cpp.obj.d -o CMakeFiles/app.dir/opt/nordic/ncs/v2.1.0/modules/lib/matter/src/app/clusters/ota-requestor/DefaultOTARequestor.cpp.obj -c /opt/nordic/ncs/v2.1.0/modules/lib/matter/src/app/clusters/ota-requestor/DefaultOTARequestor.cpp
    /opt/nordic/ncs/v2.1.0/modules/lib/matter/src/app/clusters/ota-requestor/DefaultOTARequestor.cpp: In member function 'CHIP_ERROR chip::DefaultOTARequestor::SendQueryImageRequest(chip::OperationalDeviceProxy&)':
    /opt/nordic/ncs/v2.1.0/modules/lib/matter/src/app/clusters/ota-requestor/DefaultOTARequestor.cpp:757:17: error: 'OtaSoftwareUpdateProviderCluster' is not a member of 'chip::Controller'
      757 |     Controller::OtaSoftwareUpdateProviderCluster cluster;
          |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /opt/nordic/ncs/v2.1.0/modules/lib/matter/src/app/clusters/ota-requestor/DefaultOTARequestor.cpp:757:17: note: maximum limit of 1000 namespaces searched for 'OtaSoftwareUpdateProviderCluster'
    /opt/nordic/ncs/v2.1.0/modules/lib/matter/src/app/clusters/ota-requestor/DefaultOTARequestor.cpp:758:5: error: 'cluster' was not declared in this scope
      758 |     cluster.Associate(&deviceProxy, mProviderLocation.Value().endpoint);
          |     ^~~~~~~
    /opt/nordic/ncs/v2.1.0/modules/lib/matter/src/app/clusters/ota-requestor/DefaultOTARequestor.cpp:758:5: note: maximum limit of 1000 namespaces searched for 'cluster'
    /opt/nordic/ncs/v2.1.0/modules/lib/matter/src/app/clusters/ota-requestor/DefaultOTARequestor.cpp: In member function 'CHIP_ERROR chip::DefaultOTARequestor::SendApplyUpdateRequest(chip::OperationalDeviceProxy&)':
    /opt/nordic/ncs/v2.1.0/modules/lib/matter/src/app/clusters/ota-requestor/DefaultOTARequestor.cpp:827:17: error: 'OtaSoftwareUpdateProviderCluster' is not a member of 'chip::Controller'
      827 |     Controller::OtaSoftwareUpdateProviderCluster cluster;
          |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /opt/nordic/ncs/v2.1.0/modules/lib/matter/src/app/clusters/ota-requestor/DefaultOTARequestor.cpp:827:17: note: maximum limit of 1000 namespaces searched for 'OtaSoftwareUpdateProviderCluster'
    /opt/nordic/ncs/v2.1.0/modules/lib/matter/src/app/clusters/ota-requestor/DefaultOTARequestor.cpp:828:5: error: 'cluster' was not declared in this scope
      828 |     cluster.Associate(&deviceProxy, mProviderLocation.Value().endpoint);
          |     ^~~~~~~
    /opt/nordic/ncs/v2.1.0/modules/lib/matter/src/app/clusters/ota-requestor/DefaultOTARequestor.cpp:828:5: note: maximum limit of 1000 namespaces searched for 'cluster'
    /opt/nordic/ncs/v2.1.0/modules/lib/matter/src/app/clusters/ota-requestor/DefaultOTARequestor.cpp: In member function 'CHIP_ERROR chip::DefaultOTARequestor::SendNotifyUpdateAppliedRequest(chip::OperationalDeviceProxy&)':
    /opt/nordic/ncs/v2.1.0/modules/lib/matter/src/app/clusters/ota-requestor/DefaultOTARequestor.cpp:842:17: error: 'OtaSoftwareUpdateProviderCluster' is not a member of 'chip::Controller'
      842 |     Controller::OtaSoftwareUpdateProviderCluster cluster;
          |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /opt/nordic/ncs/v2.1.0/modules/lib/matter/src/app/clusters/ota-requestor/DefaultOTARequestor.cpp:842:17: note: maximum limit of 1000 namespaces searched for 'OtaSoftwareUpdateProviderCluster'
    /opt/nordic/ncs/v2.1.0/modules/lib/matter/src/app/clusters/ota-requestor/DefaultOTARequestor.cpp:843:5: error: 'cluster' was not declared in this scope
      843 |     cluster.Associate(&deviceProxy, mProviderLocation.Value().endpoint);
          |     ^~~~~~~
    /opt/nordic/ncs/v2.1.0/modules/lib/matter/src/app/clusters/ota-requestor/DefaultOTARequestor.cpp:843:5: note: maximum limit of 1000 namespaces searched for 'cluster'
    [19/55] Building CXX object CMakeFiles/app.dir/opt/nordic/ncs/v2.1.0/modules/lib/matter/src/app/clusters/ota-requestor/ota-requestor-server.cpp.obj
    [20/55] Building CXX object CMakeFiles/app.dir/opt/nordic/ncs/v2.1.0/modules/lib/matter/src/app/clusters/thread-network-diagnostics-server/thread-network-diagnostics-server.cpp.obj
    [21/55] Building CXX object CMakeFiles/app.dir/opt/nordic/ncs/v2.1.0/modules/lib/matter/src/app/clusters/software-diagnostics-server/software-diagnostics-server.cpp.obj
    [22/55] Building CXX object CMakeFiles/app.dir/opt/nordic/ncs/v2.1.0/modules/lib/matter/src/app/clusters/time-format-localization-server/time-format-localization-server.cpp.obj
    [23/55] Building CXX object CMakeFiles/app.dir/opt/nordic/ncs/v2.1.0/modules/lib/matter/src/app/util/af-event.cpp.obj
    [24/55] Building CXX object CMakeFiles/app.dir/opt/nordic/ncs/v2.1.0/modules/lib/matter/src/app/util/attribute-table.cpp.obj
    [25/55] Building CXX object CMakeFiles/app.dir/opt/nordic/ncs/v2.1.0/modules/lib/matter/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp.obj
    [26/55] Building CXX object CMakeFiles/app.dir/opt/nordic/ncs/v2.1.0/modules/lib/matter/src/app/util/attribute-storage.cpp.obj
    [27/55] Building CXX object CMakeFiles/app.dir/opt/nordic/ncs/v2.1.0/modules/lib/matter/src/app/util/client-api.cpp.obj
    [28/55] Building CXX object CMakeFiles/app.dir/opt/nordic/ncs/v2.1.0/modules/lib/matter/src/app/util/DataModelHandler.cpp.obj
    [29/55] Building CXX object CMakeFiles/app.dir/opt/nordic/ncs/v2.1.0/modules/lib/matter/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp.obj
    ninja: build stopped: subcommand failed.
    FATAL ERROR: command exited with status 1: /opt/nordic/ncs/toolchains/v2.1.0/bin/cmake --build /Users/bennynestler/workspaces/matter/nRFConnect/original_template/build
    
     *  The terminal process terminated with exit code: 1. 
     *  Terminal will be reused by tasks, press any key to close it.

    Best regards,

    Benny

  • Hi Benny,

    Can you check which clusters are enabled on endpoint 0 and whether any of them are OTA? From the left side of your picture I see that endpoint 0 only has 5 clusters enabled, while when I go through the guide on my side I have 26 enabled clusters. The issue might be that you are missing some mandatory clusters for the Matter Root Node, such as OTA. This is what endpoint 0 looks like on my side:

    Best regards,

    Marte

  • Hi  

    thanks for your hint. But that's only a fault/issue of the zap tool.

    If you click on Endpoint 1, the left overview frame of Endpoint 0 changes as well and vice versa. But I thinks that's only a view issue.

    But there was a valuable aspect in your picture, that's not described in the SDK documentation. The Endpoint 0 is not configured as "Matter root node" if I load the template.zap file from the template example.

    I try to change the Endpoint 0 to the "Matter Root Node" and see what is the result.

  • Hi  

    yesterday I experiment a little bit with the zap tool and the matter template with following weird results:

    1.) Create a new example matter-template from nRF SDK with VS Code integration plugin

    2.) Open the src/template.zap file with zap-tool. Looks like this

    3.) Edit Endpoint 0 and choose "Matter Root Node" from device list. Looks like this

    --> Looks similar but not equal to yours  ; but the right panel doesn't show 26 enabled Clusters. There are only  12! (And yes, I tried to scroll down, to the supposedly rest of 14 enabled Clusters)

    4.) Save the file and quit the zap-tool.

    5.) Reopen the src/template.zap file with zap-Tool. Looks like this

    The numbers are changed ... !? I think that is the correct view!

    6.) Add the missing Cluster in the CHIP category

    - OTA Software Update Provider (0x0029) --> Choose Client

    - OTA Software Update Requestor (0x002A) --> Choose Server

    7.) Configure Cluster OTA Software Update Requestor

    - enable all required Attributes, Attributes Reporting, Commands and Events

    8.) Save the file (if possible --> I've issues with saving of files; very often my changes couldn't be saved and the zap tool don't offers the save menu entry; the only thing which helps is to restart the tool and retry in a slitly different change order )

    9.) Try to configure the OTA Software Update Provider

    --> This action always leads to freeze the zap -Tool

    The only exit from this state, is to exit the zap tool (Menu --> Electron --> Quit Electron or Control + C in Terminal)

     can you verify my steps/issues with the zap tool?

    My zap-tool About window looks like following

     

Related