Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions .github/workflows/build-using-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Build and test app in NCS docker container

on:
pull_request:
push:
branches:
- main
- 'v*-branch'

jobs:
set-image-tag:
runs-on: ubuntu-24.04
outputs:
IMAGE_TAG: ${{ steps.set-output.outputs.IMAGE_TAG }}
steps:
- name: Checkout repository with example application
uses: actions/checkout@v4
with:
path: example-application

- name: Prepare west project
run: |
python3 -m pip install west
west init -l example-application
west update -o=--depth=1 -n nrf

- name: Find toolchain bundle id
id: set-output
run: echo "IMAGE_TAG=$(./nrf/scripts/print_toolchain_checksum.sh)" >> $GITHUB_OUTPUT

build-and-test-in-docker:
needs: set-image-tag
runs-on: ubuntu-24.04
container: ghcr.io/nrfconnect/sdk-nrf-toolchain:${{ needs.set-image-tag.outputs.IMAGE_TAG }}
defaults:
run:
# Bash shell is needed to set toolchain related environment variables in docker container
# It is a workaround for GitHub Actions limitation https://github.com/actions/runner/issues/1964
shell: bash
steps:
- name: Checkout repository with example application
uses: actions/checkout@v4
with:
path: example-application

- name: Prepare west project
run: |
west init -l example-application
west update -o=--depth=1 -n

- name: Build firmware
working-directory: example-application
run: |
west twister -T app -v --inline-logs --integration

- name: Store hex files
uses: actions/upload-artifact@v4
with:
name: built-applications
path: example-application/twister-out/**/zephyr/zephyr.hex

- name: Twister Tests
working-directory: example-application
run: |
west twister -T tests -v --inline-logs --integration
41 changes: 41 additions & 0 deletions .github/workflows/build-using-toolchain-bundle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Build and test app in toolchain bundle environment

on:
pull_request:
push:
branches:
- main
- 'v*-branch'

jobs:
build-and-test-in-toolchain-bundle:
runs-on: ubuntu-24.04
steps:
- name: Checkout repository with example application
uses: actions/checkout@v4
with:
path: example-application

- name: Prepare west project
run: |
python3 -m pip install west
west init -l example-application
west update -o=--depth=1 -n

- name: Setup ncs toolchain
id: setup-toolchain
uses: nrfconnect/action-ncs-toolchain-setup@main
with:
nrf-path: nrf

- name: Build firmware
run: |
./nrfutil sdk-manager toolchain launch \
--toolchain-bundle-id ${{steps.setup-toolchain.outputs.toolchain-bundle-id}} \
--chdir example-application -- west twister -T app -v --inline-logs --integration

- name: Store hex files
uses: actions/upload-artifact@v4
with:
name: built-applications
path: example-application/twister-out/**/zephyr/zephyr.hex
55 changes: 0 additions & 55 deletions .github/workflows/build.yml

This file was deleted.

41 changes: 41 additions & 0 deletions .github/workflows/src-mirror.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: src-mirror

on:
workflow_dispatch:
inputs:
git-ref:
description: 'Branch, tag or SHA to checkout'
required: true
default: 'main'
push:
tags:
- '*'
pull_request:
types:
- opened
- synchronize
paths:
- .github/workflows/src-mirror.yml

concurrency:
group: src-mirror-${{ github.ref }}
cancel-in-progress: true

# Tar entire project west workspace, prune, and upload to artifact service.
jobs:
standard:
runs-on:
- runs-on=${{ github.run_id }}
- runner=16cpu-linux-x64
steps:
- name: Upload src.tar.gz
uses: nrfconnect/action-src-mirror@main
with:
path: 'ncs-example-application'
west-update-args: ''
artifactory-path: >-
${{ (github.ref_type != 'tag') &&
format('ncs-src-mirror/internal/{0}/{1}/src.tar.gz', github.event.repository.name, github.ref_name) ||
format('ncs-src-mirror/external/{0}/{1}/src.tar.gz', github.event.repository.name, github.ref_name) }}
artifactory-user: ${{ secrets.COM_NORDICSEMI_FILES_USERNAME }}
artifactory-pass: ${{ secrets.COM_NORDICSEMI_FILES_PASSWORD }}
1 change: 1 addition & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @gmarull @carlescufi
78 changes: 48 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# Zephyr Example Application
# nRF Connect SDK example application

