Why doesn't the build include driver files?

Followed the instructions for Zephyr workspace application.

the structure follows the example-application and video "tutorial: mastering Zephyr Driver Development" by Gerald Paretas.

at the file search stage, the cmake function message() shows that it goes into the driver folder.

But the application builds successfully only when this driver file is copied to \zephyrproject\zephyr\drivers\display
and add the line to the CMakeLists.txt file, which is located in this folder:
zephyr_library_sources_ifdef(CONFIG_ILI9486 display_ili9486.c).

I'm using windows 11, zephyr-v3.5.0-3682-gd7af6f371034

I'm going through the Getting Started Guide completely.
Applications are located in Zephyr workspace.
Simple examples are built successfully.
But if it’s a little more complicated, then errors appear inside Zephyr.

So, the Example application builds with errors out of the box. To avoid errors, I need to specify additional Kconfig parameters. (Case ID: 320177)

5707.test-origin-tft.zip

Parents
  • Hi,

     

    Based on your project, it seems that you have converted from a "workspace application" to a "freestanding application".

     

    You are adding an addition to the already present ili-display drivers in zephyr, as seen from the output when you're configuring:

    Loading Zephyr default modules (Zephyr base).
    -- Application: /tmp/test
    -- CMake version: 3.22.1
    -- Found Python3: /usr/bin/python (found suitable version "3.10.12", minimum required is "3.8") found components: Interpreter 
    -- Cache files will be written to: /home/hkn/.cache/zephyr
    -- Zephyr version: 3.5.0 (/opt/repos/upstream-zephyr/zephyr)
    -- Found west (found suitable version "1.0.0", minimum required is "0.14.0")
    -- Board: nrf52840dk_nrf52840
    -- Shield(s): waveshare_3_5_tft_sku_13506
    -- Found host-tools: zephyr 0.16.0 (/opt/zephyr-sdk/zephyr-sdk-0.16.0)
    -- Found toolchain: zephyr 0.16.0 (/opt/zephyr-sdk/zephyr-sdk-0.16.0)
    -- Found Dtc: /usr/bin/dtc (found suitable version "1.6.1", minimum required is "1.4.6") 
    -- Found BOARD.dts: /opt/repos/upstream-zephyr/zephyr/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts
    -- Found devicetree overlay: /tmp/test/boards/shields/waveshare_3_5_tft_sku_13506/waveshare_3_5_tft_sku_13506.overlay
    -- Found devicetree overlay: /tmp/test/boards/shields/waveshare_3_5_tft_sku_13506/boards/nrf52840dk_nrf52840.overlay
    -- Generated zephyr.dts: /tmp/test/build/zephyr/zephyr.dts
    -- Generated devicetree_generated.h: /tmp/test/build/zephyr/include/generated/devicetree_generated.h
    -- Including generated dts.cmake file: /tmp/test/build/zephyr/dts.cmake
    
    warning: ILI9486 (defined at /tmp/test/drivers/display/Kconfig.ili9xxx:8) was assigned the value 'y'
    but got the value 'n'. Check these unsatisfied dependencies: DT_HAS_ILITEK_ILI9486_ENABLED (=n). See
    http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_ILI9486 and/or look up ILI9486 in the
    menuconfig/guiconfig interface. The Application Development Primer, Setting Configuration Values,
    and Kconfig - Tips and Best Practices sections of the manual might be helpful too.
    
     

    The symbol "DT_HAS_ILITEK_ILI9486_ENABLED" has not been selected, which comes from your device tree.

    This seems to be non-selected in waveshare_3_5_tft_sku_13506.overlay:

    ...Line 49
    	ili9486_waveshare_3_5_tft_sku_13506: ili9488@0 {
    		compatible = "ilitek,ili9488";
    ...

    I assume you want the compatible to be "ilitek,ili9486" and "ili9486@0"?

     

    But the application builds successfully only when this driver file is copied to \zephyrproject\zephyr\drivers\display
    and add the line to the CMakeLists.txt file, which is located in this folder:
    zephyr_library_sources_ifdef(CONFIG_ILI9486 display_ili9486.c).

    There is a conflict in your kconfig, where you select the symbol "ILI9XXX". This is present both in zephyr (see here: https://github.com/nrfconnect/sdk-zephyr/blob/v3.4.99-ncs1/drivers/display/Kconfig.ili9xxx#L8-L11) as well as in your application drivers/display/Kconfig.ili9xxx.

    You have to rename your kconfig symbol to avoid a conflict.

     

    Kind regards,

    Håkon

  • Sorry, an old file got caught while preparing the zip. I tested it on it and now ili9486 is there.

    Apparently my problems are due to the fact that I did not understand the role of the manifest file, and in it the term
    "repository of your application".
    I don't use git, and maybe that's why these things are not clear.
    The examples that come with Zephyr contain the file "sample.yaml", but how does it relate to "west.yaml" is not entirely clear.

    You're right, I got a mix of Star topology and Forest topology.

    My folder structure:

    west-workspace/
    │
    ├── applications
    │       │
    │       ├── app1/               
    │       │     ├── CMakeLists.txt
    │       │     ├── prj.conf
    │       │     └── src/
    │       │          └── main.c
    │       ├── app2/             
    │             ├── CMakeLists.txt
    │             ├── prj.conf
    │             └── src/
    │                   └── main.c
    ├── manifest-repo/
    │   └── west.yml  
    ├── modules/
    │   └── lib/
    │
    └── zephyr/          
        └── west.yml 

    My west.yml in manifest-repo

    manifest:
      defaults:
        remote: remote2
    
       remotes:
        - name: zephyrproject-rtos
          url-base: https://github.com/zephyrproject-rtos
        - name: remote1
          url-base: https://github.com/####
        - name: remote2
          url-base: https://github.com/####
    
      projects:
        - name: zephyr
          remote: zephyrproject-rtos
          import: 
        - name: testlcd
          description: the test LCD example project
          remote: remote1      # The remote url-base is appended with a / and the project name to form the URL.
          path: applications/testlcd
        - name: testlaborigintft
          description: the test LCD project from sample (not use ili9488 driver)
          remote: remote2
          path: applications/testlaborigintft
      self:
        path: manifest-repo

    I was trying to avoid multiple duplicates of the original Zephyr files.

    Thanks for the reply.
    I will check my Kconfig today.

    The ili9xxx driver is universal, but it does not work with ili9486.
    And I thought that the priority in connecting driver files is higher in the application than in what is in Zephyr.
    But this is not a question for you.

    Thanks again.
    I spent a lot of time getting a working sample of 52840dk+waveshare sku-13506 + zephyr + lvgl, and lost motivation.

    The ticket can be closed.

  • Hi,

     

    Paultino_nordost said:

    I did not find the "manifest-repo" in the source code, and the documentation at this point is not clear to me.

    Do I need to write [manifest] path = manifest-repo in .west/config or does west automatically go to this folder?

    Just for reference, T3 is a forest topology:

    https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/develop/west/workspaces.html#t3-forest-topology

    "manifest-repo" is a arbitrary name that matches where the west.yml is located.

    This could have been any name, as long as the initial west workspace (.west/config) points towards this path.

     

    Paultino_nordost said:
    Do I need to write [manifest] path = manifest-repo in .west/config or does west automatically go to this folder?

    This is done when you initialize your west workspace, as shown in the file view here:

    https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/installation/install_ncs.html#get-the-ncs-code

    .west will be automatically generated to point towards your workspace's west.yml. In the above case, it will be <west-workspace>/nrf/west.yml.

     

    Kind regards,

    Håkon

  • Hi all,

    Thanks everyone. I'm done. Came out.

    Apparently Zephyr doesn’t want to be friends with me. It was easier for me to find the reason for a non-working example and figure out how to write a driver than to configure it to work without errors. This happened first today

    Then, after the update of the West, this.

    Traceback (most recent call last):
      File "<frozen runpy>", line 198, in _run_module_as_main
      File "<frozen runpy>", line 88, in _run_code
      File "C:\Program Files\Python311\Scripts\west.exe\__main__.py", line 7, in <module>
      File "C:\Program Files\Python311\Lib\site-packages\west\app\main.py", line 1085, in main
        app.run(argv or sys.argv[1:])
      File "C:\Program Files\Python311\Lib\site-packages\west\app\main.py", line 236, in run
        self.load_manifest()
      File "C:\Program Files\Python311\Lib\site-packages\west\app\main.py", line 254, in load_manifest
        self.manifest = Manifest.from_topdir(topdir=self.topdir,
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Program Files\Python311\Lib\site-packages\west\manifest.py", line 1207, in from_topdir
        return Manifest(topdir=topdir, config=config,
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Program Files\Python311\Lib\site-packages\west\manifest.py", line 1499, in __init__
        current_data=validate(self._ctx.current_data))
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Program Files\Python311\Lib\site-packages\west\manifest.py", line 541, in validate
        as_dict = _load(data)
                  ^^^^^^^^^^^
      File "C:\Program Files\Python311\Lib\site-packages\west\manifest.py", line 207, in _load
        return yaml.safe_load(data)
               ^^^^^^^^^^^^^^^^^^^^
      File "C:\Program Files\Python311\Lib\site-packages\yaml\__init__.py", line 125, in safe_load
        return load(stream, SafeLoader)
               ^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Program Files\Python311\Lib\site-packages\yaml\__init__.py", line 81, in load
        return loader.get_single_data()
               ^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Program Files\Python311\Lib\site-packages\yaml\constructor.py", line 49, in get_single_data
        node = self.get_single_node()
               ^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Program Files\Python311\Lib\site-packages\yaml\composer.py", line 36, in get_single_node
        document = self.compose_document()
                   ^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Program Files\Python311\Lib\site-packages\yaml\composer.py", line 55, in compose_document
        node = self.compose_node(None, None)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Program Files\Python311\Lib\site-packages\yaml\composer.py", line 84, in compose_node
        node = self.compose_mapping_node(anchor)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Program Files\Python311\Lib\site-packages\yaml\composer.py", line 127, in compose_mapping_node
        while not self.check_event(MappingEndEvent):
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Program Files\Python311\Lib\site-packages\yaml\parser.py", line 98, in check_event
        self.current_event = self.state()
                             ^^^^^^^^^^^^
      File "C:\Program Files\Python311\Lib\site-packages\yaml\parser.py", line 438, in parse_block_mapping_key
        raise ParserError("while parsing a block mapping", self.marks[-1],
    yaml.parser.ParserError: while parsing a block mapping
      in "<unicode string>", line 4, column 1:
        manifest:
        ^
    expected <block end>, but found '<block mapping start>'
      in "<unicode string>", line 11, column 3:
          remotes:
          ^
    

    I did everything according to the instructions, but apart from simple examples, nothing works for me.

    I need to make my way through the dark forest.

    Isn't it true that 100 days is a lot to build an example of display output? And most of them were spent looking for errors in the environment configuration.

    I even conducted an experiment on a clean installation of Ubuntu.

    "Application-example" west build -b nrf52840dk_nrf52840 had a build error.

    I went back to the SDK.

    I wanted two simple things.

    1. There is no duplicate of the original Zephyr files, since they are already on the disk.
    2. Don't publish my applications to Git.

  • Hi,

     

    This line:

    yaml.parser.ParserError: while parsing a block mapping

    Indicates that there might be a space/tab issue in the .yaml file itself. Have you checked if there is a mix of spaces and tabs in the file? Python (and yaml) is quite strict on this.

     

    1. There is no duplicate of the original Zephyr files, since they are already on the disk.
    2. Don't publish my applications to Git.

    Your original .zip is close to this, you just needed to make the changes that I posted to ensure that you do not have any symbol conflicts with the already present symbols in zephyr (ie. rename your "ILI9XXX" symbol and do the same with the corresponding .c file). Then you can add it as an application in vscode and use your already present ncs installation:

     

    Kind regards,

    Håkon

  • Thank you Håkon,  thank you for your time spent with me.
    The problem was with the "version". A space was needed before the word " version".


    Returning to point 2.
    What to write in the url-base?

    Should I remove the mention of applications?

    Not use my manifest file?

    manifest:
      defaults:
        remote: ncs
    
      version: "1.2"
    
      remotes:
        - name: ncs
          url-base: https://github.com/nrfconnect
        - name: zephyrproject
          url-base: https://github.com/zephyrproject-rtos
        - name: zephyrproject-rtos
          url-base: https://github.com/zephyrproject-rtos
        - name: remote1
          url-base: https://github.com/XXXX
        - name: remote2
          url-base: https://github.com/XXXX
    
      projects:
        - name: zephyr
          remote: zephyrproject-rtos
          revision: v3.5.0
          import:
        - name: testlcd
          description: the test LCD example project
          groups:
            - groupLearn
          remote: remote1      # The remote url-base is appended with a / and the project name to form the URL.
          path: applications/testlcd
        - name: testlaborigintft
          groups:
            - groupLearn
          description: the test LCD project from sample (not use ili9488 driver)
          remote: remote2
          path: applications/testlaborigintft
      self:
        path: manifest-store

  • Hi,

     

    Paultino_nordost said:
    Thank you Håkon,  thank you for your time spent with me.

    No need to thank me. Always happy to help out!

    Paultino_nordost said:
    The problem was with the "version". A space was needed before the word " version".

    Thanks for updating with the root-cause. Glad to hear that you found the issue, these syntax issues can be quite hard to identify.

    Paultino_nordost said:

    Returning to point 2.
    What to write in the url-base?

    Should I remove the mention of applications?

    Not use my manifest file?

    Right now, you're building an application that is a T3 type application, where the application is freestanding. This means that you will get a new clone of zephyr/ncs when initializing your application.

    If you want to compile your application with your current ncs-installation (ie. point to a pre-existing NCS installation), then you can add your current application, regardless of which path it is located in, to your vscode as an ncs application, as I previously mentioned:

    Håkon Alseth said:
    Your original .zip is close to this, you just needed to make the changes that I posted to ensure that you do not have any symbol conflicts with the already present symbols in zephyr (ie. rename your "ILI9XXX" symbol and do the same with the corresponding .c file). Then you can add it as an application in vscode and use your already present ncs installation:

     

    To answer your questions directly:

    1. The url-base must be the base of your repository, for instance https://github.com/my_user/my_newly_created_repository 

    This means that you will need to create a github-user and a repository to make this work.

     

    2. This highly depends, but based on your previous answers, you do not want several copies of the whole NCS tree. The easiest is to use a star topology, where you point towards a arbitrary version of zephyr (ie. whichever you have installed via the toolchain manager)

    Paultino_nordost said:
    Not use my manifest file?

    It does sound like you want to point to an existing installation as compared to having a completely standalone application (which clones the whole ncs-tree)

     

    Kind regards,

    Håkon

Reply
  • Hi,

     

    Paultino_nordost said:
    Thank you Håkon,  thank you for your time spent with me.

    No need to thank me. Always happy to help out!

    Paultino_nordost said:
    The problem was with the "version". A space was needed before the word " version".

    Thanks for updating with the root-cause. Glad to hear that you found the issue, these syntax issues can be quite hard to identify.

    Paultino_nordost said:

    Returning to point 2.
    What to write in the url-base?

    Should I remove the mention of applications?

    Not use my manifest file?

    Right now, you're building an application that is a T3 type application, where the application is freestanding. This means that you will get a new clone of zephyr/ncs when initializing your application.

    If you want to compile your application with your current ncs-installation (ie. point to a pre-existing NCS installation), then you can add your current application, regardless of which path it is located in, to your vscode as an ncs application, as I previously mentioned:

    Håkon Alseth said:
    Your original .zip is close to this, you just needed to make the changes that I posted to ensure that you do not have any symbol conflicts with the already present symbols in zephyr (ie. rename your "ILI9XXX" symbol and do the same with the corresponding .c file). Then you can add it as an application in vscode and use your already present ncs installation:

     

    To answer your questions directly:

    1. The url-base must be the base of your repository, for instance https://github.com/my_user/my_newly_created_repository 

    This means that you will need to create a github-user and a repository to make this work.

     

    2. This highly depends, but based on your previous answers, you do not want several copies of the whole NCS tree. The easiest is to use a star topology, where you point towards a arbitrary version of zephyr (ie. whichever you have installed via the toolchain manager)

    Paultino_nordost said:
    Not use my manifest file?

    It does sound like you want to point to an existing installation as compared to having a completely standalone application (which clones the whole ncs-tree)

     

    Kind regards,

    Håkon

Children
  • 1. The url-base must be the base of your repository, for instance https://github.com/my_user/my_newly_created_repository 

    This means that you will need to create a github-user and a repository to make this work.

    Right now, you're building an application that is a T3 type application, where the application is freestanding. This means that you will get a new clone of zephyr/ncs when initializing your application.

    We have closed the circle.

    Does this mean that two simple things don't work?

    I tried doing a clean install but was unable to remove the "nRF Connect for Desktop" on Win10.

    After installing it on a fresh system, I could not build the example from the video zds-2022-drivers-app, that the documentation refers to that it is good.

    I couldn't build my example with ili9486.

    I returned to my previous lvgl & ili9488 example, previously successfully build, but received an error.

    CMake Warning at C:/ncs/v2.5.1/zephyr/CMakeLists.txt:893 (message):
    No SOURCES given to Zephyr library: drivers__display

    I get an error on a fresh installation using the lvgl example.

    C:/ncs/v2.5.1/zephyr/include/zephyr/linker/linker-defs.h:26:10: fatal error: offsets.h: No such file or directory
    26 | #include <offsets.h>
    | ^~~~~~~~~~~

    Zephyr doesn't want to be friends with me.

    I understand that most likely I have a problem with the west.yml, but I cannot pinpoint exactly where it is.

    Comparing the volume of documentation for T1 and T2 and what is written about T3, can I believe about successful builds of T3?
    I asked on reddit, discord, circuitdojo, here but I didn’t get an answer from anyone.

    Thank you, Håkon

  • I compared Kconfig for three applications that said it worked for them with mine.

    These applications, they are on git, I could not build due to various errors.

    This magic is hidden somewhere in the depths of Zephyr.

    I went through all the points several times
    developer.nordicsemi.com/.../troubleshooting.html

    Not successful.

    Something depends on the settings of the west and the paths inside the Zephyr.

    This applies to applications based on the T3 topology.

    Simple examples are built without problems, from any folder.

    Here developer.nordicsemi.com/.../install_ncs.html

    the instruction is missing that you need to go one level below.

    Navigate to the ncs directory and run the following command in a terminal window:
    zephyr/zephyr-env.cmd

  • Hi,

     

    Just an FYI:

    Previously you were using upstream zephyr, and now you are pointing towards ncs v2.5.1, and there might have been a diff. in the samples/subsys/display/lvgl between those two tagged zephyr versions.

     

    Could you share your latest .zip file?

     

    Kind regards,

    Håkon

  • In the file prj.conf, see the comment above the line “CONFIG_DISPLAY=y”, it says about the current error.

    It doesn’t use drivers from the application, I need to copy these drivers to Zephyr so that the application can be built without errors..

    testlcd.zip

  • Thank you for sharing the latest. I see the exact same behavior.

     

    First off, I would like to thank you for your patience and effort in this matter, and also say that this process of an out-of-tree driver is not straight-forward, and I will bring this up internally.

     

    I'll try to sum up to my best knowledge what I did to atleast make it compile properly:

    1. in CMakeLists.txt, add this before find_package(...):

    list(APPEND ZEPHYR_EXTRA_MODULES
      ${CMAKE_CURRENT_SOURCE_DIR}/drivers
    )

    2. create file driver/zephyr/module.yml, containing:

    build:
      cmake: .
      kconfig: Kconfig
    

     

    This will point the "ZEPHYR_EXTRA_MODULES" and append it to the zephyr buildsystem.

    3. I moved your drivers folder structure a bit.

     

    Here is the .zip with the above changes. I was not able to successfully test it, but it does compile now:

    testlcd_outoftree_driver.zip

     

    Could you see if you also get this to run on your end?

     

    Kind regards,

    Håkon

Related