Skip to content

Commit

Permalink
subsys: ctr_lte_v2: Add LTE v2 + shield + sample + FOTA
Browse files Browse the repository at this point in the history
  • Loading branch information
blavka committed Mar 27, 2024
1 parent 908fcb2 commit 4499196
Show file tree
Hide file tree
Showing 114 changed files with 13,429 additions and 679 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.DS_Store
.DS_Store?
build/
scripts/west_commands/__pycache__/*.pyc
doc/html
doc/latex
scripts/west_commands/__pycache__/*.pyc
twister-out*
1 change: 1 addition & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ build:
- west init -l --mf west.yml chester
- west update
- west config build.board chester_nrf52840
- ./zephyr/scripts/twister --testsuite-root chester/tests -c -i
- |
for sample in chester/samples/*/
do
Expand Down
27 changes: 27 additions & 0 deletions applications/demo/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#
# Copyright (c) 2023 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_NAME} "CHESTER Demo")

find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})

project(app)

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_work.c)

target_sources(app PRIVATE src/main.c)
23 changes: 23 additions & 0 deletions applications/demo/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#
# Copyright (c) 2023 HARDWARIO a.s.
#
# SPDX-License-Identifier: LicenseRef-HARDWARIO-5-Clause
#

menu "Application"

config APP_REPORT_JITTER
bool "Add random time jitter to report transfers"
default y
select ENTROPY_GENERATOR

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

endmenu

menu "Zephyr Kernel"
source "Kconfig.zephyr"
endmenu
5 changes: 5 additions & 0 deletions applications/demo/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 = dev
47 changes: 47 additions & 0 deletions applications/demo/boards/chester_nrf52840.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Copyright (c) 2023 HARDWARIO a.s.
*
* SPDX-License-Identifier: LicenseRef-HARDWARIO-5-Clause
*/

/ {
chosen {
nordic,pm-ext-flash = &spi_flash0;
};
};

&spi_flash0 {
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;

littlefs_storage: partition@0 {
label = "littlefs_storage";

/*
* This size doesn't matter due to Nordic's partition
* manager; For the sake of consistency this should
* match the configured size
*/
reg = <0x00000000 0x730000>;
};
};
};

/ {
fstab {
compatible = "zephyr,fstab";
lfs1: lfs1 {
compatible = "zephyr,fstab,littlefs";
mount-point = "/lfs1";
partition = <&littlefs_storage>;
automount;
read-size = <16>;
prog-size = <16>;
cache-size = <64>;
lookahead-size = <32>;
block-cycles = <512>;
};
};
};
12 changes: 12 additions & 0 deletions applications/demo/child_image/mcuboot.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#
# Copyright (c) 2023 HARDWARIO a.s.
#
# SPDX-License-Identifier: LicenseRef-HARDWARIO-5-Clause
#

CONFIG_BOOT_MAX_IMG_SECTORS=4096
CONFIG_BOOT_SWAP_USING_SCRATCH=y
CONFIG_MULTITHREADING=y
CONFIG_SPI=y

CONFIG_MCUBOOT_ACTION_HOOKS=y
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
* Copyright (c) 2023 HARDWARIO a.s.
*
* SPDX-License-Identifier: LicenseRef-HARDWARIO-5-Clause
*/

/ {
chosen {
nordic,pm-ext-flash = &spi_flash0;
};
};
32 changes: 32 additions & 0 deletions applications/demo/codec/cbor-decoder.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
version: 2
type: decoder
name: com.hardwario.chester.app.demo
schema:
- message:
- sequence:
- timestamp:
- system:
- uptime:
- voltage_rest:
- $div: 1000
- $fpp: 2
- voltage_load:
- $div: 1000
- $fpp: 2
- current_load:
- thermometer:
- temperature:
- $div: 100
- $fpp: 2
- accelerometer:
- acceleration_x:
- $div: 1000
- $fpp: 2
- acceleration_y:
- $div: 1000
- $fpp: 2
- acceleration_z:
- $div: 1000
- $fpp: 2
- orientation:
- buffer:
12 changes: 12 additions & 0 deletions applications/demo/codec/cbor-encoder.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: 2
type: encoder
name: com.hardwario.chester.app.demo
schema:
- led_r:
- $type: int
- led_g:
- $type: int
- led_y:
- $type: int
- led_load:
- $type: int
84 changes: 84 additions & 0 deletions applications/demo/pm_static.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
app:
address: 0xc200
end_address: 0xdc000
region: flash_primary
size: 0xcfe00
external_flash:
address: 0x730000
end_address: 0x800000
region: external_flash
size: 0x0
littlefs_storage:
address: 0xd0000
device: DT_CHOSEN(nordic_pm_ext_flash)
end_address: 0x800000
placement:
before:
- tfm_storage
- end
region: external_flash
size: 0x730000
mcuboot:
address: 0x0
end_address: 0xc000
placement:
before:
- mcuboot_primary
region: flash_primary
size: 0xc000
mcuboot_pad:
address: 0xc000
end_address: 0xc200
placement:
align:
start: 0x1000
before:
- mcuboot_primary_app
region: flash_primary
size: 0x200
mcuboot_primary:
address: 0xc000
end_address: 0xdc000
orig_span: &id001
- app
- mcuboot_pad
region: flash_primary
size: 0xd0000
span: *id001
mcuboot_primary_app:
address: 0xc200
end_address: 0xdc000
orig_span: &id002
- app
region: flash_primary
size: 0xcfe00
span: *id002
mcuboot_scratch:
address: 0xdc000
end_address: 0xfa000
placement:
after:
- app
align:
start: 0x1000
region: flash_primary
size: 0x1e000
mcuboot_secondary:
address: 0x0
device: DT_CHOSEN(nordic_pm_ext_flash)
end_address: 0xd0000
placement:
align:
start: 0x4
region: external_flash
share_size:
- mcuboot_primary
size: 0xd0000
nvs_storage:
address: 0xfa000
end_address: 0x100000
placement:
before:
- end
region: flash_primary
size: 0x6000
67 changes: 67 additions & 0 deletions applications/demo/prj.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#
# Copyright (c) 2023 HARDWARIO a.s.
#
# SPDX-License-Identifier: LicenseRef-HARDWARIO-5-Clause
#

CONFIG_ADC_NRFX_SAADC=n
CONFIG_ADC_SHELL=n
CONFIG_APP_TAMPER=n
CONFIG_CTR_ACCEL=y
CONFIG_CTR_BATT=y
CONFIG_CTR_BUTTON=y
CONFIG_CTR_BLE=n
CONFIG_CTR_BUF=y
CONFIG_CTR_CLOUD=y
CONFIG_CTR_DEFAULTS=y
CONFIG_CTR_INFO=y
CONFIG_CTR_LED=y
CONFIG_CTR_LOG=y
CONFIG_CTR_LTE_V2_CLKSYNC=n
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_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_ERR=y
CONFIG_CTR_LTE_LINK_LOG_LEVEL_DBG=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_SETTINGS_FILE=y
CONFIG_SETTINGS_FILE_PATH="/lfs1/settings/run"

# Use external flash for littlefs file system
CONFIG_PM_PARTITION_REGION_LITTLEFS_EXTERNAL=y
Loading

0 comments on commit 4499196

Please sign in to comment.