5

I haven't found a definitive info on how to add a driver module to out-of-tree Zephyr project, so I will provide the answer by my own.

0

2 Answers 2

7

Changes:

CMakeLists.txt

+set(ZEPHYR_EXTRA_MODULES drivers/ololo)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})

prj.conf

+CONFIG_OLOLO=y

Kconfig

No changes

New files:

drivers/ololo/CMakeLists.txt

zephyr_library()
zephyr_library_sources_ifdef(CONFIG_OLOLO ololo.c)

drivers/ololo/Kconfig

menuconfig OLOLO
        bool "Ololo driver"
        default y
        select BLAH
        depends on MEH
        help
          Enable support for ololo driver

if OLOLO

module = OLOLO
module-str = ololo
source "subsys/logging/Kconfig.template.log_config"

endif

drivers/ololo/ololo.c

/* Code goes here */

drivers/ololo/zephyr/module.yml

build:
  cmake: .
  kconfig: Kconfig
0

To add a custom driver module that specifically includes system calls, one may want to take a look at teslabs/zds-2022-drivers-app lock module driver.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.