<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Creating an out-of-tree zephyr driver with bindings...</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/99244/creating-an-out-of-tree-zephyr-driver-with-bindings</link><description>I&amp;#39;m trying to create a Zephyr driver for a pressure sensor. I&amp;#39;ve seen the other examples, but one doesn&amp;#39;t use any dts bindings, and the other builds under west, and I need to build under VSCode, so neither one is being much help. I&amp;#39;ve gotten it close</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 02 May 2023 19:26:58 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/99244/creating-an-out-of-tree-zephyr-driver-with-bindings" /><item><title>RE: Creating an out-of-tree zephyr driver with bindings...</title><link>https://devzone.nordicsemi.com/thread/423391?ContentTypeID=1</link><pubDate>Tue, 02 May 2023 19:26:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0f30fd11-9fad-4e77-84f0-352c7a0bdf70</guid><dc:creator>keith.henrickson</dc:creator><description>&lt;p&gt;I think I have made progress!&lt;br /&gt;&lt;br /&gt;There are a view samples that have their own KConfig files in the NCS samples. For instance:&lt;/p&gt;
&lt;p&gt;C:\ncs\v2.3.0\nrf\samples\caf_sensor_manager&lt;br /&gt;&lt;br /&gt;I noticed that there&amp;#39;s a line in each of these:&lt;br /&gt;source &amp;quot;Kconfig.zephyr&amp;quot;&lt;br /&gt;&lt;br /&gt;I&amp;#39;m not sure why the pure west samples do not need that line, but I think it&amp;#39;s getting it going under VSCode. The defines are now set as I&amp;#39;d expect, and code is being compiled (or rather, attempting to be as I still have much work to do) that&amp;#39;s only compiled if certain defines are set.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Creating an out-of-tree zephyr driver with bindings...</title><link>https://devzone.nordicsemi.com/thread/423389?ContentTypeID=1</link><pubDate>Tue, 02 May 2023 19:06:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4e3fc49c-8636-42e4-b718-e986e5549ae2</guid><dc:creator>keith.henrickson</dc:creator><description>&lt;p&gt;I tried two things:&lt;br /&gt;&lt;br /&gt;1. I just use the project as it was. CMake gave me an error:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error in CMakeLists.txt:
  No CMAKE_C_COMPILER could be found.

  Tell CMake where to find the compiler by setting either the environment
  variable &amp;quot;CC&amp;quot; or the CMake cache entry CMAKE_C_COMPILER to the full path to
  the compiler, or to the compiler name if it is in the PATH.


CMake Error in CMakeLists.txt:
  No CMAKE_CXX_COMPILER could be found.

  Tell CMake where to find the compiler by setting either the environment
  variable &amp;quot;CXX&amp;quot; or the CMake cache entry CMAKE_CXX_COMPILER to the full path
  to the compiler, or to the compiler name if it is in the PATH.


CMake Warning (dev) in CMakeLists.txt:
  No cmake_minimum_required command is present.  A line of code such as

    cmake_minimum_required(VERSION 3.20)

  should be added at the top of the file.  The version specified may be lower
  if you wish to support older CMake versions for this project.  For more
  information run &amp;quot;cmake --help-policy CMP0000&amp;quot;.
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I tried altering the CMakeLists.txt to what I thought it might be looking for:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;#
# Copyright (c) 2022 Circuit Dojo LLC
#
# SPDX-License-Identifier: Apache-2.0
#

cmake_minimum_required(VERSION 3.20.0)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(adc1219)

zephyr_include_directories(include)

