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.
Asked
Active
Viewed 3,699 times
2 Answers
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

Andrejs Cainikovs
- 27,428
- 2
- 75
- 95
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.

Ivan Vnucec
- 604
- 1
- 5
- 17