Skip to content

Commit

Permalink
applications: demo: Add project generator
Browse files Browse the repository at this point in the history
  • Loading branch information
Enzo Frese authored and hubmartin committed Oct 15, 2024
1 parent e9de391 commit 92d50d4
Show file tree
Hide file tree
Showing 21 changed files with 627 additions and 434 deletions.
28 changes: 16 additions & 12 deletions applications/demo/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,34 +1,38 @@
#
# Copyright (c) 2023 HARDWARIO a.s.
# Copyright (c) 2024 HARDWARIO a.s.
#
# SPDX-License-Identifier: LicenseRef-HARDWARIO-5-Clause
#

cmake_minimum_required(VERSION 3.20.0)

set(SHIELD ctr_lte_v2)
set(ENV{FW_BUNDLE} "com.hardwario.chester.app.demo")
set(ENV{FW_VERSION} "v3.0.0")
set(ENV{FW_NAME} "CHESTER Demo")

find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(app)

project(chester-demo)

add_custom_command(
COMMAND west gen-codec -d ../codec/cbor-decoder.yaml -e ../codec/cbor-encoder.yaml -o ../src/app_codec.h
OUTPUT ../src/app_codec.h
DEPENDS ../codec/cbor-decoder.yaml ../codec/cbor-encoder.yaml
DEPENDS ../codec/cbor-decoder.yaml
)

target_sources(app PRIVATE src/app_cbor.c)
target_sources(app PRIVATE src/app_config.c)
target_sources(app PRIVATE src/app_data.c)
target_sources(app PRIVATE src/app_handler.c)
target_sources(app PRIVATE src/app_init.c)
target_sources(app PRIVATE src/app_power.c)
target_sources(app PRIVATE src/app_sensor.c)
target_sources(app PRIVATE src/app_shell.c)
target_sources(app PRIVATE src/app_codec.h)
target_sources(app PRIVATE src/app_power.c)
target_sources(app PRIVATE src/main.c)
target_sources(app PRIVATE src/app_cbor.c)
target_sources(app PRIVATE src/app_work.c)
target_sources(app PRIVATE src/app_sensor.c)
target_sources(app PRIVATE src/app_init.c)
target_sources(app PRIVATE src/app_handler.c)
target_sources(app PRIVATE src/app_config.c)

target_sources(app PRIVATE src/main.c)
target_precompile_headers(app PRIVATE src/feature.h)

target_sources(app PRIVATE src/app_codec.h)
# ### Preserved code "cmake" (begin)
# ^^^ Preserved code "cmake" (end)
23 changes: 19 additions & 4 deletions applications/demo/Kconfig
Original file line number Diff line number Diff line change
@@ -1,20 +1,35 @@
#
# Copyright (c) 2023 HARDWARIO a.s.
# Copyright (c) 2024 HARDWARIO a.s.
#
# SPDX-License-Identifier: LicenseRef-HARDWARIO-5-Clause
#

menu "Application"

# CHESTER-APP-REPORT-JITTER
config APP_REPORT_JITTER
bool "Add random time jitter to report transfers"
default y
select ENTROPY_GENERATOR
# SUBSYSTEM-GNSS#
config SHIELD_CTR_GNSS
bool "Enable SHIELD_CTR_GNSS"
default y

config CTR_GNSS
default y
# SUBSYSTEM-LTE-V2
config SHIELD_CTR_LTE_V2
bool "Enable SHIELD_CTR_LTE_V2"
default y

config APP_TAMPER
bool "Enable tamper functionality"
config CTR_LTE_V2
default y
select CTR_EDGE

# ### Preserved code "k_config" (begin)
# ^^^ Preserved code "k_config" (end)

rsource "Kconfig.variant"

endmenu

Expand Down
10 changes: 10 additions & 0 deletions applications/demo/Kconfig.variant
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#
# Copyright (c) 2024 HARDWARIO a.s.
#
# SPDX-License-Identifier: LicenseRef-HARDWARIO-5-Clause
#

config VARIANT_CHESTER_DEMO
bool "Enable VARIANT_CHESTER_DEMO"
default y

2 changes: 1 addition & 1 deletion applications/demo/VERSION
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION_MAJOR = 1
VERSION_MAJOR = 3
VERSION_MINOR = 0
PATCHLEVEL = 0
VERSION_TWEAK = 0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
/*
* Copyright (c) 2023 HARDWARIO a.s.
* Copyright (c) 2024 HARDWARIO a.s.
*
* SPDX-License-Identifier: LicenseRef-HARDWARIO-5-Clause
*/

