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
69 changes: 69 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: SemVer Release & Build

on:
pull_request:
types: [opened, synchronize, closed]
branches: main

jobs:
version:
outputs:
next: ${{steps.semver.outputs.next}}
nextStrict: ${{steps.semver.outputs.nextStrict}}

runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Get Next Version
id: semver
uses: ietf-tools/semver-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: main

build:
runs-on: ubuntu-22.04
container: ghcr.io/zephyrproject-rtos/ci:v0.26.2
env:
CMAKE_PREFIX_PATH: /opt/toolchains
steps:
- name: Checkout
uses: actions/checkout@v3
with:
path: example-application

- name: Initialize
working-directory: example-application
run: |
west init -l .
west update

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

- name: Twister Tests
working-directory: example-application
run: |
west twister -T tests --integration

release:
runs-on: ubuntu-latest
needs: [version,build]
steps:
- name: Create Release
uses: ncipollo/release-action@v1.12.0
with:
allowUpdates: true
draft: false
makeLatest: true
generateReleaseNotes: true
name: ${{ needs.version.outputs.next }}
body: Changelog Contents
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "README.md,LICENSE,app/build/zephyr/${{ github.repository }}-${{ needs.version.outputs.nextStrict }}.uf2"
commit: ${{ github.sha }}
tag: ${{ needs.version.outputs.next }}
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# editors
.vscode
*.swp
*~

# python
.venv

# build
/build*
/twister-out*

__pycache__/
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright (c) 2021 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
#
# This CMake file is picked by the Zephyr build system because it is defined
# as the module CMake entry point (see zephyr/module.yml).

zephyr_include_directories(include)

add_subdirectory(drivers)
add_subdirectory(lib)
9 changes: 9 additions & 0 deletions Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) 2021 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
#
# This Kconfig file is picked by the Zephyr build system because it is defined
# as the module Kconfig entry point (see zephyr/module.yml). You can browse
# module options by going to Zephyr -> Modules in Kconfig.

rsource "drivers/Kconfig"
rsource "lib/Kconfig"
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# example-application
Example out-of-tree application that is also a module
# Zephyr Template App

Template app with SemVer and Release workflows for GitHub Actions along with the Zephyr build action
12 changes: 12 additions & 0 deletions app/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#-------------------------------------------------------------------------------
# Zephyr Example Application
#
# Copyright (c) 2021 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.13.1)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})

project(app LANGUAGES C)

target_sources(app PRIVATE src/main.c)
15 changes: 15 additions & 0 deletions app/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright (c) 2021 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
#
# This file is the application Kconfig entry point. All application Kconfig
# options can be defined here or included via other application Kconfig files.
# You can browse these options using the west targets menuconfig (terminal) or
# guiconfig (GUI).

menu "Zephyr"
source "Kconfig.zephyr"
endmenu

module = APP
module-str = APP
source "subsys/logging/Kconfig.template.log_config"
5 changes: 5 additions & 0 deletions app/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
VERSION_MAJOR = 1
VERSION_MINOR = 0
PATCHLEVEL = 0
VERSION_TWEAK = 0
EXTRAVERSION =
21 changes: 21 additions & 0 deletions app/boards/nucleo_f302r8.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright (c) 2021 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 nucleo_f302r8 board. It shows
* how the example-application can be built on sample boards already provided
* by Zephyr.
*/

/ {
examplesensor0: examplesensor_0 {
compatible = "zephyr,examplesensor";
input-gpios = <&gpioc 13 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
};
};

&gpioc {
status = "okay";
};
19 changes: 19 additions & 0 deletions app/debug.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright (c) 2021 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
#
# This is a Kconfig fragment which can be used to enable debug-related options
# in the application. See the README for more details.

# compiler
CONFIG_DEBUG_OPTIMIZATIONS=y

# console
CONFIG_CONSOLE=y

# UART console
CONFIG_SERIAL=y
CONFIG_UART_CONSOLE=y

# logging
CONFIG_LOG=y
CONFIG_APP_LOG_LEVEL_DBG=y
6 changes: 6 additions & 0 deletions app/prj.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Copyright (c) 2021 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
#
# This file contains selected Kconfig options for the application.

CONFIG_SENSOR=y
16 changes: 16 additions & 0 deletions app/sample.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# This file is provided so that the application can be compiled using Twister,
# the Zephyr testing tool. In this file, multiple combinations can be specified,
# so that you can easily test all of them locally or in CI.
sample:
description: Example application
name: example-application
common:
build_only: true
integration_platforms:
- custom_plank
- nucleo_f302r8
tests:
app.default: {}
app.debug:
extra_overlay_confs:
- debug.conf
48 changes: 48 additions & 0 deletions app/src/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* Copyright (c) 2021 Nordic Semiconductor ASA
* SPDX-License-Identifier: Apache-2.0
*/

