Suggestions for handling multiple projects in a workspace

Hi all,

This question is kind of a continuation of my research using the nRF5340DK external flash as a XIP. I needed to use mcuboot and discovered this wonderful sample provided on NordicPlayground github: QSPI XIP with internal flash application support

It does exactly what I need, and the setup steps are well documented. So it's time to integrate with my custom applications!

The apps I'm currently developing are inside an ordinary ncs directory, which was setup a while ago. Each app is a subdirectory with a git repository associated to them. I decided then to modify the west.yml file in order to add my repositories as projects. This is the result:

manifest:
  self:
    west-commands: scripts/west-commands.yml
    path: projects

  remotes:
    - name: ncs
      url-base: https://github.com/nrfconnect
    - name: my_company
      url-base: [email protected]:my_company

  projects:
    - name: nrf
      remote: ncs
      repo-path: sdk-nrf
      revision: v2.5.0
      import: true

    - name: project1
      remote: my_company
      revision: development
      submodules: true
      path: projects/project1

    - name: project2
      remote: my_company
      revision: development
      submodules: true
      path: projects/my_company

    - name: submodule1
      remote: my_company
      revision: development
      path: projects/submodule1

    - name: submodule2
      remote: my_company
      revision: development
      path: projects/submodule2

By doing this, I can create a directory and initialize the whole workspace (is a workspace, right?):

$ mkdir my-workspace & cd my-workspace
$ west init -m https://repo-url.com
$ west update

...

$ tree

.
├── bootloader
├── modules
├── nrf
├── nrfxlib
├── projects
│   ├── project1
│   ├── project2
│   ├── submodule1
│   ├── submodule2
│   ├── smp_svr
│   └── zephyr
├── test
├── tools
└── zephyr

Everything builds and I can use the custom XIP_SPLIT_IMAGE config entry. But issues happen when I try to use git inside any of my projects due to this:

my-workspace/projects/project1$ git status
HEAD detached at refs/heads/manifest-rev
nothing to commit, working tree clean

my-workspace/projects/project1$ git checkout development
error: pathspec 'developmen' did not match any file(s) known to git

my-workspace/projects/project1$ git fetch origin
fatal: 'origin' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

I'm aware that this is the way west tool handles the repositories, but unfortunately is not what I need. I'd like to work on each project/submodule as I do when they are on ncs directory. I guess something similar to what happens with the nrf directory, which we can checkout to different tags/commits and then run west update on ncs

What would be the best approach for my needs? The simpler one (just copying KConfig, and modules folder on my ncs or project directory) didn't work well, since the symbol XIP_SPLIT_IMAGE is not recognized Disappointed

Many thanks in advance, and happy holidays! Slight smile

Leandro

Parents
  • Hi,

    I'm aware that this is the way west tool handles the repositories, but unfortunately is not what I need.

    Can you elaborate on this?

    Cause as far as my experience goes on this, west just touches the git repos when you run west commands. Other than that, we are free to do with the git repos as we please. The downside of that has mostly been that my git repos get reset when I run "west update".

    However, I have not seen the error you see before.

    First, something is off in your pasted log:

    "my-workspace/projects/project1$ git checkout development
    error: pathspec 'developmen' did not match any file(s) known to git"

    It can not find "devlopemen", but you typed "developement". Why are these different?

    Maybe there is an error here?

    Regards,
    Sigurd Hellesvik

  • Hi Sigurds, thanks for the response.

    Regarding the typo, I misspelled when writing the post. I meant to say development. However, just to ensure it:

    my-workspace/projects/project1$ git checkout development
    error: pathspec 'development' did not match any file(s) known to git

    Can you elaborate on this?

    I mean, what I'd like to have is a workspace directory in which I can use this mcuboot+XIP feature, and also have my repositories where I could develop my applications independently. They need to be inside this workspace so the symbol XIP_SPLIT_IMAGE is recognized (among other features provided by the original github repo).

    Editing the original west.yml file so I can fetch my repos and clone them under the projects/ subdirectory works, but all of them are with the HEAD detached at refs/heads/manifest-rev. So I cannot checkout to any branch (ie development) in order to create new branches and work as I did before, when the repos lived under ncs/ directory.

    I guess that maybe what I can do is to leave the west manifest as is, and clone the repositories manually. I don't know if I loose some of the west features and strengths by doing this, but it may serve my purpose.

    I'll let you know what happens in that case.

    Regards,

    Leandro

Reply
  • Hi Sigurds, thanks for the response.

    Regarding the typo, I misspelled when writing the post. I meant to say development. However, just to ensure it:

    my-workspace/projects/project1$ git checkout development
    error: pathspec 'development' did not match any file(s) known to git

    Can you elaborate on this?

    I mean, what I'd like to have is a workspace directory in which I can use this mcuboot+XIP feature, and also have my repositories where I could develop my applications independently. They need to be inside this workspace so the symbol XIP_SPLIT_IMAGE is recognized (among other features provided by the original github repo).

    Editing the original west.yml file so I can fetch my repos and clone them under the projects/ subdirectory works, but all of them are with the HEAD detached at refs/heads/manifest-rev. So I cannot checkout to any branch (ie development) in order to create new branches and work as I did before, when the repos lived under ncs/ directory.

    I guess that maybe what I can do is to leave the west manifest as is, and clone the repositories manually. I don't know if I loose some of the west features and strengths by doing this, but it may serve my purpose.

    I'll let you know what happens in that case.

    Regards,

    Leandro

Children
  • lsoria said:

    Editing the original west.yml file so I can fetch my repos and clone them under the projects/ subdirectory works, but all of them are with the HEAD detached at refs/heads/manifest-rev. So I cannot checkout to any branch (ie development) in order to create new branches and work as I did before, when the repos lived under ncs/ directory.

    Currently I am working from a rental laptop, so my setup is unfamiliar. When I get back to the office next week, I will try to reproduce what you see here.
    Either I see something different than you and can send you a recording of it. Or I see the same and can help you figure out a way around it.

  • Well, I am stuck on my way from vacation to the city where my office is due to a snowstorm, so you will have to wait one more week, I will have a look at this next week.

  • lsoria said:
    Editing the original west.yml file so I can fetch my repos and clone them under the projects/ subdirectory works, but all of them are with the HEAD detached at refs/heads/manifest-rev. So I cannot checkout to any branch (ie development) in order to create new branches and work as I did before, when the repos lived under ncs/ directory.

    This seems odd. From my experience you should be able to interact with those git repos.

    Which west.yml file exactly did you edit to add your projects?

Related