<a href="https://github.com/zephyrproject-rtos/example-application/actions/workflows/build.yml?query=branch%3Amain">
<img src="https://github.com/zephyrproject-rtos/example-application/actions/workflows/build.yml/badge.svg?event=push">
<a href="https://github.com/nrfconnect/ncs-example-application/actions/workflows/build-using-docker.yml?query=branch%3Amain">
<img src="https://github.com/nrfconnect/ncs-example-application/actions/workflows/build-using-docker.yml/badge.svg?event=push">
</a>
<a href="https://github.com/zephyrproject-rtos/example-application/actions/workflows/docs.yml?query=branch%3Amain">
<img src="https://github.com/zephyrproject-rtos/example-application/actions/workflows/docs.yml/badge.svg?event=push">
<a href="https://github.com/nrfconnect/ncs-example-application/actions/workflows/docs.yml?query=branch%3Amain">
<img src="https://github.com/nrfconnect/ncs-example-application/actions/workflows/docs.yml/badge.svg?event=push">
</a>
<a href="https://zephyrproject-rtos.github.io/example-application">
<a href="https://nrfconnect.github.io/ncs-example-application">
<img alt="Documentation" src="https://img.shields.io/badge/documentation-3D578C?logo=sphinx&logoColor=white">
</a>
<a href="https://zephyrproject-rtos.github.io/example-application/doxygen">
<a href="https://nrfconnect.github.io/ncs-example-application/doxygen">
<img alt="API Documentation" src="https://img.shields.io/badge/API-documentation-3D578C?logo=c&logoColor=white">
</a>

This repository contains a Zephyr example application. The main purpose of this
repository is to serve as a reference on how to structure Zephyr-based
applications. Some of the features demonstrated in this example are:
This repository contains an nRF Connect SDK example application. The main
purpose of this repository is to serve as a reference on how to structure nRF Connect
SDK based applications. Some of the features demonstrated in this example are:

- Basic [Zephyr application][app_dev] skeleton
- [Zephyr workspace applications][workspace_app]
Expand All @@ -30,12 +30,12 @@ applications. Some of the features demonstrated in this example are:
- Custom [Zephyr runner][runner_ext]
- Doxygen and Sphinx documentation boilerplate

This repository is versioned together with the [Zephyr main tree][zephyr]. This
means that every time that Zephyr is tagged, this repository is tagged as well
This repository is versioned together with the [nRF Connect SDK main tree][sdk-nrf]. This
means that every time that nRF Connect SDK is tagged, this repository is tagged as well
with the same version number, and the [manifest](west.yml) entry for `zephyr`
will point to the corresponding Zephyr tag. For example, the `example-application`
v2.6.0 will point to Zephyr v2.6.0. Note that the `main` branch always
points to the development branch of Zephyr, also `main`.
will point to the corresponding nRF Connect SDK tag. For example, the `ncs-example-application`
v2.5.0 will point to nRF Connect SDK v2.5.0. Note that the `main` branch always
points to the development branch of nRF Connect SDK, also `main`.

