undefined reference to `zboss_signal_handler'

Hi,

I'm having an issue with linking a Zigbee application. I have a working Zigbee application that is compiled and linked successfully. That application has BLE and Zigbee working together and the whole project is based on a BLE example with a lot of modifications. We now need to add Matter over Thread to the same product. So I took the Matter example and modified it for our own board and got that working as well. Now what I want to do is share code between the BLE/Zigbee project and the Matter project (since Matter and Zigbee can't be both active). To do that I took the Matter code and started modifying that to take out all Matter parts and replace them with Zigbee. My plan is to have one project with two build configurations - one for Matter and one for Zigbee. I got the Zigbee code to finally compile with no errors but linking fails with the following errors:

/home/tiit/ncs/toolchains/e9dba88316/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: modules/nrfxlib/nrfxlib/zboss/production/src/libzboss-sources.a(zdo_commissioning_bdb.c.obj): in function `nwk_cancel_network_discovery_response':
/home/tiit/ncs/v2.7.0/nrfxlib/zboss/production/src/commissioning/bdb/zdo_commissioning_bdb.c:2769: undefined reference to `zboss_signal_handler'
/home/tiit/ncs/toolchains/e9dba88316/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /home/tiit/ncs/v2.7.0/nrfxlib/zboss/production/lib/cortex-m4/hard-float/libzboss.ed.a(zdo_app.ed.o): in function `zb_zdo_startup_complete_int':
zdo_app.c:(.text.zb_zdo_startup_complete_int+0x44): undefined reference to `zboss_signal_handler'
/home/tiit/ncs/toolchains/e9dba88316/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /home/tiit/ncs/v2.7.0/nrfxlib/zboss/production/lib/cortex-m4/hard-float/libzboss.ed.a(zdo_app.ed.o): in function `zb_nlme_status_indication_process':
zdo_app.c:(.text.zb_nlme_status_indication_process+0x9c): undefined reference to `zboss_signal_handler'
/home/tiit/ncs/toolchains/e9dba88316/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: /home/tiit/ncs/v2.7.0/nrfxlib/zboss/production/lib/cortex-m4/hard-float/libzboss.ed.a(zdo_app_leave.ed.o): in function `zb_send_leave_signal':
zdo_app_leave.c:(.text.zb_send_leave_signal+0x20): undefined reference to `zboss_signal_handler'

The working Zigbee code is all in C files and links just fine. The Matter examples all use CPP files. I suspect something related to that or using sysbuild is what is breaking it for me. Unfortunately I have no real idea where to continue investigating the problem now. I really want to have one project that can be used for both Zigbee and Matter builds. I'm not very familiar with Zephyr or the whole new build system so any help or guidance would be very helpful for me. I could privately share the whole project if that would help see what I'm doing wrong here.

Or am I approaching this thing wrong? Is there a better way to do this code sharing?

Tiit

Parents
  • Hi Tilt,

    Or am I approaching this thing wrong? Is there a better way to do this code sharing?

    I am just speaking from experience here but normally I would want to have the reliable working project to be the base rather than the new project that hasn't stood the test of time. However, considering the Matter project is in CPP, I see why you would want to have that as the base.

    As for the linking issue, I recommend checking which file in your project has zboss_signal_handler defined; and the trace back the CMakeLists.txt to see if there is anything that could have made the file not compiled.

    Hieu 

Reply
  • Hi Tilt,

    Or am I approaching this thing wrong? Is there a better way to do this code sharing?

    I am just speaking from experience here but normally I would want to have the reliable working project to be the base rather than the new project that hasn't stood the test of time. However, considering the Matter project is in CPP, I see why you would want to have that as the base.

    As for the linking issue, I recommend checking which file in your project has zboss_signal_handler defined; and the trace back the CMakeLists.txt to see if there is anything that could have made the file not compiled.

    Hieu 

Children
  • Hi Hieu,

    I have successfully compiled and tested the Zigbee exaples and Matter examples. And I have the Zigbee project for my own hardware also working with the older SDK and without Matter. My goal here is to somehow add Matter to the project. So my thinking was since Matter uses a very different codebase compared to the other examples I would base my whole thing on that. I have no idea where to even begin if I wanted to port the Matter example to the Zigbee sample.

    CMakeLists.txt definitely has that file and I can see that VSCode also knows where this handler is defined. I'm not sure where the object files are put in this build system but that is what I was going to look for next. I'm not sure if each CPP file is compiled into a separate obj file in this build but if they are I should be able to confirm that the file at least exists. My problem is the linker call in this build looks very weird to me. I'm used to seeing a list of object files being fed to the linker and then the linker assembles those into the final binary. But here I can't seem to find the list of object the linker even ingests.

    I have very little experience with Zephyr and this whole new build system so I may be doing something completely wrong here. But I don't see how I could make an example code to publicly share what the issue is. If at all possible I would like to privately share the whole proprietary project for someone to look at and maybe guide me a little.

    Tiit

Related