Tracealyzer integration

I'm trying to use the nrf/samples/matter/window_covering example with Percepio Tracealyzer and Visual Studio Code (using nRF Connect SDK v2.3.0). I had success with the zephyr/samples/hello_world example. But this Matter example doesn't build: the symbols for the trace recorder somehow get lost along the way. libmodules__TraceRecorder.a does get built, but in the first linker stage ld complains about undefined references to sys_trace_syscall_... functions. How to figure out what went wrong?

Parents
  • Hi,

    I was able to reproduce the same here, but I am not sure why the linker fails to find function definitions. I have contacted our Matter team to hear if they have any experience with this.

    Best regards,

    Vidar

  • Hi,

    Sorry for the delayed response. I did ask the Matter team about this, but they didn't have any experience with the tool. Do you still have the full build log available? I can share this with the team to see if they can spot anything obvious.

  • I tried to add an attachment but "An error occurred", so here it is:

    * Executing task: nRF Connect: Build: window_covering/build (active)

    Building window_covering
    C:\WINDOWS\system32\cmd.exe /d /s /c "west build --build-dir c:\work\vscode\test\window_covering\build c:\work\vscode\test\window_covering"

    [0/1] Re-running CMake...
    Loading Zephyr default modules (Zephyr base (cached)).
    -- Application: C:/work/vscode/test/window_covering
    -- Found Python3: C:/ncs/toolchains/v2.3.0/opt/bin/python.exe (found suitable exact version "3.8.2") found components: Interpreter
    -- Cache files will be written to: C:/ncs/v2.3.0/zephyr/.cache
    -- Zephyr version: 3.2.99 (C:/ncs/v2.3.0/zephyr)
    -- Found west (found suitable version "0.14.0", minimum required is "0.7.1")
    -- Board: nrf52840dk_nrf52840
    -- Found host-tools: zephyr 0.15.2 (C:/ncs/toolchains/v2.3.0/opt/zephyr-sdk)
    -- Found toolchain: zephyr 0.15.2 (C:/ncs/toolchains/v2.3.0/opt/zephyr-sdk)
    -- Found BOARD.dts: C:/ncs/v2.3.0/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts
    -- Found devicetree overlay: c:/work/vscode/test/window_covering/boards/nrf52840dk_nrf52840.overlay
    -- Generated zephyr.dts: C:/work/vscode/test/window_covering/build/zephyr/zephyr.dts
    -- Generated devicetree_generated.h: C:/work/vscode/test/window_covering/build/zephyr/include/generated/devicetree_generated.h
    -- Including generated dts.cmake file: C:/work/vscode/test/window_covering/build/zephyr/dts.cmake
    Parsing C:/work/vscode/test/window_covering/Kconfig
    Loaded configuration 'C:/work/vscode/test/window_covering/build/zephyr/.config'
    No change to configuration in 'C:/work/vscode/test/window_covering/build/zephyr/.config'
    No change to Kconfig header in 'C:/work/vscode/test/window_covering/build/zephyr/include/generated/autoconf.h'
    -- Found Python3: C:/ncs/toolchains/v2.3.0/opt/bin/python.exe (found version "3.8.2") found components: Interpreter

    === child image mcuboot - begin ===
    loading initial cache file C:/work/vscode/test/window_covering/build/mcuboot/child_image_preload.cmake
    Loading Zephyr default modules (Zephyr base (cached)).
    -- Application: C:/ncs/v2.3.0/bootloader/mcuboot/boot/zephyr
    -- Cache files will be written to: C:/ncs/v2.3.0/zephyr/.cache
    -- Zephyr version: 3.2.99 (C:/ncs/v2.3.0/zephyr)
    -- Found west (found suitable version "0.14.0", minimum required is "0.7.1")
    -- Board: nrf52840dk_nrf52840
    -- Found host-tools: zephyr 0.15.2 (C:/ncs/toolchains/v2.3.0/opt/zephyr-sdk)
    -- Found toolchain: zephyr 0.15.2 (C:/ncs/toolchains/v2.3.0/opt/zephyr-sdk)
    -- Found BOARD.dts: C:/ncs/v2.3.0/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts
    -- Found devicetree overlay: C:/work/vscode/test/window_covering/child_image/mcuboot/boards/nrf52840dk_nrf52840.overlay
    -- Found devicetree overlay: C:/ncs/v2.3.0/bootloader/mcuboot/boot/zephyr/dts.overlay
    -- Generated zephyr.dts: C:/work/vscode/test/window_covering/build/mcuboot/zephyr/zephyr.dts
    -- Generated devicetree_generated.h: C:/work/vscode/test/window_covering/build/mcuboot/zephyr/include/generated/devicetree_generated.h
    -- Including generated dts.cmake file: C:/work/vscode/test/window_covering/build/mcuboot/zephyr/dts.cmake
    Parsing C:/ncs/v2.3.0/modules/lib/matter/config/nrfconnect/chip-module/Kconfig.mcuboot.root
    Loaded configuration 'C:/work/vscode/test/window_covering/build/mcuboot/zephyr/.config'
    No change to configuration in 'C:/work/vscode/test/window_covering/build/mcuboot/zephyr/.config'
    No change to Kconfig header in 'C:/work/vscode/test/window_covering/build/mcuboot/zephyr/include/generated/autoconf.h'
    CMake Warning at C:/ncs/v2.3.0/nrf/lib/flash_patch/CMakeLists.txt:8 (message):

    ----------------------------------------------------------
    --- WARNING: To maintain the integrity of secure boot, ---
    --- enable CONFIG_DISABLE_FLASH_PATCH in production. ---
    ----------------------------------------------------------


    MCUBoot bootloader key file: C:/ncs/v2.3.0/bootloader/mcuboot/root-ec-p256.pem
    -- Configuring done
    -- Generating done
    -- Build files have been written to: C:/work/vscode/test/window_covering/build/mcuboot
    === child image mcuboot - end ===

    CMake Warning at C:/ncs/v2.3.0/nrf/modules/mcuboot/CMakeLists.txt:286 (message):

    ---------------------------------------------------------
    --- WARNING: Using default MCUBoot key, it should not ---
    --- be used for production. ---
    ---------------------------------------------------------

    CMake Warning at C:/ncs/v2.3.0/nrfxlib/openthread/cmake/extensions.cmake:113 (message):

    Current nrf_security configuration does not provide all MBEDTLS options which are required by precompiled OpenThread libraries.
    The minimum of MBEDTLS configuration is stored at: C:/ncs/v2.3.0/nrfxlib/openthread/lib/cortex-m4/hard-float/v1.3/mtd/oberon/nrf_security_mbedtls_configuration.h

    Call Stack (most recent call first):
    C:/ncs/v2.3.0/nrfxlib/openthread/CMakeLists.txt:82 (check_openthread_dependencies)


    CMake Warning at C:/ncs/v2.3.0/zephyr/CMakeLists.txt:1838 (message):
    __ASSERT() statements are globally ENABLED


    -- Found partition manager static configuration: C:/work/vscode/test/window_covering/configuration/nrf52840dk_nrf52840/pm_static_dfu.yml
    Partition 'mcuboot' is not included in the dynamic resolving since it is statically defined.
    Partition 'mcuboot_pad' is not included in the dynamic resolving since it is statically defined.
    Partition 'mcuboot_primary' is not included in the dynamic resolving since it is statically defined.
    Partition 'mcuboot_primary_app' is not included in the dynamic resolving since it is statically defined.
    Partition 'settings_storage' is not included in the dynamic resolving since it is statically defined.
    Partition 'mcuboot_secondary' is not included in the dynamic resolving since it is statically defined.
    -- Configuring done
    -- Generating done
    -- Build files have been written to: C:/work/vscode/test/window_covering/build
    [0/127] Performing build step for 'mcuboot_subimage'
    [1/32] Generating misc/generated/syscalls.json, misc/generated/struct_tags.json
    [2/32] Generating linker_zephyr_pre1.cmd
    [3/32] Building C object CMakeFiles/app.dir/flash_map_extended.c.obj
    [4/32] Building C object CMakeFiles/app.dir/C_/ncs/v2.3.0/bootloader/mcuboot/boot/bootutil/src/tlv.c.obj
    [5/32] Building C object CMakeFiles/app.dir/C_/ncs/v2.3.0/bootloader/mcuboot/boot/bootutil/src/image_ec256.c.obj
    [6/32] Building C object CMakeFiles/app.dir/C_/ncs/v2.3.0/bootloader/mcuboot/boot/bootutil/src/bootutil_misc.c.obj
    [7/32] Generating linker_zephyr_pre0.cmd
    [8/32] Building C object CMakeFiles/app.dir/C_/ncs/v2.3.0/bootloader/mcuboot/boot/bootutil/src/swap_move.c.obj
    [9/32] Building C object CMakeFiles/app.dir/C_/ncs/v2.3.0/bootloader/mcuboot/boot/bootutil/src/image_validate.c.obj
    [10/32] Building C object CMakeFiles/app.dir/main.c.obj
    [11/32] Building C object CMakeFiles/app.dir/C_/ncs/v2.3.0/bootloader/mcuboot/boot/bootutil/src/loader.c.obj
    [12/32] Building C object zephyr/CMakeFiles/zephyr.dir/C_/ncs/v2.3.0/nrf/subsys/partition_manager/flash_map_partition_manager.c.obj
    [13/32] Building C object CMakeFiles/app.dir/C_/ncs/v2.3.0/bootloader/mcuboot/boot/bootutil/src/swap_misc.c.obj
    [14/32] Building C object zephyr/CMakeFiles/zephyr.dir/subsys/storage/flash_map/flash_map_layout.c.obj
    [15/32] Building C object CMakeFiles/app.dir/nrf_cleanup.c.obj
    [16/32] Building C object CMakeFiles/app.dir/C_/ncs/v2.3.0/bootloader/mcuboot/boot/bootutil/src/swap_scratch.c.obj
    [17/32] Building C object zephyr/CMakeFiles/zephyr.dir/subsys/storage/flash_map/flash_map.c.obj
    [18/32] Building C object modules/mcuboot/boot/bootutil/zephyr/CMakeFiles/mcuboot_util.dir/C_/ncs/v2.3.0/bootloader/mcuboot/boot/bootutil/src/bootutil_public.c.obj
    [19/32] Building C object zephyr/soc/arm/common/cortex_m/CMakeFiles/soc__arm__common__cortex_m.dir/arm_mpu_regions.c.obj
    [20/32] Linking C static library modules\mcuboot\boot\bootutil\zephyr\libmcuboot_util.a
    [21/32] Linking C static library zephyr\soc\arm\common\cortex_m\libsoc__arm__common__cortex_m.a
    [22/32] Linking C static library app\libapp.a
    [23/32] Linking C static library zephyr\libzephyr.a
    [24/32] Linking C executable zephyr\zephyr_pre0.elf

    [25/32] Generating dev_handles.c
    [26/32] Building C object zephyr/CMakeFiles/zephyr_pre1.dir/dev_handles.c.obj
    [27/32] Linking C executable zephyr\zephyr_pre1.elf

    [28/32] Generating linker.cmd
    [29/32] Generating isr_tables.c, isrList.bin
    [30/32] Building C object zephyr/CMakeFiles/zephyr_final.dir/dev_handles.c.obj
    [31/32] Building C object zephyr/CMakeFiles/zephyr_final.dir/isr_tables.c.obj
    [32/32] Linking C executable zephyr\zephyr.elf
    Memory region Used Size Region Size %age Used
    FLASH: 25614 B 28 KB 89.33%
    RAM: 18 KB 256 KB 7.03%
    IDT_LIST: 0 GB 2 KB 0.00%
    [100/127] Linking C static library zephyr\libzephyr.a
    [101/125] Performing build step for 'chip-gn'
    Generating compile_commands took 31ms
    Done. Made 198 targets from 180 files in 2466ms
    ninja: no work to do.
    [103/123] Linking CXX executable zephyr\zephyr_pre0.elf
    FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map
    cmd.exe /C "cd . && C:\ncs\toolchains\v2.3.0\opt\zephyr-sdk\arm-zephyr-eabi\bin\arm-zephyr-eabi-g++.exe -gdwarf-4 -Wl,--whole-archive C:/work/vscode/test/window_covering/build/modules/connectedhomeip/lib/libCHIPShell.a -Wl,--no-whole-archive -Wl,--wrap=malloc -Wl,--wrap=calloc -Wl,--wrap=realloc -Wl,--wrap=free -Wl,--wrap=_malloc_r -Wl,--wrap=_calloc_r -Wl,--wrap=_realloc_r -Wl,--wrap=_free_r @CMakeFiles\zephyr_pre0.rsp -o zephyr\zephyr_pre0.elf && cmd.exe /C "cd /D C:\work\vscode\test\window_covering\build\zephyr && C:\ncs\toolchains\v2.3.0\opt\bin\cmake.exe -E echo ""
    c:/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.exe: app/libapp.a(pwm_device.cpp.obj): in function `PWMDevice::Init(pwm_dt_spec const*, unsigned char, unsigned char, unsigned char)':
    C:\ncs\v2.3.0\nrf\samples\matter\common\src\pwm_device.cpp:25: undefined reference to `sys_trace_syscall_enter(unsigned int, char const*)'
    c:/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.exe: C:\ncs\v2.3.0\nrf\samples\matter\common\src\pwm_device.cpp:25: undefined reference to `sys_trace_syscall_exit(unsigned int, char const*)'
    c:/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.exe: modules/connectedhomeip/lib/libCHIP.a(libInetLayer.IPAddress-StringFuncts.cpp.o): in function `chip::Inet::IPAddress::ToString(char*, unsigned int) const':
    C:\ncs\v2.3.0\zephyr\include\zephyr\net\socket.h:567: undefined reference to `sys_trace_syscall_enter(unsigned int, char const*)'
    c:/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.exe: modules/connectedhomeip/lib/libCHIP.a(libInetLayer.IPAddress-StringFuncts.cpp.o): in function `zsock_inet_ntop':
    C:\ncs\v2.3.0\zephyr\include\zephyr\net\socket.h:567: undefined reference to `sys_trace_syscall_exit(unsigned int, char const*)'
    c:/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.exe: modules/connectedhomeip/lib/libCHIP.a(libInetLayer.InetInterface.cpp.o): in function `chip::Inet::InterfaceId::GetInterfaceName(char*, unsigned int) const':
    c:\ncs\v2.3.0\modules\lib\matter\src\inet\inetinterface.cpp:907: undefined reference to `sys_trace_syscall_enter(unsigned int, char const*)'
    c:/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.exe: c:\ncs\v2.3.0\modules\lib\matter\src\inet\inetinterface.cpp:907: undefined reference to `sys_trace_syscall_exit(unsigned int, char const*)'
    c:/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.exe: modules/connectedhomeip/lib/libCHIP.a(libInetLayer.InetInterface.cpp.o): in function `chip::Inet::InterfaceIterator::InterfaceIterator()':
    c:\ncs\v2.3.0\modules\lib\matter\src\inet\inetinterface.cpp:946: undefined reference to `sys_trace_syscall_enter(unsigned int, char const*)'
    c:/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.exe: c:\ncs\v2.3.0\modules\lib\matter\src\inet\inetinterface.cpp:946: undefined reference to `sys_trace_syscall_exit(unsigned int, char const*)'
    c:/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.exe: modules/connectedhomeip/lib/libCHIP.a(libInetLayer.InetInterface.cpp.o): in function `chip::Inet::InterfaceIterator::Next()':
    c:\ncs\v2.3.0\modules\lib\matter\src\inet\inetinterface.cpp:955: undefined reference to `sys_trace_syscall_enter(unsigned int, char const*)'
    c:/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.exe: c:\ncs\v2.3.0\modules\lib\matter\src\inet\inetinterface.cpp:955: undefined reference to `sys_trace_syscall_exit(unsigned int, char const*)'
    c:/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.exe: modules/connectedhomeip/lib/libCHIP.a(libInetLayer.InetInterface.cpp.o): in function `chip::Inet::InterfaceAddressIterator::Next()':
    c:\ncs\v2.3.0\modules\lib\matter\src\inet\inetinterface.cpp:1046: undefined reference to `sys_trace_syscall_enter(unsigned int, char const*)'
    c:/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.exe: c:\ncs\v2.3.0\modules\lib\matter\src\inet\inetinterface.cpp:1046: undefined reference to `sys_trace_syscall_exit(unsigned int, char const*)'
    c:/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.exe: modules/connectedhomeip/lib/libCHIP.a(libInetLayer.InetInterface.cpp.o): in function `chip::Inet::InterfaceAddressIterator::GetPrefixLength()':
    c:\ncs\v2.3.0\modules\lib\matter\src\inet\inetinterface.cpp:1075: undefined reference to `sys_trace_syscall_enter(unsigned int, char const*)'
    c:/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.exe: c:\ncs\v2.3.0\modules\lib\matter\src\inet\inetinterface.cpp:1075: undefined reference to `sys_trace_syscall_exit(unsigned int, char const*)'
    c:/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.exe: modules/connectedhomeip/lib/libCHIP.a(libInetLayer.UDPEndPointImplSockets.cpp.o): in function `setsockopt.constprop.0':
    C:\ncs\v2.3.0\zephyr\include\zephyr\posix\sys\socket.h:99: undefined reference to `sys_trace_syscall_enter(unsigned int, char const*)'
    c:/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.exe: C:\ncs\v2.3.0\zephyr\include\zephyr\posix\sys\socket.h:99: undefined reference to `sys_trace_syscall_exit(unsigned int, char const*)'
    c:/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.exe: modules/connectedhomeip/lib/libCHIP.a(libInetLayer.UDPEndPointImplSockets.cpp.o): in function `chip::Inet::UDPEndPointImplSockets::HandlePendingIO(chip::BitFlags<chip::System::SocketEventFlags, unsigned char>) [clone .part.0]':
    C:\ncs\v2.3.0\zephyr\include\zephyr\posix\sys\socket.h:87: undefined reference to `sys_trace_syscall_enter(unsigned int, char const*)'
    c:/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.exe: modules/connectedhomeip/lib/libCHIP.a(libInetLayer.UDPEndPointImplSockets.cpp.o): in function `recvfrom':
    C:\ncs\v2.3.0\zephyr\include\zephyr\posix\sys\socket.h:87: undefined reference to `sys_trace_syscall_exit(unsigned int, char const*)'
    c:/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.exe: modules/connectedhomeip/lib/libCHIP.a(libInetLayer.UDPEndPointImplSockets.cpp.o): in function `chip::Inet::UDPEndPointImplSockets::GetSocket(chip::Inet::IPAddressType)':
    C:\ncs\v2.3.0\zephyr\include\zephyr\posix\sys\socket.h:18: undefined reference to `sys_trace_syscall_enter(unsigned int, char const*)'
    c:/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.exe: modules/connectedhomeip/lib/libCHIP.a(libInetLayer.UDPEndPointImplSockets.cpp.o): in function `socket':
    C:\ncs\v2.3.0\zephyr\include\zephyr\posix\sys\socket.h:18: undefined reference to `sys_trace_syscall_exit(unsigned int, char const*)'
    c:/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.exe: modules/connectedhomeip/lib/libCHIP.a(libInetLayer.UDPEndPointImplSockets.cpp.o): in function `chip::Inet::UDPEndPointImplSockets::BindImpl(chip::Inet::IPAddressType, chip::Inet::IPAddress const&, unsigned short, chip::Inet::InterfaceId)':
    C:\ncs\v2.3.0\zephyr\include\zephyr\posix\sys\socket.h:42: undefined reference to `sys_trace_syscall_enter(unsigned int, char const*)'
    c:/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.exe: modules/connectedhomeip/lib/libCHIP.a(libInetLayer.UDPEndPointImplSockets.cpp.o): in function `bind':
    C:\ncs\v2.3.0\zephyr\include\zephyr\posix\sys\socket.h:42: undefined reference to `sys_trace_syscall_exit(unsigned int, char const*)'
    c:/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.exe: modules/connectedhomeip/lib/libCHIP.a(libInetLayer.UDPEndPointImplSockets.cpp.o): in function `chip::Inet::UDPEndPointImplSockets::BindImpl(chip::Inet::IPAddressType, chip::Inet::IPAddress const&, unsigned short, chip::Inet::InterfaceId)':
    C:\ncs\v2.3.0\zephyr\include\zephyr\posix\sys\socket.h:111: undefined reference to `sys_trace_syscall_enter(unsigned int, char const*)'
    c:/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.exe: modules/connectedhomeip/lib/libCHIP.a(libInetLayer.UDPEndPointImplSockets.cpp.o): in function `getsockname':
    C:\ncs\v2.3.0\zephyr\include\zephyr\posix\sys\socket.h:111: undefined reference to `sys_trace_syscall_exit(unsigned int, char const*)'
    c:/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.exe: modules/connectedhomeip/lib/libCHIP.a(libInetLayer.UDPEndPointImplSockets.cpp.o): in function `chip::Inet::UDPEndPointImplSockets::SendMsgImpl(chip::Inet::IPPacketInfo const*, chip::System::PacketBufferHandle&&)':
    C:\ncs\v2.3.0\zephyr\include\zephyr\posix\sys\socket.h:81: undefined reference to `sys_trace_syscall_enter(unsigned int, char const*)'
    c:/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.exe: modules/connectedhomeip/lib/libCHIP.a(libInetLayer.UDPEndPointImplSockets.cpp.o): in function `sendmsg':
    C:\ncs\v2.3.0\zephyr\include\zephyr\posix\sys\socket.h:81: undefined reference to `sys_trace_syscall_exit(unsigned int, char const*)'
    c:/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.exe: modules/connectedhomeip/lib/libCHIP.a(nrfconnect.BLEManagerImpl.cpp.o): in function `chip::DeviceLayer::Internal::BLEManagerImpl::_Init()':
    c:\ncs\v2.3.0\modules\lib\matter\src\platform\zephyr\blemanagerimpl.cpp:118: undefined reference to `sys_trace_syscall_enter(unsigned int, char const*)'
    c:/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.exe: modules/connectedhomeip/lib/libCHIP.a(nrfconnect.BLEManagerImpl.cpp.o): in function `InitRandomStaticAddress':
    c:\ncs\v2.3.0\modules\lib\matter\src\platform\zephyr\blemanagerimpl.cpp:118: undefined reference to `sys_trace_syscall_exit(unsigned int, char const*)'
    c:/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.exe: modules/connectedhomeip/lib/libCHIP.a(nrfconnect.DiagnosticDataProviderImpl.cpp.o): in function `chip::DeviceLayer::DiagnosticDataProviderImpl::DiagnosticDataProviderImpl()':
    c:\ncs\v2.3.0\modules\lib\matter\src\platform\zephyr\diagnosticdataproviderimpl.cpp:65: undefined reference to `sys_trace_syscall_enter(unsigned int, char const*)'
    c:/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.exe: modules/connectedhomeip/lib/libCHIP.a(nrfconnect.DiagnosticDataProviderImpl.cpp.o): in function `DetermineBootReason':
    c:\ncs\v2.3.0\modules\lib\matter\src\platform\zephyr\diagnosticdataproviderimpl.cpp:65: undefined reference to `sys_trace_syscall_exit(unsigned int, char const*)'
    c:/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.exe: c:\ncs\v2.3.0\modules\lib\matter\src\platform\zephyr\diagnosticdataproviderimpl.cpp:73: undefined reference to `sys_trace_syscall_enter(unsigned int, char const*)'
    c:/ncs/toolchains/v2.3.0/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.1.0/../../../../arm-zephyr-eabi/bin/ld.exe: c:\ncs\v2.3.0\modules\lib\matter\src\platform\zephyr\diagnosticdataproviderimpl.cpp:73: undefined reference to `sys_trace_syscall_exit(unsigned int, char const*)'
    collect2.exe: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.
    FATAL ERROR: command exited with status 1: 'c:\ncs\toolchains\v2.3.0\opt\bin\cmake.EXE' --build 'c:\work\vscode\test\window_covering\build'

  • Hi, 

    I have been trying to experiment with this myself, but I haven't been able to figure out how to make the matter lib link with the sys trace functions, unfortunately. I've reported this to the Matter team again, and I hope they will have time to take another look at this.

  • Hi,

    The team identified the problem: the tracing_tracerecored.h ' header is missing the 'extern C' modifier, which causes the linking to fail when attempting to link the trace functions written in C with the C++ library.

    Fix:

    diff --git a/kernelports/Zephyr/include/tracing_tracerecorder.h b/kernelports/Zephyr/include/tracing_tracerecorder.h
    index 442cc82..2ada548 100644
    --- a/kernelports/Zephyr/include/tracing_tracerecorder.h
    +++ b/kernelports/Zephyr/include/tracing_tracerecorder.h
    @@ -9,6 +9,10 @@
     #ifndef _TRACE_TRACERECORDER_H
     #define _TRACE_TRACERECORDER_H
     
    +#ifdef __cplusplus
    +extern "C" {
    +#endif
    +
     #include <zephyr/kernel.h>
     #include <zephyr/init.h>
     #include <trcRecorder.h>
    @@ -1256,4 +1260,8 @@ void sys_trace_idle(void);
     void sys_trace_isr_enter(void);
     void sys_trace_isr_exit(void);
     
    +#ifdef __cplusplus
    +}
    +#endif
    +
     #endif /*_TRACE_TRACERECORDER_H*/
    

Reply
  • Hi,

    The team identified the problem: the tracing_tracerecored.h ' header is missing the 'extern C' modifier, which causes the linking to fail when attempting to link the trace functions written in C with the C++ library.

    Fix:

    diff --git a/kernelports/Zephyr/include/tracing_tracerecorder.h b/kernelports/Zephyr/include/tracing_tracerecorder.h
    index 442cc82..2ada548 100644
    --- a/kernelports/Zephyr/include/tracing_tracerecorder.h
    +++ b/kernelports/Zephyr/include/tracing_tracerecorder.h
    @@ -9,6 +9,10 @@
     #ifndef _TRACE_TRACERECORDER_H
     #define _TRACE_TRACERECORDER_H
     
    +#ifdef __cplusplus
    +extern "C" {
    +#endif
    +
     #include <zephyr/kernel.h>
     #include <zephyr/init.h>
     #include <trcRecorder.h>
    @@ -1256,4 +1260,8 @@ void sys_trace_idle(void);
     void sys_trace_isr_enter(void);
     void sys_trace_isr_exit(void);
     
    +#ifdef __cplusplus
    +}
    +#endif
    +
     #endif /*_TRACE_TRACERECORDER_H*/
    

Children
No Data
Related