Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] [zephyr] Use connectedhomeip as a zephyr module #33471

Open
QuentinCaldeira-eaton opened this issue May 15, 2024 · 5 comments
Open

[BUG] [zephyr] Use connectedhomeip as a zephyr module #33471

QuentinCaldeira-eaton opened this issue May 15, 2024 · 5 comments
Labels
bug Something isn't working needs triage

Comments

@QuentinCaldeira-eaton
Copy link

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

648d7bf

Platform

other

Platform Version(s)

No response

Anything else?

log.txt

@QuentinCaldeira-eaton QuentinCaldeira-eaton added bug Something isn't working needs triage labels May 15, 2024
@Damian-Nordic
Copy link
Contributor

Damian-Nordic commented May 15, 2024

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.

@QuentinCaldeira-eaton
Copy link
Author

All right, in the end, the Zephyr platform can't be used as such for pure Zephyr projects (without a manufacturer's SDK). The platform only works thanks to nRF, NXP and Telink implementations?
So, is the best approach to develop an STM32 Zephyr platform, or to make the Zephyr platform standalone?

@Damian-Nordic
Copy link
Contributor

I mean if you use vanilla Zephyr, it should be OK with you to use the standalone Zephyr platform in Matter. I just wanted to let you know that it's currently lacking a maintainer so it's not surprising that it doesn't work at the moment :). But if you can resurrect it, it may be the right choice. We as a Nordic use a separate platform because our SDK is a superset of Zephyr so we want to have a chance to use some extra features of our SDK in Matter.

@Damian-Nordic
Copy link
Contributor

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

@QuentinCaldeira-eaton
Copy link
Author

QuentinCaldeira-eaton commented May 30, 2024

Hi @Damian-Nordic ! I'm currently working on the Zephyr standalone app for STM32. I'm working with the stm32wb5mm_dk.
Here is my prj.conf for the app :

CONFIG_CHIP=y
CONFIG_CHIP_DEVICE_PRODUCT_ID=32773
CONFIG_STD_CPP17=y
CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y
CONFIG_BT=y
CONFIG_NETWORKING=y
CONFIG_NET_L2_OPENTHREAD=y
CONFIG_IEEE802154=y
CONFIG_ENTROPY_STM32_RNG=y

When I build the app, I have this error

/home/quentin/github/workspace/zephyr/include/zephyr/device.h:91:41: error: '__device_dts_ord_DT_CHOSEN_zephyr_ieee802154_ORD' undeclared here (not in a function)
   91 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
      |                                         ^~~~~~~~~
/home/quentin/github/workspace/zephyr/include/zephyr/toolchain/common.h:137:26: note: in definition of macro '_DO_CONCAT'
  137 | #define _DO_CONCAT(x, y) x ## y
      |                          ^
/home/quentin/github/workspace/zephyr/include/zephyr/device.h:91:33: note: in expansion of macro '_CONCAT'
   91 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
      |                                 ^~~~~~~
/home/quentin/github/workspace/zephyr/include/zephyr/device.h:228:37: note: in expansion of macro 'DEVICE_NAME_GET'
  228 | #define DEVICE_DT_NAME_GET(node_id) DEVICE_NAME_GET(Z_DEVICE_DT_DEV_ID(node_id))
      |                                     ^~~~~~~~~~~~~~~
/home/quentin/github/workspace/zephyr/include/zephyr/device.h:245:34: note: in expansion of macro 'DEVICE_DT_NAME_GET'
  245 | #define DEVICE_DT_GET(node_id) (&DEVICE_DT_NAME_GET(node_id))
      |                                  ^~~~~~~~~~~~~~~~~~
/home/quentin/github/workspace/zephyr/modules/openthread/platform/radio.c:96:9: note: in expansion of macro 'DEVICE_DT_GET'
   96 |         DEVICE_DT_GET(DT_CHOSEN(zephyr_ieee802154));

I can't find a resource linked to this __device_dts_ord_DT_CHOSEN_zephyr_ieee802154_ORD device tree function.
Do you know more about that ?

Thanks in advance !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage
Projects
None yet
Development

No branches or pull requests

2 participants