Missing zap generated files: af-gen-event.h and gen_tokens.h

Hi,

Files af-gen-event.h and gen_tokens.h are missing from the zap-generated files for the light switch samples. Please see below the logging

nRF Connect SDK version: 2.3.0

  • Hi,

    From my understanding after discussing with the developers. According to them, this file should not be needed anymore in Matter v1.0. It was replaced by direct usage of timers in the implementation of clusters, such as for example LevelControl. 

    Kenneth

  • For light switch sample v2.3.0
    - SDK zap-generated files will build fine. The device will also work as expected.

    - Removing SDK zap-generated files and adding locally zap-generated files as above will cause the following error.

    [435/511] Building CXX object CMakeFiles/app.dir/C_/ncs/v2.3.0/modules/lib/matter/src/app/util/af-event.cpp.obj
    FAILED: CMakeFiles/app.dir/C_/ncs/v2.3.0/modules/lib/matter/src/app/util/af-event.cpp.obj 
    C:\ncs\toolchains\v2.3.0\opt\zephyr-sdk\arm-zephyr-eabi\bin\arm-zephyr-eabi-g++.exe -DCHIP_BYPASS_IDL -DCHIP_HAVE_CONFIG_H -DKERNEL -DMBEDTLS_CONFIG_FILE=\"nrf-config.h\" -DMBEDTLS_USER_CONFIG_FILE=\"nrf-config-user.h\" -DNRF52840_XXAA -DNRF_802154_ACK_TIMEOUT_ENABLED=1 -DNRF_802154_CCA_CORR_LIMIT_DEFAULT=2 -DNRF_802154_CCA_CORR_THRESHOLD_DEFAULT=45 -DNRF_802154_CCA_ED_THRESHOLD_DEFAULT=45 -DNRF_802154_CCA_MODE_DEFAULT=NRF_RADIO_CCA_MODE_ED -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=16 -DNRF_802154_PENDING_SHORT_ADDRESSES=16 -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 -DUSE_PARTITION_MANAGER=1 -DZCBOR_ASSERTS -D_ANSI_SOURCE -D_DEFAULT_SOURCE -D_FORTIFY_SOURCE=1 -D__LINUX_ERRNO_EXTENSIONS__ -D__PROGRAM_START -D__ZEPHYR__=1 -I../src -IC:/ncs/v2.3.0/nrf/samples/matter/common/src -IC:/ncs/v2.3.0/modules/lib/matter/third_party/nlio/repo/include -IC:/ncs/v2.3.0/modules/lib/matter/zzz_generated/app-common -IC:/ncs/v2.3.0/nrf/drivers/mpsl/clock_control -IC:/ncs/v2.3.0/zephyr/include -Izephyr/include/generated -IC:/ncs/v2.3.0/zephyr/soc/arm/nordic_nrf/nrf52 -IC:/ncs/v2.3.0/zephyr/lib/libc/newlib/include -IC:/ncs/v2.3.0/zephyr/soc/arm/nordic_nrf/common/. -IC:/ncs/v2.3.0/zephyr/subsys/bluetooth -IC:/ncs/v2.3.0/zephyr/subsys/net/lib/sockets/. -IC:/ncs/v2.3.0/zephyr/subsys/settings/include -IC:/ncs/v2.3.0/nrf/include -IC:/ncs/v2.3.0/nrf/lib/multithreading_lock/. -IC:/ncs/v2.3.0/nrf/subsys/bluetooth/controller/. -IC:/ncs/v2.3.0/zephyr/drivers/flash -IC:/ncs/v2.3.0/nrf/tests/include -IC:/ncs/v2.3.0/zephyr/modules/openthread/platform/. -IC:/ncs/v2.3.0/modules/hal/cmsis/CMSIS/Core/Include -IC:/ncs/v2.3.0/modules/hal/nordic/nrfx -IC:/ncs/v2.3.0/modules/hal/nordic/nrfx/drivers/include -IC:/ncs/v2.3.0/modules/hal/nordic/nrfx/mdk -IC:/ncs/v2.3.0/zephyr/modules/hal_nordic/nrfx/. -IC:/ncs/v2.3.0/modules/debug/segger/SEGGER -IC:/ncs/v2.3.0/modules/debug/segger/Config -IC:/ncs/v2.3.0/zephyr/modules/segger/. -IC:/ncs/v2.3.0/modules/crypto/tinycrypt/lib/include -IC:/ncs/v2.3.0/modules/lib/zcbor/include -IC:/ncs/v2.3.0/nrfxlib/nfc/include -IC:/ncs/v2.3.0/nrfxlib/mpsl/include -IC:/ncs/v2.3.0/nrfxlib/mpsl/include/protocol -IC:/ncs/v2.3.0/nrfxlib/openthread/include -Imodules/nrfxlib/nrfxlib/nrf_security/src/include/generated -IC:/ncs/v2.3.0/nrfxlib/nrf_security/include -IC:/ncs/v2.3.0/nrfxlib/nrf_security/include/mbedtls -IC:/ncs/v2.3.0/nrfxlib/nrf_security/include/psa -IC:/ncs/v2.3.0/modules/crypto/mbedtls/include -IC:/ncs/v2.3.0/modules/crypto/mbedtls/include/mbedtls -IC:/ncs/v2.3.0/modules/crypto/mbedtls/include/psa -IC:/ncs/v2.3.0/modules/crypto/mbedtls/library -IC:/ncs/v2.3.0/nrfxlib/nrf_security/../crypto/nrf_oberon/include -IC:/ncs/v2.3.0/nrfxlib/nrf_security/../crypto/nrf_oberon/include/mbedtls -IC:/ncs/v2.3.0/nrfxlib/nrf_security/../crypto/nrf_oberon/include/psa -IC:/ncs/v2.3.0/nrfxlib/crypto/nrf_oberon/include/mbedtls -IC:/ncs/v2.3.0/nrfxlib/crypto/nrf_oberon/include -IC:/ncs/v2.3.0/nrfxlib/nrf_802154/driver/include -IC:/ncs/v2.3.0/nrfxlib/nrf_802154/sl/include -IC:/ncs/v2.3.0/nrfxlib/softdevice_controller/include -IC:/ncs/v2.3.0/zephyr/include/zephyr/posix -IC:/ncs/v2.3.0/modules/lib/matter/src -IC:/ncs/v2.3.0/modules/lib/matter/src/include -IC:/ncs/v2.3.0/modules/lib/matter/third_party/nlassert/repo/include -Imodules/connectedhomeip/gen/include -IC:/ncs/v2.3.0/modules/lib/matter/examples/providers -isystem C:/ncs/v2.3.0/nrfxlib/crypto/nrf_cc310_platform/include -Wno-deprecated-declarations "-DCHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=<lib/address_resolve/AddressResolve_DefaultImpl.h>" -fno-strict-aliasing -Og -fcheck-new -std=c++14 -Wno-register -fno-exceptions -fno-rtti -imacros C:/Users/lopez/Documents/Projects/Matter/light_switch/build_debug/zephyr/include/generated/autoconf.h -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m4 -mthumb -mabi=aapcs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mfp16-format=ieee --sysroot=C:/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/arm-zephyr-eabi -imacros C:/ncs/v2.3.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-reorder-functions --param=min-pagesize=0 -fno-defer-pop -fmacro-prefix-map=C:/Users/lopez/Documents/Projects/Matter/light_switch=CMAKE_SOURCE_DIR -fmacro-prefix-map=C:/ncs/v2.3.0/zephyr=ZEPHYR_BASE -fmacro-prefix-map=C:/ncs/v2.3.0=WEST_TOPDIR -ffunction-sections -fdata-sections -specs=nano.specs -std=gnu++17 -D_SYS__PTHREADTYPES_H_ -MD -MT CMakeFiles/app.dir/C_/ncs/v2.3.0/modules/lib/matter/src/app/util/af-event.cpp.obj -MF CMakeFiles\app.dir\C_\ncs\v2.3.0\modules\lib\matter\src\app\util\af-event.cpp.obj.d -o CMakeFiles/app.dir/C_/ncs/v2.3.0/modules/lib/matter/src/app/util/af-event.cpp.obj -c C:/ncs/v2.3.0/modules/lib/matter/src/app/util/af-event.cpp
    C:\ncs\v2.3.0\modules\lib\matter\src\app\util\af-event.cpp:31:10: fatal error: zap-generated/af-gen-event.h: No such file or directory
       31 | #include <zap-generated/af-gen-event.h>
          |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    compilation terminated

    - Leaving original SDK zap-generated files and removing only af-gen-event.h and gen_tokens.h files will cause the same above error.

  • Hi again, af-gen-event.h and gen_tokens.h are only placeholders that are needed to compile the code. It seems that some of our examples still need them to compile properly (for e.g Light Switch). We suggest replace only the needed files with the newly generated ones in the zap-generated directory and leave af-gen-event.h and gen_tokens files.

    Kenneth

  • Apologies, you're right that the file is still needed in NCS 2.3.0 to build a sample though the contents of it is irrelevant unless you enable one of the following clusters:
    - Color Control
    - Barrier Control
    - Door Lock
    - On/Off

    That in most cases you just need to create an empty file and in other cases you have to manually copy-paste the file from the corresponding sample. Note that in NCS 2.4.0 this file is no longer needed at all as this change has been included: github.com/.../24844.

Related