Scaffold NCS firmware project structure
Sets up kvida-os as a freestanding nRF Connect SDK application for the nRF54L15, pinned to NCS v3.4.0, with a Docker/WSL2 build environment (toolchain-only image, NCS modules fetched into a separate volume at first run) and placeholder module directories matching the architecture described in the kvida meta-repo. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
26
.gitignore
vendored
Normal file
26
.gitignore
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
# Zephyr / nRF Connect SDK
|
||||
/build/
|
||||
/.west/
|
||||
/bootloader/
|
||||
/modules/
|
||||
/nrf/
|
||||
/nrfxlib/
|
||||
/zephyr/
|
||||
/tools/
|
||||
*.o
|
||||
*.elf
|
||||
*.hex
|
||||
*.bin
|
||||
*.map
|
||||
*.uf2
|
||||
|
||||
# Python
|
||||
__pycache__/
|
||||
*.pyc
|
||||
.venv/
|
||||
venv/
|
||||
|
||||
# OS / editor
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
.vscode/
|
||||
11
app/CMakeLists.txt
Normal file
11
app/CMakeLists.txt
Normal file
@@ -0,0 +1,11 @@
|
||||
cmake_minimum_required(VERSION 3.20.0)
|
||||
|
||||
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
|
||||
project(kvida_os)
|
||||
|
||||
target_sources(app PRIVATE src/main.c)
|
||||
|
||||
# Module directories under src/ (hal, gpio_manager, power_manager,
|
||||
# matter_manager, ota, config_manager, sensor_profiles, rule_engine) are
|
||||
# currently placeholders with no source files. Add add_subdirectory()
|
||||
# calls for each once it gains a CMakeLists.txt and real sources.
|
||||
1
app/Kconfig
Normal file
1
app/Kconfig
Normal file
@@ -0,0 +1 @@
|
||||
rsource "Kconfig.zephyr"
|
||||
6
app/prj.conf
Normal file
6
app/prj.conf
Normal file
@@ -0,0 +1,6 @@
|
||||
# Minimal base configuration so the application boots and logs.
|
||||
# Matter, Thread, power management, and other feature-specific Kconfig
|
||||
# options are added as the corresponding modules gain real implementations.
|
||||
|
||||
CONFIG_LOG=y
|
||||
CONFIG_GPIO=y
|
||||
3
app/src/config_manager/README.md
Normal file
3
app/src/config_manager/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# config_manager
|
||||
|
||||
Stores and applies the user's device configuration (selected sensor profile, GPIO assignment, options) without requiring a firmware change.
|
||||
3
app/src/gpio_manager/README.md
Normal file
3
app/src/gpio_manager/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# gpio_manager
|
||||
|
||||
Maps configured sensor profiles to physical GPIO/ADC/I2C pins at runtime, based on the active configuration rather than build-time wiring.
|
||||
3
app/src/hal/README.md
Normal file
3
app/src/hal/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# hal
|
||||
|
||||
Hardware abstraction layer: wraps nRF54L15 peripherals (GPIO, ADC, I2C) behind a board-independent interface used by the other modules.
|
||||
10
app/src/main.c
Normal file
10
app/src/main.c
Normal file
@@ -0,0 +1,10 @@
|
||||
#include <zephyr/kernel.h>
|
||||
#include <zephyr/logging/log.h>
|
||||
|
||||
LOG_MODULE_REGISTER(kvida_os, LOG_LEVEL_INF);
|
||||
|
||||
int main(void)
|
||||
{
|
||||
LOG_INF("kvida-os starting");
|
||||
return 0;
|
||||
}
|
||||
3
app/src/matter_manager/README.md
Normal file
3
app/src/matter_manager/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# matter_manager
|
||||
|
||||
Exposes configured sensor profiles as Matter endpoints/clusters over Thread, and handles Matter commissioning.
|
||||
3
app/src/ota/README.md
Normal file
3
app/src/ota/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# ota
|
||||
|
||||
Firmware update handling (DFU over Matter/Thread, image validation, rollback).
|
||||
3
app/src/power_manager/README.md
Normal file
3
app/src/power_manager/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# power_manager
|
||||
|
||||
Battery-first power management: sleep/wake scheduling, power state transitions, and battery level reporting.
|
||||
3
app/src/rule_engine/README.md
Normal file
3
app/src/rule_engine/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# rule_engine
|
||||
|
||||
Executes user-defined behavior rules (level 3: Lua scripts, level 2: Blockly-generated intermediate representation) without requiring a firmware rebuild.
|
||||
3
app/src/sensor_profiles/README.md
Normal file
3
app/src/sensor_profiles/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# sensor_profiles
|
||||
|
||||
Reusable sensor profile implementations (reed switch, hall sensor, push button, pulse counter, analog input, DS18B20, BME280, leak sensor, PIR, generic I2C device) selectable via configuration.
|
||||
25
docker-compose.yml
Normal file
25
docker-compose.yml
Normal file
@@ -0,0 +1,25 @@
|
||||
services:
|
||||
build:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: docker/Dockerfile
|
||||
working_dir: /workspace
|
||||
volumes:
|
||||
# West workspace topdir: holds .west/, and the NCS/Zephyr module
|
||||
# tree fetched by `west update` (nrf/, zephyr/, modules/, ...).
|
||||
- ncs-workspace:/workspace
|
||||
# This repo, bind-mounted as the manifest project inside the
|
||||
# workspace (matches `self.path: kvida-os` in west.yml).
|
||||
- .:/workspace/kvida-os
|
||||
tty: true
|
||||
# USB/J-Link access (for `west flash`) is expected to be handled via
|
||||
# usbipd-win forwarding the probe into WSL2. If `west flash` needs to
|
||||
# run inside this container rather than on the WSL2 host, uncomment
|
||||
# and adjust one of the following once the forwarded device node is
|
||||
# known:
|
||||
# devices:
|
||||
# - "/dev/bus/usb:/dev/bus/usb"
|
||||
# privileged: true
|
||||
|
||||
volumes:
|
||||
ncs-workspace:
|
||||
21
docker/Dockerfile
Normal file
21
docker/Dockerfile
Normal file
@@ -0,0 +1,21 @@
|
||||
# Build-only toolchain image for kvida-os.
|
||||
#
|
||||
# Provides the Zephyr SDK toolchain, west, CMake, Ninja and Python that
|
||||
# NCS builds need. It intentionally does NOT bake in the NCS/Zephyr
|
||||
# module tree (nrf/, zephyr/, modules/, ...) fetched by `west update` --
|
||||
# that is left to a named volume mounted at /workspace at container run
|
||||
# time, so the image stays small and NCS revisions can be bumped without
|
||||
# rebuilding it.
|
||||
#
|
||||
# NOTE: verify this base image tag still exists/is current before relying
|
||||
# on it -- it could not be checked against the live registry while
|
||||
# writing this Dockerfile.
|
||||
FROM ghcr.io/zephyrproject-rtos/zephyr-build:latest
|
||||
|
||||
RUN pip3 install --no-cache-dir -U west
|
||||
|
||||
WORKDIR /workspace
|
||||
|
||||
# TODO: install Nordic's nRF Command Line Tools / nrfutil here if
|
||||
# `west flash` should run from inside this container against a J-Link
|
||||
# probe forwarded into WSL2 via usbipd-win, instead of from the host.
|
||||
23
west.yml
Normal file
23
west.yml
Normal file
@@ -0,0 +1,23 @@
|
||||
# West manifest for kvida-os (freestanding NCS application).
|
||||
#
|
||||
# This repo is meant to sit as a named subdirectory ("kvida-os") inside a
|
||||
# west workspace topdir, e.g. `/workspace/kvida-os`. Running
|
||||
# `west init -l kvida-os && west update` from the topdir fetches sdk-nrf
|
||||
# (which pulls in Zephyr, MCUboot, Matter, etc. via its own manifest) as
|
||||
# siblings of this repo (`/workspace/nrf`, `/workspace/zephyr`, ...).
|
||||
#
|
||||
# Pinned to NCS v3.4.0.
|
||||
manifest:
|
||||
remotes:
|
||||
- name: ncs
|
||||
url-base: https://github.com/nrfconnect
|
||||
|
||||
projects:
|
||||
- name: nrf
|
||||
remote: ncs
|
||||
repo-path: sdk-nrf
|
||||
revision: v3.4.0
|
||||
import: true
|
||||
|
||||
self:
|
||||
path: kvida-os
|
||||
Reference in New Issue
Block a user