Skip to content

Commit 53fe0ef

Browse files
committed
[nrf noup] treewide: Adapt to NCS
Adapt original Zephyr repo to NCS, including the manifest, CI and the doc. Use the nrf54l15dk/nrf54l15/cpuapp target instead of nucleo_f302r8 as the integration platform. Signed-off-by: Carles Cufi <[email protected]> Signed-off-by: Markus Tacker <[email protected]> Signed-off-by: Pekka Niskanen <[email protected]> Signed-off-by: Jamie McCrae <[email protected]> Signed-off-by: Vinayak Kariappa Chettimada <[email protected]> Signed-off-by: Gerard Marull-Paretas <[email protected]> Signed-off-by: Jakub Ciesla <[email protected]>
1 parent 06bbb0a commit 53fe0ef

15 files changed

+231
-141
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Build and test app in NCS docker container
2+
3+
on:
4+
pull_request:
5+
push:
6+
7+
jobs:
8+
set-image-tag:
9+
runs-on: ubuntu-24.04
10+
outputs:
11+
IMAGE_TAG: ${{ steps.set-output.outputs.IMAGE_TAG }}
12+
steps:
13+
- name: Checkout repository with example application
14+
uses: actions/checkout@v4
15+
with:
16+
path: example-application
17+
18+
- name: Prepare west project
19+
run: |
20+
python3 -m pip install west
21+
west init -l example-application
22+
west update -o=--depth=1 -n nrf
23+
24+
- name: Find toolchain bundle id
25+
id: set-output
26+
run: echo "IMAGE_TAG=$(./nrf/scripts/print_toolchain_checksum.sh)" >> $GITHUB_OUTPUT
27+
28+
build-and-test-in-docker:
29+
needs: set-image-tag
30+
runs-on: ubuntu-24.04
31+
container: ghcr.io/nrfconnect/sdk-nrf-toolchain:${{ needs.set-image-tag.outputs.IMAGE_TAG }}
32+
defaults:
33+
run:
34+
# Bash shell is needed to set toolchain related environment variables in docker container
35+
# It is a workaround for GitHub Actions limitation https://github.com/actions/runner/issues/1964
36+
shell: bash
37+
steps:
38+
- name: Checkout repository with example application
39+
uses: actions/checkout@v4
40+
with:
41+
path: example-application
42+
43+
- name: Prepare west project
44+
run: |
45+
west init -l example-application
46+
west update -o=--depth=1 -n
47+
48+
- name: Build firmware
49+
working-directory: example-application
50+
run: |
51+
west twister -T app -v --inline-logs --integration
52+
53+
- name: Store hex files
54+
uses: actions/upload-artifact@v4
55+
with:
56+
name: built-applications
57+
path: example-application/twister-out/**/zephyr/zephyr.hex
58+
59+
- name: Twister Tests
60+
working-directory: example-application
61+
run: |
62+
west twister -T tests -v --inline-logs --integration
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Build and test app in toolchain bundle environment
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
build-and-test-in-toolchain-bundle:
8+
runs-on: ubuntu-24.04
9+
steps:
10+
- name: Checkout repository with example application
11+
uses: actions/checkout@v4
12+
with:
13+
path: example-application
14+
15+
- name: Prepare west project
16+
run: |
17+
python3 -m pip install west
18+
west init -l example-application
19+
west update -o=--depth=1 -n
20+
21+
- name: Install nrfutil and toolchain manager
22+
run: |
23+
wget -q https://files.nordicsemi.com/artifactory/swtools/external/nrfutil/executables/x86_64-unknown-linux-gnu/nrfutil
24+
chmod +x nrfutil
25+
./nrfutil install toolchain-manager
26+
27+
- name: Find proper toolchain bundle
28+
id: set-tb-id
29+
run: echo "TOOLCHAIN_BUNDLE_NAME=ncs-toolchain-x86_64-linux-$(./nrf/scripts/print_toolchain_checksum.sh).tar.gz" >> $GITHUB_OUTPUT
30+
31+
- name: Restore toolchain bundle from cache
32+
id: restore-cached-tb
33+
uses: actions/cache/restore@v4
34+
with:
35+
path: ${{steps.set-tb-id.outputs.TOOLCHAIN_BUNDLE_NAME}}
36+
key: ${{steps.set-tb-id.outputs.TOOLCHAIN_BUNDLE_NAME}}
37+
38+
- name: Download toolchain bundle if not cached
39+
if: steps.restore-cached-tb.outputs.cache-hit != 'true'
40+
run: wget https://files.nordicsemi.com/artifactory/NCS/external/bundles/v3/${{steps.set-tb-id.outputs.TOOLCHAIN_BUNDLE_NAME}}
41+
42+
- name: Save toolchain bundle to cache
43+
if: steps.restore-cached-tb.outputs.cache-hit != 'true'
44+
uses: actions/cache/save@v4
45+
with:
46+
path: ${{steps.set-tb-id.outputs.TOOLCHAIN_BUNDLE_NAME}}
47+
key: ${{steps.set-tb-id.outputs.TOOLCHAIN_BUNDLE_NAME}}
48+
49+
- name: Install proper toolchain bundle
50+
run: ./nrfutil toolchain-manager install --toolchain-bundle ${{steps.set-tb-id.outputs.TOOLCHAIN_BUNDLE_NAME}}
51+
52+
- name: Build firmware
53+
run: |
54+
./nrfutil toolchain-manager launch --chdir example-application -- west twister -T app -v --inline-logs --integration
55+
56+
- name: Store hex files
57+
uses: actions/upload-artifact@v4
58+
with:
59+
name: built-applications
60+
path: example-application/twister-out/**/zephyr/zephyr.hex