add_subdirectory(drivers/adc)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;And I get the same error I did when I tried with my project:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;Traceback (most recent call last):
  File &amp;quot;C:/ncs/v2.3.0/zephyr/scripts/kconfig/kconfig.py&amp;quot;, line 292, in &amp;lt;module&amp;gt;
    main()
  File &amp;quot;C:/ncs/v2.3.0/zephyr/scripts/kconfig/kconfig.py&amp;quot;, line 65, in main
    if kconf.syms[&amp;#39;WARN_DEPRECATED&amp;#39;].tri_value == 2:
KeyError: &amp;#39;WARN_DEPRECATED&amp;#39;
CMake Error at C:/ncs/v2.3.0/zephyr/cmake/modules/kconfig.cmake:328 (message):
  command failed with return code: 1
Call Stack (most recent call first):
  C:/ncs/v2.3.0/nrf/cmake/modules/kconfig.cmake:29 (include)
  C:/ncs/v2.3.0/zephyr/cmake/modules/zephyr_default.cmake:108 (include)
  C:/ncs/v2.3.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
  C:/ncs/v2.3.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:97 (include_boilerplate)
  CMakeLists.txt:8 (find_package)
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Creating an out-of-tree zephyr driver with bindings...</title><link>https://devzone.nordicsemi.com/thread/423274?ContentTypeID=1</link><pubDate>Tue, 02 May 2023 11:52:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:18c52912-c250-4317-9011-d1d6e72ba238</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>[quote user="keith.henrickson"]I see these samples, but they&amp;#39;re not helpful, because I&amp;#39;m not building with west, so I don&amp;#39;t have a zephyr module to modify.&lt;br /&gt;&lt;br /&gt;I need something that works under VSCode, where the zephyr directory does not exist.[/quote]
&lt;p&gt;VS Code uses west under the hood.&lt;/p&gt;
&lt;p&gt;If you press &amp;quot;Build&amp;quot;, VS Code will run &amp;quot;west build ...&amp;quot;. You can check the log in the Terminal to see the full command used.&lt;/p&gt;
&lt;p&gt;You can still create the folder structure and files required for an out-of-tree module using VS Code.&lt;/p&gt;
&lt;p&gt;As far as I know, we do not have an official guide on how to add out-of-tree drivers with dts files.&lt;br /&gt;Jaredwolff is skilled, so the guide posted by Victor is likely good.&lt;/p&gt;
&lt;p&gt;As an alternative, I have seen this unofficial blog on this: &lt;a href="https://iwasz.pl/electronics/2021-06-18-out-of-tree-zephyr-module.md/"&gt;https://iwasz.pl/electronics/2021-06-18-out-of-tree-zephyr-module.md/&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Sigurd Hellesvik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Creating an out-of-tree zephyr driver with bindings...</title><link>https://devzone.nordicsemi.com/thread/423122?ContentTypeID=1</link><pubDate>Mon, 01 May 2023 15:05:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c44b2fee-1b51-4be5-b7ba-f4bf04090021</guid><dc:creator>keith.henrickson</dc:creator><description>&lt;p&gt;I see these samples, but they&amp;#39;re not helpful, because I&amp;#39;m not building with west, so I don&amp;#39;t have a zephyr module to modify.&lt;br /&gt;&lt;br /&gt;I need something that works under VSCode, where the zephyr directory does not exist.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Creating an out-of-tree zephyr driver with bindings...</title><link>https://devzone.nordicsemi.com/thread/423100?ContentTypeID=1</link><pubDate>Sun, 30 Apr 2023 22:15:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:005aae8d-fdd9-4325-9f2e-574674881f31</guid><dc:creator>vcbz</dc:creator><description>&lt;p&gt;Hello Keith,&lt;/p&gt;
&lt;p&gt;I was also wondering how to develop out of tree drivers with bindings and found some time this example&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a id="" href="https://github.com/jaredwolff/ads1219/tree/master"&gt;https://github.com/jaredwolff/ads1219/tree/master&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Here the author has a driver for the ADC ADS1219. The important part is that his zephyr module points to the DTS root folder and Kconfig via the module.yml file&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/jaredwolff/ads1219/blob/master/zephyr/module.yml#L5"&gt;https://github.com/jaredwolff/ads1219/blob/master/zephyr/module.ym&lt;/a&gt;l&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Hope this helps and serves as a starting point.&lt;br /&gt;&lt;br /&gt;Regards,&lt;br /&gt;Victor&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>