Skip to content

Zephyr external modules cannot be placed inside zephyr directory #1

@andung07

Description

@andung07

What kind of issue is this?

  • Question.
    This issue tracker is not the place for questions. If you want to ask how to do something,
    or to understand why something isn't working the way you expect it to,
    use Community Forums or Premium Support

  • PlatformIO IDE.
    All issues related to PlatformIO IDE should be reported to appropriate repository:
    PlatformIO IDE for Atom or
    PlatformIO IDE for VSCode

  • Development Platform or Board.
    All issues (building, uploading, adding new boards, etc.) related to PlatformIO development platforms
    should be reported to appropriate repository related to your hardware
    https://github.com/topics/platformio-platform

  • Feature Request.
    Start by telling us what problem you’re trying to solve. Often a solution
    already exists! Don’t send pull requests to implement new features without first getting our
    support. Sometimes we leave features out on purpose to keep the project small.

  • PlatformIO Core.
    If you’ve found a bug, please provide an information below.

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
  1. Register the module dir in zephyr/CMakeLists.txt
list(APPEND ZEPHYR_EXTRA_MODULES
    ${CMAKE_CURRENT_SOURCE_DIR}/drivers/m24m02
)
  1. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions