Out of tree driver sample in

Hello

I created the out of tree sample sensor application with SDK 2.6.2 and it built just fine
However it builds only when it is inside the sdk that was pulled when I selected sample in VSCode

My goal is to make it a standalone app with the "drivers", "lib", "dts" directires inside the "app" directory
When I restructured it this way the build fails. I tried everything but no luck. Is it possible to do this with the SDK 2.6 driver model?
My application is attached.

ncs-example-application.zip

Would appreciate some help here

Thank you

Andy

Parents
  • Hi Andy,

    Are you using the NCS Example Application, or is it just a naming coincidence?

    I see that your attached project does have a west.yml file, so it seems you indeed are using the example application. 

    In such a case, notice how in the example, there are directories named "drivers," "lib," and "dts" on the same level as the "app" directory.

    This is the intended design. Is there any reason why you need those directories inside the "app" directory?

    Hieu

Reply
  • Hi Andy,

    Are you using the NCS Example Application, or is it just a naming coincidence?

    I see that your attached project does have a west.yml file, so it seems you indeed are using the example application. 

    In such a case, notice how in the example, there are directories named "drivers," "lib," and "dts" on the same level as the "app" directory.

    This is the intended design. Is there any reason why you need those directories inside the "app" directory?

    Hieu

Children
  • Yes,i would like to keep evertyhing inside the app directory if that's possible

  • I understand that's what you want, but not why you want it. I don't see any technical need that cannot be satisfied with the current setup.

    If I know your blocking points, perhaps I can suggest an easier alternative, or feedback to our teams of a use case.

    Nonetheless, I tried making these change to the ncs-example-application in addition to moving "dts," "drivers," and "lib." It works.

    diff --git a/CMakeLists.txt b/CMakeLists.txt
    index b8b7f59..35a37ed 100644
    --- a/CMakeLists.txt
    +++ b/CMakeLists.txt
    @@ -6,5 +6,5 @@
     
     zephyr_include_directories(include)
     
    -add_subdirectory(drivers)
    -add_subdirectory(lib)
    +add_subdirectory(app/drivers)
    +add_subdirectory(app/lib)
    diff --git a/Kconfig b/Kconfig
    index 3bd03f2..7454873 100644
    --- a/Kconfig
    +++ b/Kconfig
    @@ -5,5 +5,5 @@
     # as the module Kconfig entry point (see zephyr/module.yml). You can browse
     # module options by going to Zephyr -> Modules in Kconfig.
     
    -rsource "drivers/Kconfig"
    -rsource "lib/Kconfig"
    +rsource "app/drivers/Kconfig"
    +rsource "app/lib/Kconfig"
    diff --git a/zephyr/module.yml b/zephyr/module.yml
    index 047032a..e2c722d 100644
    --- a/zephyr/module.yml
    +++ b/zephyr/module.yml
    @@ -17,4 +17,4 @@ build:
         # Zephyr will use the `<dts_root>/dts` for additional dts files and
         # `<dts_root>/dts/bindings` for additional dts binding files. The `.` is
         # the root of this repository.
    -    dts_root: .
    +    dts_root: app/.
    

  • Thank you 
    I'll give it a try and let you know

Related