connectedhomeip: [BUG] [zephyr] Use connectedhomeip as a zephyr module

Reproduction steps

Hello, I’m trying to use connectedhomeip as a zephyr OS module. To do so, connectedhomeip is pulled from zephyr’s west.yaml like this:

- name: connectedhomeip
      remote : connectedhomeip
      revision: 648d7bf3d2e52ded740c94989965cd8485c85832
      path: modules/lib/matter
      submodules:
        - name: nlio
          path: third_party/nlio/repo
        - name: nlassert
          path: third_party/nlassert/repo
        - name: nlunit-test
          path: third_party/nlunit-test/repo
        - name: pigweed
          path: third_party/pigweed/repo
        - name: jsoncpp
          path: third_party/jsoncpp/repo

Next, I moved the zephyr folder in config/zephyr/chip-module to the root, and changed the paths to Kconfig and CMakeList.

My goal is to include the Kconfig CONFIG_CHIP=y in a standalone zephyr application, and see it compiled. My final goal is to compile a Matter zephyr application on an STM32 target. For now, I’ve added the Kconfig CONFIG_CHIP to the hello_world sample in zephyr/samples/cpp.

When I west build, I first get an error about chip_build_pw_rpc_lib = false, like this one. Then if I bypass this error, I get hundreds of other errors.

I had understood that the zephyr platform could be used standalone. Is there another way to use connectedhomeip as a zephyr module?

Bug prevalence

Whenever I do this

GitHub hash of the SDK that was being used

648d7bf3d2e52ded740c94989965cd8485c85832

Platform

other

Platform Version(s)

No response

Anything else?

log.txt

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 19 (19 by maintainers)

Most upvoted comments

The standalone Zephyr platform in Matter was added by one developer who abandoned the platform maintenance shortly after 😃, so I’m afraid, you will have to update the platform yourself if you want to use it.

Note that there are 3 other Zephyr-based platforms in Matter - nrfconnect, telink and NXP. Because of that, we don’t keep the Zephyr module manifest in the root directory (I mean not in this repo, but we do in our forks) but rather use ZEPHYR_EXTRA_MODULES CMake variable to add the selected Zephyr module (belonging to the selected Zephyr-based platform) to the build system.

Also, some files in src/platform/Zephyr are shared between all these platforms, so beware of that when modifying the code in there.

@Damian-Nordic it already help me a lot understanding what was done in ConnectivityManagerImpl. Thanks a lot ! I will close this issue too

The question is how you publish the services. Matter has the minimal mDNS implementation and if you use it, it tries to join ff02::fb multicast group using IPV6_JOIN_GROUP socket option. This option used to not be supported in Zephyr so we had to add a platform-specific handling (in ConnectivityManagerImpl). But if you use Zephyr’s mDNS implementation then this shouldn’t be needed.

You probably just need to read more of the Zephyr networking bits, enable verbose logging and analyze what happens under the hood. I won’t be able to assist with such general challenges, especially that you use a hardware platform that I’m not familiar with.

That being said, if you need to modify shared Zephyr files in Matter, feel free to ping me to review the changes.