[app_dev]: https://docs.zephyrproject.org/latest/develop/application/index.html
[workspace_app]: https://docs.zephyrproject.org/latest/develop/application/index.html#zephyr-workspace-app
Expand All @@ -44,27 +44,46 @@ points to the development branch of Zephyr, also `main`.
[board_porting]: https://docs.zephyrproject.org/latest/guides/porting/board_porting.html
[bindings]: https://docs.zephyrproject.org/latest/guides/dts/bindings.html
[drivers]: https://docs.zephyrproject.org/latest/reference/drivers/index.html
[zephyr]: https://github.com/zephyrproject-rtos/zephyr
[sdk-nrf]: https://github.com/nrfconnect/sdk-nrf
[west_ext]: https://docs.zephyrproject.org/latest/develop/west/extensions.html
[runner_ext]: https://docs.zephyrproject.org/latest/develop/modules.html#external-runners

## Getting Started
## Getting started

Before getting started, make sure you have a proper Zephyr development
environment. Follow the official
[Zephyr Getting Started Guide](https://docs.zephyrproject.org/latest/getting_started/index.html).
Before getting started, make sure you have a proper nRF Connect SDK development environment.
Follow the official
[Installation guide](https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/installation/install_ncs.html).

### Initialization

The first step is to initialize the workspace folder (``my-workspace``) where
the ``example-application`` and all Zephyr modules will be cloned. Run the following
command:
This section represents alternative approaches for initializing the workspace.

#### Initialize workspace from scratch

The first step is to initialize the workspace folder (``ncs``) where
the ``ncs-example-application`` and all nRF Connect SDK modules will be cloned.
Run the following commands:

```shell
# Initialize ncs for the ncs-example-application (main branch)
west init -m https://github.com/nrfconnect/ncs-example-application --mr main ncs
# Update nRF Connect SDK modules
cd ncs
west update
```

#### Add application into existing nRF Connect SDK workspace

Assume you have an existing nRF Connect SDK workspace in the ``ncs`` folder. Run the following commands:

```shell
# initialize my-workspace for the example-application (main branch)
west init -m https://github.com/zephyrproject-rtos/example-application --mr main my-workspace
# update Zephyr modules
cd my-workspace
# Navigate to the workspace folder
cd ncs
# Clone application repository
git clone https://github.com/nrfconnect/ncs-example-application
# Set manifest path to the application directory
west config manifest.path ncs-example-application
# Update nRF Connect SDK modules
west update
```

Expand All @@ -79,9 +98,8 @@ west build -b $BOARD app

where `$BOARD` is the target board.

You can use the `custom_plank` board found in this
repository. Note that Zephyr sample boards may be used if an
appropriate overlay is provided (see `app/boards`).
You can use the `custom_plank` board found in this repository. Note that you can use
Zephyr and nRF Connect SDK sample boards if an appropriate overlay is provided (see `app/boards`).

A sample debug configuration is also provided. To apply it, run the following
command:
Expand Down
23 changes: 23 additions & 0 deletions app/boards/nrf54l15dk_nrf54l15_cpuapp.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright (c) 2025 Nordic Semiconductor ASA
* SPDX-License-Identifier: Apache-2.0
*/

/* This devicetree overlay file will be automatically picked by the Zephyr
* build system when building the sample for the nRF54l15 DK (cpuapp) board.
* It shows how the ncs-example-application can be built on sample boards
* already provided by Zephyr or NCS.
*/

/ {
example_sensor: example-sensor {
compatible = "zephyr,example-sensor";
input-gpios = <&gpio1 13 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
};

blink_led: blink-led {
compatible = "blink-gpio-led";
led-gpios = <&gpio2 9 GPIO_ACTIVE_HIGH>;
blink-period-ms = <1000>;
};
};
27 changes: 0 additions & 27 deletions app/boards/nucleo_f302r8.overlay

This file was deleted.

5 changes: 3 additions & 2 deletions app/sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
# so that you can easily test all of them locally or in CI.
sample:
description: Example application
name: example-application
name: example-application
common:
sysbuild: true
build_only: true
integration_platforms:
- custom_plank
- nucleo_f302r8
- nrf54l15dk/nrf54l15/cpuapp
tests:
app.default: {}
app.debug:
Expand Down
Loading