#include <zephyr/kernel.h>
#include <zephyr/drivers/sensor.h>
#include <app_version.h>

#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(main, CONFIG_APP_LOG_LEVEL);

int main(void)
{
int ret;
const struct device *sensor;

printk("Zephyr Example Application %s\n", APP_VERSION_STRING);

sensor = DEVICE_DT_GET(DT_NODELABEL(examplesensor0));
if (!device_is_ready(sensor)) {
LOG_ERR("Sensor not ready");
return 0;
}

while (1) {
struct sensor_value val;

ret = sensor_sample_fetch(sensor);
if (ret < 0) {
LOG_ERR("Could not fetch sample (%d)", ret);
return 0;
}

ret = sensor_channel_get(sensor, SENSOR_CHAN_PROX, &val);
if (ret < 0) {
LOG_ERR("Could not get sample (%d)", ret);
return 0;
}

printk("Sensor value: %d\n", val.val1);

k_sleep(K_MSEC(1000));
}

return 0;
}

8 changes: 8 additions & 0 deletions boards/arm/custom_plank/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright (c) 2021 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0

config BOARD_ENABLE_DCDC
bool "Enable DCDC mode"
select SOC_DCDC_NRF52X
default y
depends on BOARD_CUSTOM_PLANK
6 changes: 6 additions & 0 deletions boards/arm/custom_plank/Kconfig.board
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Copyright (c) 2021 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0

config BOARD_CUSTOM_PLANK
bool "Custom Plank Board"
depends on SOC_NRF52840_QIAA
9 changes: 9 additions & 0 deletions boards/arm/custom_plank/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) 2021 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0

if BOARD_CUSTOM_PLANK

config BOARD
default "custom_plank"

endif # BOARD_CUSTOM_PLANK
6 changes: 6 additions & 0 deletions boards/arm/custom_plank/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Custom Plank Board

`custom_plank` board is used to demonstrate how to create custom boards. It is
in fact a simplified version of the nRF52840-DK board, so the
`example-application` can be run on that development kit when using
`custom_plank`.
12 changes: 12 additions & 0 deletions boards/arm/custom_plank/board.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright (c) 2021 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0

board_runner_args(jlink "--device=nrf52" "--speed=4000")
board_runner_args(pyocd "--target=nrf52840" "--frequency=4000000")

set(OPENOCD_NRF5_SUBFAMILY "nrf52")

include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake)
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake)
include(${ZEPHYR_BASE}/boards/common/openocd-nrf5.board.cmake)
26 changes: 26 additions & 0 deletions boards/arm/custom_plank/custom_plank-pinctrl.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright (c) 2022 Nordic Semiconductor ASA
* SPDX-License-Identifier: Apache-2.0
*/

&pinctrl {
uart0_default: uart0_default {
group1 {
psels = <NRF_PSEL(UART_TX, 0, 6)>,
<NRF_PSEL(UART_RX, 0, 8)>,
<NRF_PSEL(UART_RTS, 0, 5)>,
<NRF_PSEL(UART_CTS, 0, 7)>;
};
};

uart0_sleep: uart0_sleep {
group1 {
psels = <NRF_PSEL(UART_TX, 0, 6)>,
<NRF_PSEL(UART_RX, 0, 8)>,
<NRF_PSEL(UART_RTS, 0, 5)>,
<NRF_PSEL(UART_CTS, 0, 7)>;
low-power-enable;
};
};

};
38 changes: 38 additions & 0 deletions boards/arm/custom_plank/custom_plank.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright (c) 2021 Nordic Semiconductor ASA
* SPDX-License-Identifier: Apache-2.0
*/

/dts-v1/;
#include <nordic/nrf52840_qiaa.dtsi>
#include "custom_plank-pinctrl.dtsi"

/ {
model = "Custom Plank Board";
compatible = "vendor,custom-plank";

chosen {
zephyr,console = &uart0;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
};

examplesensor0: examplesensor_0 {
compatible = "zephyr,examplesensor";
input-gpios = <&gpio0 11 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
};
};

&gpio0 {
status = "okay";
};

&uart0 {
compatible = "nordic,nrf-uarte";
status = "okay";

current-speed = <115200>;
pinctrl-0 = <&uart0_default>;
pinctrl-1 = <&uart0_sleep>;
pinctrl-names = "default", "sleep";
};
15 changes: 15 additions & 0 deletions boards/arm/custom_plank/custom_plank.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright (c) 2021 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0

identifier: custom_plank
name: Custom-Plank
type: mcu
arch: arm
ram: 256
flash: 1024
toolchain:
- zephyr
- gnuarmemb
- xtools
supported:
- gpio
Loading