Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
Signed-off-by: Pavel Hübner <[email protected]>
  • Loading branch information
hubpav committed Jan 12, 2023
0 parents commit 4d6aeb5
Show file tree
Hide file tree
Showing 20 changed files with 317 additions and 0 deletions.
82 changes: 82 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -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: '^\<zephyr/.*\.h\>$'
Priority: 2
- Regex: '.*'
Priority: 3
IndentCaseLabels: false
IndentWidth: 8
# SpaceBeforeParens: ControlStatementsExceptControlMacros # clang-format >= 13.0
UseTab: Always
WhitespaceSensitiveMacros:
- STRINGIFY
- Z_STRINGIFY
92 changes: 92 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.DS_Store
build/
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
add_subdirectory(drivers)
add_subdirectory(lib)
add_subdirectory(subsys)

zephyr_include_directories(include)
3 changes: 3 additions & 0 deletions Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
rsource "drivers/Kconfig"
rsource "lib/Kconfig"
rsource "subsys/Kconfig"
88 changes: 88 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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 [email protected]: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
```
6 changes: 6 additions & 0 deletions application/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
Empty file added application/app.overlay
Empty file.
3 changes: 3 additions & 0 deletions application/prj.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CONFIG_CTR_DEFAULTS=y
CONFIG_CTR_LOG=y
CONFIG_CTR_SHELL=y
9 changes: 9 additions & 0 deletions application/src/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>

LOG_MODULE_REGISTER(main, LOG_LEVEL_DBG);

void main(void)
{
LOG_INF("Build time: " __DATE__ " " __TIME__);
}
Empty file added drivers/CMakeLists.txt
Empty file.
3 changes: 3 additions & 0 deletions drivers/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
menu "Drivers"

endmenu
Empty file.
Empty file added include/drivers/.gitkeep
Empty file.
Empty file added lib/CMakeLists.txt
Empty file.
3 changes: 3 additions & 0 deletions lib/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
menu "Libraries"

endmenu
Empty file added subsys/CMakeLists.txt
Empty file.
3 changes: 3 additions & 0 deletions subsys/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
menu "Subsystems"

endmenu
13 changes: 13 additions & 0 deletions west.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
manifest:
version: "0.12"
remotes:
- name: hardwario-chester
url-base: [email protected]:chester
projects:
- name: sdk.git
remote: hardwario-chester
revision: main
path: chester
import: true
self:
path: vendor
5 changes: 5 additions & 0 deletions zephyr/module.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
build:
cmake: .
kconfig: Kconfig
settings:
dts_root: .

0 comments on commit 4d6aeb5

Please sign in to comment.