platformio / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
9 stars 11 forks source link

Zephyr external modules cannot be placed inside zephyr directory #1

Open andung07 opened 4 years ago

andung07 commented 4 years ago

What kind of issue is this?

You can erase any parts of this template not applicable to your Issue.


Configuration

Operating system: Mac OS 10.15.5

PlatformIO Version (platformio --version): 4.3.4

Description of problem

This is a problem with the zephyr framework integration. I am developing a custom device driver and I don't want to put it inside zephyr tree. I go with external modules as described here and here. I put the module source inside zephyr directory, but the compilation error unable to find the source files.

Steps to Reproduce

  1. Create a module directory inside zephyr dir (alongside with the CMakeLists.txt and prj.conf)
  2. Structure the module directory as described here
    zephyr
    _drivers
    __m24m02
    ___ zephyr
    ____CMakeLists.txt
    ____Kconfig
    ____m24m02.c
  3. Register the module dir in zephyr/CMakeLists.txt
    list(APPEND ZEPHYR_EXTRA_MODULES
    ${CMAKE_CURRENT_SOURCE_DIR}/drivers/m24m02
    )
  4. Enable the module as the registered Kconfig entry in step 2 by modifying zephyr/prj.conf
    CONFIG_M24M02=y

Actual Results

*** [.pio/build/solemetrix_dwm1001/………solemetrix-repo__gms-firmware__zephyr__drivers__m24m02__zephyr/modules/m24m02/m24m02.c.o] Source src/drivers/m24m02/zephyr/m24m02.c' not found, needed by target .pio/build/solemetrix_dwm1001/……__…__solemetrix-repo__gms-firmware__zephyr__drivers__m24m02__zephyr/modules/m24m02/m24m02.c.o’.

Expected Results

Build successfully

If problems with PlatformIO Build System:

The content of platformio.ini:

[env:solemetrix_dwm1001]
platform = nordicnrf52
board = solemetrix_dwm1001
framework = zephyr
monitor_speed = 11520

Additional info

I replicated the the project structure and managed to compile it using west build. Please kindly advise to get it working in platformio.

Solution

It turned out that the source cannot be placed inside the zephyr directory. I created an additional directory in the root platformio project and moved the module source there.

zephyr
zephyr_ext
_drivers
__m24m02
___ zephyr
____CMakeLists.txt
____Kconfig
____m24m02.c

Suggestion

If this is a limitation, please update the documentation. Otherwise, please fix the bug. Thank you.