/* SUBSYSTEM-CLOUD */
/ {
chosen {
nordic,pm-ext-flash = &spi_flash0;
Expand Down Expand Up @@ -45,3 +46,31 @@
};
};
};
/* SUBSYSTEM-GNSS */
&m8 {
status = "okay";
};
/* SUBSYSTEM-LTE-V2 */
/ {
chosen {
ctr,lte_link = &ctr_lte_link;
};
};

&uart0 {
status = "okay";

ctr_lte_link: ctr_lte_link {
compatible = "hardwario,ctr-lte-link";
status = "okay";
reset-gpios = <&gpio1 7 (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>;
wakeup-gpios = <&gpio0 15 (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>;
};
};

&uart0 {
status = "okay";
};

/* ### Preserved code "overlay" (begin) */
/* ^^^ Preserved code "overlay" (end) */
10 changes: 9 additions & 1 deletion applications/demo/codec/cbor-decoder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ type: decoder
name: com.hardwario.chester.app.demo
schema:
- message:
- version:
- sequence:
- timestamp:
- system:
Expand All @@ -14,6 +15,13 @@ schema:
- $div: 1000
- $fpp: 2
- current_load:
- attribute:
- vendor_name:
- product_name:
- hw_variant:
- hw_revision:
- fw_version:
- serial_number:
- network:
- parameter:
- eest:
Expand All @@ -40,4 +48,4 @@ schema:
- $div: 1000
- $fpp: 2
- orientation:
- buffer:
90 changes: 48 additions & 42 deletions applications/demo/prj.conf
Original file line number Diff line number Diff line change
@@ -1,72 +1,78 @@
#
# Copyright (c) 2023 HARDWARIO a.s.
# Copyright (c) 2024 HARDWARIO a.s.
#
# SPDX-License-Identifier: LicenseRef-HARDWARIO-5-Clause
#

CONFIG_ADC_NRFX_SAADC=n
CONFIG_ADC_SHELL=n
CONFIG_APP_TAMPER=n
# Configurations
# SUBSYSTEM-ACCEL
CONFIG_CTR_ACCEL=y
# SUBSYSTEM-BATT
CONFIG_CTR_BATT=y
CONFIG_CTR_BUTTON=y
# SUBSYSTEM-BLUETOOTH
CONFIG_CTR_BLE=y
# SUBSYSTEM-BUF
CONFIG_CTR_BUF=y
# SUBSYSTEM-BUTTON
CONFIG_CTR_BUTTON=y
# SUBSYSTEM-CLOUD
CONFIG_CTR_CLOUD=y
CONFIG_CTR_DEFAULTS=y
CONFIG_CTR_INFO=y
CONFIG_CTR_LED=y
CONFIG_CTR_LOG=y
CONFIG_CTR_RTC=y
CONFIG_CTR_SHELL=y
CONFIG_CTR_THERM=y
CONFIG_CTR_WDOG=y
CONFIG_NEWLIB_LIBC_NANO=n
CONFIG_TINYCRYPT=y
CONFIG_TINYCRYPT_SHA256=y
CONFIG_ZCBOR=y
CONFIG_ZCBOR_STOP_ON_ERROR=y
CONFIG_ENTROPY_GENERATOR=y

CONFIG_SETTINGS_SHELL=y

CONFIG_IMG_MANAGER=y
CONFIG_BOOTLOADER_MCUBOOT=y

CONFIG_CTR_LTE_V2_GNSS=y
CONFIG_CTR_GNSS=y

# CONFIG_MCUBOOT_EXTRA_IMGTOOL_ARGS="--custom-tlv 0xff00 tralala"

CONFIG_PM_PARTITION_SIZE_SETTINGS_STORAGE=0x8000
CONFIG_PM_OVERRIDE_EXTERNAL_DRIVER_CHECK=y
CONFIG_SPI=y

CONFIG_DFU_TARGET=y
CONFIG_DFU_TARGET_STREAM=y
CONFIG_DFU_TARGET_MCUBOOT=y
CONFIG_DFU_TARGET_LOG_LEVEL_DBG=y
CONFIG_STREAM_FLASH_ERASE=y
CONFIG_STREAM_FLASH=y

# CONFIG_CTR_LTE_LINK_LOG_LEVEL_DBG=y
CONFIG_CTR_LTE_LINK_LOG_LEVEL_INF=y
# CONFIG_CTR_LTE_LINK_LOG_LEVEL_ERR=y
# CONFIG_CTR_LTE_V2_LOG_LEVEL_ERR=y
CONFIG_CTR_LTE_V2_LOG_LEVEL_DBG=y

CONFIG_ADC_TLA2021_INIT_PRIORITY=60


# Enable file system support
CONFIG_FILE_SYSTEM=y
CONFIG_FILE_SYSTEM_LITTLEFS=y
CONFIG_FILE_SYSTEM_MKFS=y
CONFIG_FILE_SYSTEM_SHELL=y
# CONFIG_FILE_SYSTEM_SHELL_TEST_COMMANDS=y
CONFIG_SETTINGS_FILE=y
CONFIG_SETTINGS_FILE_PATH="/lfs1/settings/run"
# Use external flash for littlefs file system
CONFIG_PM_PARTITION_REGION_LITTLEFS_EXTERNAL=y
# SUBSYSTEM-CONFIG
CONFIG_CTR_CONFIG=y
# SUBSYSTEM-DEFAULTS
CONFIG_CTR_DEFAULTS=y
# SUBSYSTEM-ENTROPY-GENERATOR
CONFIG_ENTROPY_GENERATOR=y
# SUBSYSTEM-GNSS
CONFIG_CTR_GNSS=y
# SUBSYSTEM-INFO
CONFIG_CTR_INFO=y
# SUBSYSTEM-LED
CONFIG_CTR_LED=y
# SUBSYSTEM-LOG
CONFIG_CTR_LOG=y
# SUBSYSTEM-LTE-V2
CONFIG_CTR_LTE_V2=y
# SUBSYSTEM-RTC
CONFIG_CTR_RTC=y
# SUBSYSTEM-SHELL
CONFIG_CTR_SHELL=y
# SUBSYSTEM-THERM
CONFIG_CTR_THERM=y
# SUBSYSTEM-TINYCRYPT
CONFIG_TINYCRYPT=y
# SUBSYSTEM-TINYCRYPT-SHA256
CONFIG_TINYCRYPT_SHA256=y
# SUBSYSTEM-WDOG
CONFIG_CTR_WDOG=y
# SUBSYSTEM-ZCBOR
CONFIG_ZCBOR=y
CONFIG_ZCBOR_STOP_ON_ERROR=y
# Extra configurations
CONFIG_ADC_NRFX_SAADC=n
CONFIG_ADC_SHELL=n
CONFIG_ADC_TLA2021_INIT_PRIORITY=60
CONFIG_CTR_LTE_V2_GNSS=y
CONFIG_NEWLIB_LIBC_NANO=n


# ### Preserved code "config" (begin)
# ^^^ Preserved code "config" (end)
75 changes: 75 additions & 0 deletions applications/demo/project.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
version: 1
variants:
- name: CHESTER Demo
fw_bundle: com.hardwario.chester.app.demo
fw_name: hio-chester-demo
fw_version: v3.0.0
project:
variant: Demo
company: 2024 HARDWARIO a.s.
license: 'SPDX-License-Identifier: LicenseRef-HARDWARIO-5-Clause'
fw_name: CHESTER Demo
fw_bundle: com.hardwario.chester.app.demo
fw_version: v3.0.0
features:
- subsystem-accel
- subsystem-batt
- subsystem-bluetooth
- subsystem-buf
- subsystem-button
- subsystem-config
- subsystem-cloud
- subsystem-defaults
- subsystem-gnss
- subsystem-info
- subsystem-led
- subsystem-log
- subsystem-rtc
- subsystem-shell
- subsystem-therm
- subsystem-wdog
- subsystem-entropy-generator
- subsystem-tinycrypt
- subsystem-tinycrypt-sha256
- subsystem-zcbor
- subsystem-lte-v2
- chester-app-report-jitter
#- chester-app-tamper
parameters:
- name: interval-sample
type: int
min: 1
max: 86400
default: 60
help: 'Get/Set sample interval in seconds'
- name: interval-aggreg
type: int
min: 1
max: 86400
default: 300
help: 'Get/Set aggregate interval in seconds '
- name: interval-report
type: int
min: 30
max: 86400
default: 1800
help: 'Get/Set report interval in seconds'
- name: interval-poll
type: int
min: 0
max: 86400
default: 0
help: "Get/Set poll interval in seconds (disabled if 0)"
commands:
- name: sample
callback: app_work_sample()
help: 'Sample immediately.'
- name: send
callback: app_work_send()
help: 'Send data immediately.'
extras:
- CONFIG_CTR_LTE_V2_GNSS=y
- CONFIG_ADC_NRFX_SAADC=n
- CONFIG_NEWLIB_LIBC_NANO=n
- CONFIG_ADC_SHELL=n
- CONFIG_ADC_TLA2021_INIT_PRIORITY=60
Loading

0 comments on commit 92d50d4

Please sign in to comment.