.github/workflows/build.yml

Lines changed: 0 additions & 49 deletions
This file was deleted.

.github/workflows/src-mirror.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: src-mirror
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
git-ref:
7+
description: 'Branch, tag or SHA to checkout'
8+
required: true
9+
default: 'main'
10+
push:
11+
tags:
12+
- '*'
13+
pull_request:
14+
types:
15+
- opened
16+
- synchronize
17+
paths:
18+
- .github/workflows/src-mirror.yml
19+
20+
concurrency:
21+
group: src-mirror-${{ github.ref }}
22+
cancel-in-progress: true
23+
24+
# Tar entire project west workspace, prune, and upload to artifact service.
25+
jobs:
26+
standard:
27+
runs-on:
28+
- runs-on=${{ github.run_id }}
29+
- runner=16cpu-linux-x64
30+
steps:
31+
- name: Upload src.tar.gz
32+
uses: nrfconnect/action-src-mirror@main
33+
with:
34+
path: 'ncs-example-application'
35+
west-update-args: ''
36+
artifactory-path: >-
37+
${{ (github.ref_type != 'tag') &&
38+
format('ncs-src-mirror/internal/{0}/{1}/src.tar.gz', github.event.repository.name, github.ref_name) ||
39+
format('ncs-src-mirror/external/{0}/{1}/src.tar.gz', github.event.repository.name, github.ref_name) }}
40+
artifactory-user: ${{ secrets.COM_NORDICSEMI_FILES_USERNAME }}
41+
artifactory-pass: ${{ secrets.COM_NORDICSEMI_FILES_PASSWORD }}

CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @gmarull @carlescufi

README.md

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
# Zephyr Example Application
1+
# nRF Connect SDK example application
22

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

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

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

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

4040
[app_dev]: https://docs.zephyrproject.org/latest/develop/application/index.html
4141
[workspace_app]: https://docs.zephyrproject.org/latest/develop/application/index.html#zephyr-workspace-app
@@ -44,26 +44,26 @@ points to the development branch of Zephyr, also `main`.
4444
[board_porting]: https://docs.zephyrproject.org/latest/guides/porting/board_porting.html
4545
[bindings]: https://docs.zephyrproject.org/latest/guides/dts/bindings.html
4646
[drivers]: https://docs.zephyrproject.org/latest/reference/drivers/index.html
47-
[zephyr]: https://github.com/zephyrproject-rtos/zephyr
47+
[sdk-nrf]: https://github.com/nrfconnect/sdk-nrf
4848
[west_ext]: https://docs.zephyrproject.org/latest/develop/west/extensions.html
4949
[runner_ext]: https://docs.zephyrproject.org/latest/develop/modules.html#external-runners
5050

51-
## Getting Started
51+
## Getting started
5252

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

5757
### Initialization
5858

5959
The first step is to initialize the workspace folder (``my-workspace``) where
60-
the ``example-application`` and all Zephyr modules will be cloned. Run the following
60+
the ``ncs-example-application`` and all nRF Connect SDK modules will be cloned. Run the following
6161
command:
6262

6363
```shell
64-
# initialize my-workspace for the example-application (main branch)
65-
west init -m https://github.com/zephyrproject-rtos/example-application --mr main my-workspace
66-
# update Zephyr modules
64+
# initialize my-workspace for the ncs-example-application (main branch)
65+
west init -m https://github.com/nrfconnect/ncs-example-application --mr main my-workspace
66+
# update nRF Connect SDK modules
6767
cd my-workspace
6868
west update
6969
```
@@ -79,9 +79,8 @@ west build -b $BOARD app
7979

8080
where `$BOARD` is the target board.
8181

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

8685
A sample debug configuration is also provided. To apply it, run the following
8786
command:
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* Copyright (c) 2025 Nordic Semiconductor ASA
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
/* This devicetree overlay file will be automatically picked by the Zephyr
7+
* build system when building the sample for the nRF54l15 DK (cpuapp) board.
8+
* It shows how the ncs-example-application can be built on sample boards
9+
* already provided by Zephyr or NCS.
10+
*/
11+
12+
/ {
13+
example_sensor: example-sensor {
14+
compatible = "zephyr,example-sensor";
15+
input-gpios = <&gpio1 13 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
16+
};
17+
18+
blink_led: blink-led {
19+
compatible = "blink-gpio-led";
20+
led-gpios = <&gpio2 9 GPIO_ACTIVE_HIGH>;
21+
blink-period-ms = <1000>;
22+
};
23+
};

app/boards/nucleo_f302r8.overlay

Lines changed: 0 additions & 27 deletions
This file was deleted.

app/sample.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
# so that you can easily test all of them locally or in CI.
44
sample:
55
description: Example application
6-
name: example-application
6+
name: example-application
77
common:
8+
sysbuild: true
89
build_only: true
910
integration_platforms:
1011
- custom_plank
11-
- nucleo_f302r8
12+
- nrf54l15dk/nrf54l15/cpuapp
1213
tests:
1314
app.default: {}
1415
app.debug:

0 commit comments

Comments
 (0)