Help with out of tree driver addition #nrf52840


@simo
 

Hi all, I'm working on a custom product based on the nRF9160 and am trying to setup our version control repo outside of the Zephyr (or in this case the Nordic SDK). Currently I have the following directory structure:

> Project
  > ncs
    > mbedtls
    > mcuboot
    > modules
    > nrf
    > nrfxlib
    > test
    > zephyr
  > myRepo
    > boards
    > drivers
      > CMakeLists.txt
      > Kconfig
      > sensor
        > CMakeLists.txt
        > Kconfig
        > tmp116
          > CMakeLists.txt
          > Kconfig
          > tmp116.c
          > tmp116.h
    > dts
      > bindings
        > sensor
          > ti,tmp116.yaml
    > samples

So far I've been able to create a sample project in myRepo/samples, and build it using cMake by specifying my BOARD and BOARD_ROOT. I'm able to include the zephyr-supported drivers and configure my board to use them.

Now I would like to add support for custom out of tree drivers (TI's TMP116 to start) and am getting stuck. So far I've added the driver folder as above and basically created the same structure as the tmp112 sensor driver in the Zephyr repo. I add CONFIG_SENSOR=y and CONFIG_TMP116=y to my proj.cfg. When I attempt to run cmake, however, I see the following error:

warning: attempt to assign the value 'y' to the undefined symbol TMP116

I've tried a number of things I was able to find online, but nothing has gotten me any closer to successfully building. I suspect that some of my CMakeLists aren't being picked up, or maybe I need to include myRepo as a module? Could someone please point me in the right direction?


@simo
 

I believe I made some progress after including "myRepo" as a submodule, however now I am running into this:

Including module:  in path: /home/stan/projects/projectRed/myRepo
CMake Error at /home/stan/projects/projectRed/nrfConnectCore/zephyr/CMakeLists.txt:604 (add_subdirectory):
  The binary directory
    /home/stan/projects/projectRed/myRepo/samples/tmp116/build/zephyr
  is already used to build a source directory.  It cannot be used to build
  source directory
    /home/stan/projects/projectRed/myRepo
  Specify a unique binary directory name.