Best way to reuse two projects in ncs as a module

Hi,

I have an application called `main_repo` built using v2.1.1 (the SDK version doesn't really matter). This contains all source code, dts files, Kconfig files, etc. to building a specific product with an nRF5340 chip.

I have a second repo, called `research_repo`, which I would like to inherit everything from `main_repo`, with a few exceptions. Particularly, `main_repo/app` and `research_repo/app` are different, but the boards, drivers, and source code should be able to be referenced from `research_repo`. Essentially, `main_repo` is upstream of `research_repo`.

If I'm using pure Zephyr, then I would just add the following to `west.yml` (see code snippet). After `west update` in `my-workspace` (which contains `research_repo`), this loads `my-workspace/modules/main_repo`, and I can refer to all of the boards, dts, Kconfig, etc. inside `research_repo`.

But under `C:\ncs\v2.1.1`, I need to modify `nrf\west.yml` by hand. This isn't ideal.

Is there a recommended way of doing it?

I can't make changes to `main_repo`, but I can make all sorts of `west.yml`, or custom scripts, under `research_repo` to make this happen.

# Copyright (c) 2021 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0

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

  remotes:
    - name: zephyrproject-rtos
      url-base: https://github.com/zephyrproject-rtos
    - name: main_repo
      url-base: https://github.com/mycompany

  projects:
    - name: zephyr
      remote: zephyrproject-rtos
      revision: main
      import:
        # By using name-allowlist we can clone only the modules that are
        # strictly needed by the application.
        name-allowlist:
          - cmsis      # required by the ARM port
          - hal_nordic # required by the custom_plank board (Nordic based)
          - hal_stm32  # required by the nucleo_f302r8 board (STM32 based)
    - name: main_repo
      remote: main_repo
      revision: v1.0.0

Parents Reply Children
No Data
Related