'ZephyrOS: how to add driver module to out of tree project
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.
Solution 1:[1]
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
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Andrejs Cainikovs |