From 4d6aeb51f4d8e855c33d24e78ef6144c87f20144 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20H=C3=BCbner?= Date: Wed, 28 Dec 2022 19:58:05 +0100 Subject: [PATCH] Initial commit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pavel Hübner --- .clang-format | 82 ++++++++++++++++++++++++++++ .editorconfig | 92 ++++++++++++++++++++++++++++++++ .gitignore | 2 + CMakeLists.txt | 5 ++ Kconfig | 3 ++ README.md | 88 ++++++++++++++++++++++++++++++ application/CMakeLists.txt | 6 +++ application/app.overlay | 0 application/prj.conf | 3 ++ application/src/main.c | 9 ++++ drivers/CMakeLists.txt | 0 drivers/Kconfig | 3 ++ dts/bindings/vendor-prefixes.txt | 0 include/drivers/.gitkeep | 0 lib/CMakeLists.txt | 0 lib/Kconfig | 3 ++ subsys/CMakeLists.txt | 0 subsys/Kconfig | 3 ++ west.yml | 13 +++++ zephyr/module.yml | 5 ++ 20 files changed, 317 insertions(+) create mode 100644 .clang-format create mode 100644 .editorconfig create mode 100644 .gitignore create mode 100644 CMakeLists.txt create mode 100644 Kconfig create mode 100644 README.md create mode 100644 application/CMakeLists.txt create mode 100644 application/app.overlay create mode 100644 application/prj.conf create mode 100644 application/src/main.c create mode 100644 drivers/CMakeLists.txt create mode 100644 drivers/Kconfig create mode 100644 dts/bindings/vendor-prefixes.txt create mode 100644 include/drivers/.gitkeep create mode 100644 lib/CMakeLists.txt create mode 100644 lib/Kconfig create mode 100644 subsys/CMakeLists.txt create mode 100644 subsys/Kconfig create mode 100644 west.yml create mode 100644 zephyr/module.yml diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..ddcb517 --- /dev/null +++ b/.clang-format @@ -0,0 +1,82 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# 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 +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' +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: '^\$' + Priority: 2 + - Regex: '.*' + Priority: 3 +IndentCaseLabels: false +IndentWidth: 8 +# SpaceBeforeParens: ControlStatementsExceptControlMacros # clang-format >= 13.0 +UseTab: Always +WhitespaceSensitiveMacros: + - STRINGIFY + - Z_STRINGIFY diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..988cb95 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,92 @@ +# 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 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ed86553 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.DS_Store +build/ diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..f486e07 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,5 @@ +add_subdirectory(drivers) +add_subdirectory(lib) +add_subdirectory(subsys) + +zephyr_include_directories(include) diff --git a/Kconfig b/Kconfig new file mode 100644 index 0000000..0fad028 --- /dev/null +++ b/Kconfig @@ -0,0 +1,3 @@ +rsource "drivers/Kconfig" +rsource "lib/Kconfig" +rsource "subsys/Kconfig" diff --git a/README.md b/README.md new file mode 100644 index 0000000..994c8c6 --- /dev/null +++ b/README.md @@ -0,0 +1,88 @@ +# CHESTER Application: skeleton + +Create a directory for the **West** workspace and switch into it: + +``` +mkdir skeleton && cd skeleton +``` + +> Note: The word `skeleton` in the title and command above should be replaced with your workspace name (and preferrably match a path/name of your **Git** repository). If you only have one application in the workspace, the name should contain the application name. Once done, do not forget to delete this note to avoid any future confusion. + +Create **Python** virtual environment in the workspace: + +``` +python3 -m venv venv +``` + +> Note: If the command `python3` cannot be found on your system, use `python` instead. + +Activate the **Python** virtual environment: + +``` +source venv/bin/activate +``` + +> Note: This command should be `venv\Scripts\Activate.ps1` in **Windows Powershell**. Also, in case of the **Fish** shell, it is important to run the command as `source venv/bin/activate.fish`. + +Upgrade the **Python** package installer: + +``` +pip install --upgrade pip +``` + +Install the **West** tool: + +``` +pip install west +``` + +Initialize the **West** workspace: + +``` +west init -m git@gitlab.hardwario.com:chester/skeleton.git --manifest-rev main +``` + +Synchronize the **West** workspace: + +``` +west update +``` + +Configure the default board: + +``` +west config build.board chester_nrf52840 +``` + +Install the required **Python** packages: + +``` +pip install -r zephyr/scripts/requirements.txt +pip install -r nrf/scripts/requirements.txt +pip install -r bootloader/mcuboot/scripts/requirements.txt +pip install -r chester/scripts/requirements.txt +``` + +Go to the application directory: + +``` +cd vendor/application +``` + +Build the application: + +``` +west build +``` + +Flash the application: + +``` +west flash +``` + +Debug the application: + +``` +west debug +``` diff --git a/application/CMakeLists.txt b/application/CMakeLists.txt new file mode 100644 index 0000000..fe4b226 --- /dev/null +++ b/application/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.20.0) + +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(skeleton) + +target_sources(app PRIVATE src/main.c) diff --git a/application/app.overlay b/application/app.overlay new file mode 100644 index 0000000..e69de29 diff --git a/application/prj.conf b/application/prj.conf new file mode 100644 index 0000000..031fd8b --- /dev/null +++ b/application/prj.conf @@ -0,0 +1,3 @@ +CONFIG_CTR_DEFAULTS=y +CONFIG_CTR_LOG=y +CONFIG_CTR_SHELL=y diff --git a/application/src/main.c b/application/src/main.c new file mode 100644 index 0000000..f0fa209 --- /dev/null +++ b/application/src/main.c @@ -0,0 +1,9 @@ +#include +#include + +LOG_MODULE_REGISTER(main, LOG_LEVEL_DBG); + +void main(void) +{ + LOG_INF("Build time: " __DATE__ " " __TIME__); +} diff --git a/drivers/CMakeLists.txt b/drivers/CMakeLists.txt new file mode 100644 index 0000000..e69de29 diff --git a/drivers/Kconfig b/drivers/Kconfig new file mode 100644 index 0000000..432db2e --- /dev/null +++ b/drivers/Kconfig @@ -0,0 +1,3 @@ +menu "Drivers" + +endmenu diff --git a/dts/bindings/vendor-prefixes.txt b/dts/bindings/vendor-prefixes.txt new file mode 100644 index 0000000..e69de29 diff --git a/include/drivers/.gitkeep b/include/drivers/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt new file mode 100644 index 0000000..e69de29 diff --git a/lib/Kconfig b/lib/Kconfig new file mode 100644 index 0000000..5aea370 --- /dev/null +++ b/lib/Kconfig @@ -0,0 +1,3 @@ +menu "Libraries" + +endmenu diff --git a/subsys/CMakeLists.txt b/subsys/CMakeLists.txt new file mode 100644 index 0000000..e69de29 diff --git a/subsys/Kconfig b/subsys/Kconfig new file mode 100644 index 0000000..fa883b1 --- /dev/null +++ b/subsys/Kconfig @@ -0,0 +1,3 @@ +menu "Subsystems" + +endmenu diff --git a/west.yml b/west.yml new file mode 100644 index 0000000..626cafa --- /dev/null +++ b/west.yml @@ -0,0 +1,13 @@ +manifest: + version: "0.12" + remotes: + - name: hardwario-chester + url-base: git@gitlab.hardwario.com:chester + projects: + - name: sdk.git + remote: hardwario-chester + revision: main + path: chester + import: true + self: + path: vendor diff --git a/zephyr/module.yml b/zephyr/module.yml new file mode 100644 index 0000000..219b2cf --- /dev/null +++ b/zephyr/module.yml @@ -0,0 +1,5 @@ +build: + cmake: . + kconfig: Kconfig + settings: + dts_root: .