-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update to Golioth Reference Design Template
Update the repository to be based on the Reference Design Template.
- Loading branch information
Showing
48 changed files
with
2,342 additions
and
667 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Copyright (c) 2023 Zephyr Project members and individual contributors | ||
# Copyright (c) 2023 Golioth, Inc. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
--emacs | ||
--summary-file | ||
--show-types | ||
--max-line-length=100 | ||
--min-conf-desc-length=1 | ||
--typedefsfile=../deps/zephyr/scripts/checkpatch/typedefsfile | ||
|
||
--ignore BRACES | ||
--ignore PRINTK_WITHOUT_KERN_LEVEL | ||
--ignore SPLIT_STRING | ||
--ignore VOLATILE | ||
--ignore CONFIG_EXPERIMENTAL | ||
--ignore PREFER_KERNEL_TYPES | ||
--ignore PREFER_SECTION | ||
--ignore AVOID_EXTERNS | ||
--ignore NETWORKING_BLOCK_COMMENT_STYLE | ||
--ignore DATE_TIME | ||
--ignore MINMAX | ||
--ignore CONST_STRUCT | ||
--ignore FILE_PATH_CHANGES | ||
--ignore SPDX_LICENSE_TAG | ||
--ignore C99_COMMENT_TOLERANCE | ||
--ignore REPEATED_WORD | ||
--ignore UNDOCUMENTED_DT_STRING | ||
--ignore DT_SPLIT_BINDING_PATCH | ||
--ignore DT_SCHEMA_BINDING_PATCH | ||
--ignore TRAILING_SEMICOLON | ||
--ignore COMPLEX_MACRO | ||
--ignore MULTISTATEMENT_MACRO_USE_DO_WHILE | ||
--ignore ENOSYS | ||
|
||
--no-tree | ||
--exclude patches |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
# Copyright (c) 2023 Zephyr Project members and individual contributors | ||
# Copyright (c) 2023 Golioth, Inc. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# Copied from Zephyr: https://github.com/zephyrproject-rtos/zephyr/blob/main/.clang-format | ||
|
||
# Note: The list of ForEachMacros can be obtained using: | ||
# | ||
# git grep -h '^#define [^[:space:]]*FOR_EACH[^[:space:]]*(' include/ \ | ||
# | sed "s,^#define \([^[:space:]]*FOR_EACH[^[:space:]]*\)(.*$, - '\1'," \ | ||
# | sort | uniq | ||
# | ||
# References: | ||
# - https://clang.llvm.org/docs/ClangFormatStyleOptions.html | ||
|
||
--- | ||
BasedOnStyle: LLVM | ||
AlignConsecutiveMacros: AcrossComments | ||
AllowShortBlocksOnASingleLine: false | ||
AllowShortCaseLabelsOnASingleLine: false | ||
AllowShortEnumsOnASingleLine: false | ||
AllowShortFunctionsOnASingleLine: None | ||
AllowShortIfStatementsOnASingleLine: false | ||
AllowShortLoopsOnASingleLine: false | ||
AttributeMacros: | ||
- __aligned | ||
- __deprecated | ||
- __packed | ||
- __printf_like | ||
- __syscall | ||
- __subsystem | ||
BitFieldColonSpacing: After | ||
BreakBeforeBraces: Linux | ||
ColumnLimit: 100 | ||
ConstructorInitializerIndentWidth: 8 | ||
ContinuationIndentWidth: 8 | ||
ForEachMacros: | ||
- 'FOR_EACH' | ||
- 'FOR_EACH_FIXED_ARG' | ||
- 'FOR_EACH_IDX' | ||
- 'FOR_EACH_IDX_FIXED_ARG' | ||
- 'FOR_EACH_NONEMPTY_TERM' | ||
- 'RB_FOR_EACH' | ||
- 'RB_FOR_EACH_CONTAINER' | ||
- 'SYS_DLIST_FOR_EACH_CONTAINER' | ||
- 'SYS_DLIST_FOR_EACH_CONTAINER_SAFE' | ||
- 'SYS_DLIST_FOR_EACH_NODE' | ||
- 'SYS_DLIST_FOR_EACH_NODE_SAFE' | ||
- 'SYS_SFLIST_FOR_EACH_CONTAINER' | ||
- 'SYS_SFLIST_FOR_EACH_CONTAINER_SAFE' | ||
- 'SYS_SFLIST_FOR_EACH_NODE' | ||
- 'SYS_SFLIST_FOR_EACH_NODE_SAFE' | ||
- 'SYS_SLIST_FOR_EACH_CONTAINER' | ||
- 'SYS_SLIST_FOR_EACH_CONTAINER_SAFE' | ||
- 'SYS_SLIST_FOR_EACH_NODE' | ||
- 'SYS_SLIST_FOR_EACH_NODE_SAFE' | ||
- '_WAIT_Q_FOR_EACH' | ||
- 'Z_FOR_EACH' | ||
- 'Z_FOR_EACH_ENGINE' | ||
- 'Z_FOR_EACH_EXEC' | ||
- 'Z_FOR_EACH_FIXED_ARG' | ||
- 'Z_FOR_EACH_FIXED_ARG_EXEC' | ||
- 'Z_FOR_EACH_IDX' | ||
- 'Z_FOR_EACH_IDX_EXEC' | ||
- 'Z_FOR_EACH_IDX_FIXED_ARG' | ||
- 'Z_FOR_EACH_IDX_FIXED_ARG_EXEC' | ||
- 'Z_GENLIST_FOR_EACH_CONTAINER' | ||
- 'Z_GENLIST_FOR_EACH_CONTAINER_SAFE' | ||
- 'Z_GENLIST_FOR_EACH_NODE' | ||
- 'Z_GENLIST_FOR_EACH_NODE_SAFE' | ||
# Disabled for now, see bug https://github.com/zephyrproject-rtos/zephyr/issues/48520 | ||
#IncludeBlocks: Regroup | ||
IncludeCategories: | ||
- Regex: '^".*\.h"$' | ||
Priority: 0 | ||
- Regex: '^<(assert|complex|ctype|errno|fenv|float|inttypes|limits|locale|math|setjmp|signal|stdarg|stdbool|stddef|stdint|stdio|stdlib|string|tgmath|time|wchar|wctype)\.h>$' | ||
Priority: 1 | ||
- Regex: '^\<zephyr/.*\.h\>$' | ||
Priority: 2 | ||
- Regex: '.*' | ||
Priority: 3 | ||
IndentCaseLabels: false | ||
IndentWidth: 8 | ||
# SpaceBeforeParens: ControlStatementsExceptControlMacros # clang-format >= 13.0 | ||
SortIncludes: false | ||
UseTab: Always | ||
WhitespaceSensitiveMacros: | ||
- STRINGIFY | ||
- Z_STRINGIFY | ||
- IF_ENABLED |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
# Copyright (c) 2023 Zephyr Project members and individual contributors | ||
# Copyright (c) 2023 Golioth, Inc. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# Copied from Zephyr: https://github.com/zephyrproject-rtos/zephyr/blob/main/.editorconfig | ||
|
||
# EditorConfig: https://editorconfig.org/ | ||
|
||
# top-most EditorConfig file | ||
root = true | ||
|
||
# All (Defaults) | ||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
max_line_length = 100 | ||
|
||
# Assembly | ||
[*.S] | ||
indent_style = tab | ||
indent_size = 8 | ||
|
||
# C | ||
[*.{c,h}] | ||
indent_style = tab | ||
indent_size = 8 | ||
|
||
# C++ | ||
[*.{cpp,hpp}] | ||
indent_style = tab | ||
indent_size = 8 | ||
|
||
# Linker Script | ||
[*.ld] | ||
indent_style = tab | ||
indent_size = 8 | ||
|
||
# Python | ||
[*.py] | ||
indent_style = space | ||
indent_size = 4 | ||
|
||
# Perl | ||
[*.pl] | ||
indent_style = tab | ||
indent_size = 8 | ||
|
||
# reStructuredText | ||
[*.rst] | ||
indent_style = space | ||
indent_size = 3 | ||
|
||
# YAML | ||
[*.{yml,yaml}] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
# Shell Script | ||
[*.sh] | ||
indent_style = space | ||
indent_size = 4 | ||
|
||
# Windows Command Script | ||
[*.cmd] | ||
end_of_line = crlf | ||
indent_style = tab | ||
indent_size = 8 | ||
|
||
# Valgrind Suppression File | ||
[*.supp] | ||
indent_style = space | ||
indent_size = 3 | ||
|
||
# CMake | ||
[{CMakeLists.txt,*.cmake}] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
# Makefile | ||
[Makefile] | ||
indent_style = tab | ||
indent_size = 8 | ||
|
||
# Device tree | ||
[*.{dts,dtsi,overlay}] | ||
indent_style = tab | ||
indent_size = 8 | ||
|
||
# Git commit messages | ||
[COMMIT_EDITMSG] | ||
max_line_length = 75 | ||
|
||
# Kconfig | ||
[Kconfig*] | ||
indent_style = tab | ||
indent_size = 8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
# Copyright (c) 2023 Golioth, Inc. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
name: Build Zephyr binaries | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
ZEPHYR_SDK: | ||
required: true | ||
type: string | ||
default: 0.16.3 | ||
BOARD: | ||
required: true | ||
type: string | ||
default: nrf52840dk_nrf52840 | ||
ARTIFACT: | ||
required: true | ||
type: boolean | ||
default: false | ||
TAG: | ||
type: string | ||
|
||
workflow_call: | ||
inputs: | ||
ZEPHYR_SDK: | ||
required: true | ||
type: string | ||
BOARD: | ||
required: true | ||
type: string | ||
ARTIFACT: | ||
required: true | ||
type: boolean | ||
TAG: | ||
type: string | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
container: golioth/golioth-zephyr-base:${{ inputs.ZEPHYR_SDK }}-SDK-v0 | ||
|
||
env: | ||
ZEPHYR_SDK_INSTALL_DIR: /opt/toolchains/zephyr-sdk-${{ inputs.ZEPHYR_SDK }} | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
path: app | ||
- name: Setup West workspace | ||
run: | | ||
west init -l app | ||
west update --narrow -o=--depth=1 | ||
west zephyr-export | ||
pip3 install -r deps/zephyr/scripts/requirements-base.txt | ||
# Needed for TF-M | ||
pip3 install cryptography pyasn1 pyyaml cbor>=1.0.0 imgtool>=1.9.0 jinja2 click | ||
- name: Build with West | ||
run: | | ||
west build -p -b ${{ inputs.BOARD }} app | ||
- name: Prepare artifacts | ||
if: inputs.ARTIFACT == true && inputs.TAG != '' | ||
|
||
run: | | ||
cd build/zephyr | ||
mkdir -p artifacts | ||
mv merged.hex ./artifacts/golioth-${{ github.event.repository.name }}_${{ inputs.TAG }}_${{ inputs.BOARD }}_full.hex | ||
mv app_update.bin ./artifacts/golioth-${{ github.event.repository.name }}_${{ inputs.TAG }}_${{ inputs.BOARD }}_update.bin | ||
mv zephyr.elf ./artifacts/golioth-${{ github.event.repository.name }}_${{ inputs.TAG }}_${{ inputs.BOARD }}.elf | ||
# Run IDs are unique per repo but are reused on re-runs | ||
- name: Save artifact | ||
if: inputs.ARTIFACT == true | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: build_artifacts_${{ github.run_id }} | ||
path: | | ||
build/zephyr/artifacts/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Copyright (c) 2023 Golioth, Inc. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
name: Create Release | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: 'Release Version.' | ||
required: true | ||
default: 'v0.0.0' | ||
type: string | ||
|
||
jobs: | ||
build-binaries: | ||
strategy: | ||
matrix: | ||
ZEPHYR_SDK: [0.16.3] | ||
BOARD: ["nrf52840dk_nrf52840","adafruit_feather_nrf52840"] | ||
|
||
uses: ./.github/workflows/build_zephyr.yml | ||
with: | ||
ZEPHYR_SDK: ${{ matrix.ZEPHYR_SDK }} | ||
BOARD: ${{ matrix.BOARD }} | ||
ARTIFACT: true | ||
TAG: ${{ inputs.version }} | ||
|
||
upload-binaries: | ||
needs: build-binaries | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Download artifact | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: build_artifacts_${{ github.run_id }} | ||
path: ~/artifacts | ||
|
||
- name: Create Release manually with GH CLI | ||
run: gh release create --title ${{ inputs.version }} --draft ${{ inputs.version }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Upload artifacts to release | ||
run: gh release upload --clobber ${{ inputs.version }} ~/artifacts/*.* | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Copyright (c) 2023 Golioth, Inc. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
name: Test firmware | ||
|
||
on: | ||
pull_request: | ||
|
||
push: | ||
|
||
jobs: | ||
test_build: | ||
uses: ./.github/workflows/build_zephyr.yml | ||
with: | ||
ZEPHYR_SDK: 0.16.3 | ||
BOARD: nrf52840dk_nrf52840 | ||
ARTIFACT: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
deps/ | ||
build/ | ||
.vscode/ | ||
# Copyright (c) 2023 Golioth, Inc. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
build*/ | ||
.vscode | ||
.cache | ||
credentials.conf | ||
__pycache__/ |
Oops, something went wrong.