In nRF Connect SDK (and Zephyr), there are three basic types of applications based on where the application is located:
Application type | Application location |
Repository | nRF Connect SDK repository |
Freestanding | Other locations |
Workspace | west workspace where Zephyr is installed |
An application located within the nRF Connect SDK source code repository in a Zephyr west workspace is referred to as a repository application. The samples and applications already in nRF Connect SDK are all examples of repository applications.
In the following example, asset_tracker_v2
and hello_world
are repository applications.
nRF-Connect-SDK/
├─── .west/
│ └─── config
└─── nrf/
├── applications/
│ ├── asset_tracker_v2/
│ └── ...
├── boards/
├── tests/
└── ...
└─── zephyr/
├── boards/
├── drivers/
├── samples/
│ ├── hello_world/
└── ...
└─── ...
File structureAn application located outside of a workspace is referred to as a freestanding application. The exercise code in the Nordic Developer Academy are all freestanding applications.
In the following example, inter_less1_exer1-solution
is a freestanding application:
<home>/
├─── nRF-Connect-SDK/
│ ├─── .west/
│ │ └─── config
│ ├── nrf/
│ ├── zephyr/
│ ├── bootloader/
│ ├── modules/
│ └── ...
│
└─── ncs-inter/
├── lesson1
│ └─── inter_less1_exer1_solution
│ ├── CMakeLists.txt
│ ├── prj.conf
│ └── src/
│ └── main.c
├── lesson2
├── ...
File structureAn application located within a west workspace, but outside the nRF Connect SDK repository itself, is referred to as a workspace application.
In the following example, app
is a workspace application:
my-workspace/
├─── .west/
│ └─── config
├─── nrf/
├─── zephyr/
├─── bootloader/
├─── modules/
├─── tools/
├─── ncs-example-application
└── app/
├── CMakeLists.txt
├── prj.conf
└── src/
└── main.c
File structurewest init
and west update
are the two most important workspace-related commands.
west init
creates a west workspace. This can either be done by cloning a new manifest repository from a remote URL, or creating a workspace around an existing local manifest repository.
Cloning a new manifest repository from a remote URL:
# initialize my-workspace for the ncs-example-application (main branch)
west init -m https://github.com/nrfconnect/ncs-example-application --mr main my-workspace
# update nRF Connect SDK modules
cd my-workspace
west update
Terminal commandCreating a workspace around a local manifest repository:
west init -l ncs-example-application
Terminal command