Hello CircuitDojo Community,

I am working on a Zephyr based application targeting both sparkfun_thing_plus_nrf9160 dev board, and thingy91_nrf9160 dev board. My starting point for this application is Nordic Semi’s aws_iot sample app, from among the sample apps in their nrf-sdk code repository.

Following @jaredwolff recommendations in a post a couple of days ago (2021-Sept-14) I have created a west.yml manifest file and placed this along side a stand alone copy of aws_iot sample app. Before cloning this small project to my workstation I create a local directory named aws-iot-stand-alone. I clone my mentioned project to this directory. In the parent dir of this directory I run west init -l aws-iot-stand-alone. Next I change directories into aws-iot-stand-alone and I run west update.

Following these git clone and west set up steps, I try to build the project with this invocation:

 `west build -b thingy91_nrf9160ns`

And I get the error message:

west: error: argument <command>: invalid choice: 'build' (choose from 'init', 'update', 'list', 'manifest', 'diff', 'status', 'forall', 'help', 'config', 'topdir', 'selfupdate')

Strange thing is, I am able to build another small Zephyr based project of my own on the same workstation. I installed Nordic’s Zephyr toolchain a few weeks ago and have been building sample apps and custom apps over this span of time. I can still build them in certain west workspaces, but not the ones I have tried to create via fresh git clone ... west init steps for this latest personal project.

Is there a clue here I am missing, as to why west cannot find Zephyr’s extending commands, specifically ‘build’ and ‘flash’? As I understand, west init initializes a cloned project as a west workspace. Therefore I am calling west build ... inside a valid west workspace. But somehow west in the newly created workspace cannot “see” its Zephyr project command extensions.

Help on this issue much appreciated!

  • Ted

    tedhavelka66 what does your west.yml look like? Feel free to paste it here. Make sure it’s wrapped in 3 back tics at the top and bottom (```)

    Make sure you’re running the build in the folder with the west.yml manifest you’re using.

    Hi Jared,

    The west.yml file contents are:

    manifest:
      remotes:
        - name: nrfconnect-top-level-repo
          url-base: https://github.com/nrfconnect
        - name: zephyrproject
          url-base: https://github.com/zephyrproject-rtos
    
    ## Example 'remote' stanza originally from Jared Wolff AQW demo:
    ## Following remotes Ted locates on Nordic Semi document https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/introduction.html
      projects:
        - name: sdk-nrf # note 'name' is appended to URL base, whether URL in remote or URL specd in projects sequence entry - TMH
          remote: nrfconnect-top-level-repo
          repo-path: sdk-nrf
          revision: v1.6.1
          path: sdk-nrf # path to create in west workspace where this manifest file lives
    #      import: true
    
        - name: sdk-nrfxlib
          remote: nrfconnect-top-level-repo
          repo-path: sdk-nrfxlib
          revision: v1.6.1
          path: sdk-nrfxlib
    
        - name: sdk-mcuboot
          remote: nrfconnect-top-level-repo
          repo-path: sdk-mcuboot
          revision: v1.7.2
          path: sdk-mcuboot
    
        - name: sdk-zephyr
          remote: nrfconnect-top-level-repo
          repo-path: sdk-zephyr
          revision: v2.6.0-rc1-ncs1
          path: sdk-zephyr
    
    #    - name: zephyr
    #      remote: zephyrproject
    #      repo-path: zephyr
    #      revision: v2.6.0
    #      path: zephyr
    
      self:
        # This repository should be cloned to 
        path: aws-iot-stand-alone

    My apologies as well, I entered an incorrect github URL for the project in question. The stand alone aws_iot work is public 0n my personal github page.

    Looking back over Nordic Semi’s Zephyr toolchain install instructions I saw mention of a step to install some Python + west related requirements:

      _Zephyr’s scripts/requirements.txt file declares additional Python dependencies. Install them with pip3._
    
      _pip3 install --user -r ~/zephyrproject/zephyr/scripts/requirements.txt_

    With the west.yml manifest file I’ve pasted, after running west update with it, the closest requirements.txt file I can then find is located in sdk-zephyr, which is one of the projects referenced in my manifest file here. So I wonder whether I need to add another project to the manifest, in order to obtain Zephyr’s command extensions to west?

    • Ted

      tedhavelka66

      If I were you I would focus on simplifying. Here is what you’d probably need at most:

      manifest:
        remotes:
          - name: nrfconnect
            url-base: https://github.com/nrfconnect
        projects:
          - name: nrf
            repo-path: sdk-nrf
            remote: nrfconnect
            revision: v1.6.1
            import: true 
        self:
          # This repository should be cloned to 
          path: aws-iot-stand-alone

      Setup instructions will be very similar to the ones here once you have everything defined:

      https://github.com/circuitdojo/air-quality-wing-zephyr-demo

      Good evening @jaredwolff ,

      Thank you much for the direct help with the west.yml manifest file. This resolves west’s complaint “invalid choice: ‘build’…”! I am really curious to understand what “west mechanics” or elements are missing in the project refs of the older more complex manifest file, compared with the shorter one you provide?

      Curious thing also, I had actually first tried this very form of west.yml you give, modelling it from your air-quality-wing-zephyr-demo project. At that time for some reason I was not obtaining the board files directory for the thingy91_nrf9160. That prompted me to try to identify the likely dependencies I might be missing from Nordic’s sdk-nrf. I thought I’d be likely to refer to all needed deps by including the Nordic SDK projects mentioned in Nordic Semi’s opening paragraph about nRF Connect SDK. Appears I was overthinking the problem, or missed some difference in the experimenting steps I took along the way.

      In any case your solution now allows me to build via west. I can build for both desired target boards sparkfun_thing_plus_nrf9160ns and thingy91_nrf9160ns. The AWS IoT sample app requires that the build occur in non-secure mode, hence the ‘ns’ postfix to both board names.

      Thank you again for all the help Jared. Feels good to make some headway in the new territory called ‘Zephyr’!

      • Ted
        Terms and Conditions | Privacy Policy