From 13406a24a3118209a697caeb0fb1335b76e0e6a5 Mon Sep 17 00:00:00 2001 From: Ronny Eia <3652665+eiaro@users.noreply.github.com> Date: Tue, 7 Jul 2026 21:57:10 +0200 Subject: [PATCH] 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 --- .gitignore | 26 ++++++++++++++++++++++++++ README.md | Bin 8 -> 1404 bytes app/CMakeLists.txt | 11 +++++++++++ app/Kconfig | 1 + app/prj.conf | 6 ++++++ app/src/config_manager/README.md | 3 +++ app/src/gpio_manager/README.md | 3 +++ app/src/hal/README.md | 3 +++ app/src/main.c | 10 ++++++++++ app/src/matter_manager/README.md | 3 +++ app/src/ota/README.md | 3 +++ app/src/power_manager/README.md | 3 +++ app/src/rule_engine/README.md | 3 +++ app/src/sensor_profiles/README.md | 3 +++ docker-compose.yml | 25 +++++++++++++++++++++++++ docker/Dockerfile | 21 +++++++++++++++++++++ west.yml | 23 +++++++++++++++++++++++ 17 files changed, 147 insertions(+) create mode 100644 .gitignore create mode 100644 app/CMakeLists.txt create mode 100644 app/Kconfig create mode 100644 app/prj.conf create mode 100644 app/src/config_manager/README.md create mode 100644 app/src/gpio_manager/README.md create mode 100644 app/src/hal/README.md create mode 100644 app/src/main.c create mode 100644 app/src/matter_manager/README.md create mode 100644 app/src/ota/README.md create mode 100644 app/src/power_manager/README.md create mode 100644 app/src/rule_engine/README.md create mode 100644 app/src/sensor_profiles/README.md create mode 100644 docker-compose.yml create mode 100644 docker/Dockerfile create mode 100644 west.yml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1c4b729 --- /dev/null +++ b/.gitignore @@ -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/ diff --git a/README.md b/README.md index b7f9a62b1b32f6799bac4b54bb3c55f40174da97..ddd451c509cd3bc7b980bf1cbd98ee9c10477646 100644 GIT binary patch literal 1404 zcma)+L2leO6o&UY#RFzD1DH~h+6QRjxJBX`Xs4)y76rtS-e_o2BtcRdxT_qZSID9_ z@P2O6ljNr~9vf~KS&fDe-}~S9{$C5yqiUsau_&%&Ors1;TNmhKKBj*^|4nRZuxjKG z*_boh$dov!Ht@)aewzLX>sqGejSH=6$o_J5aen>!Vny2^>C?S&wk(R@RJ?PRTt_l! zl~|`C5C__D)N?IGJtrvwdxy$@)RVIM&t+Lw(_{7h5ASb&U6*~kD(R9TgO2YiYkB8P zi*kCfv^@@Dq4vJ(P|P2`(33iP=WwA(w7&dE%ir1W?!yWa7Yn*_VMvjaRkq_$6oM{Y zqwyr@c76Q@KlKnd%C};#Y)#9I3bg@?14p*N@IhQFtE=_xrSQRRfD;sMm2KTVQc`9r zL?gGfH8SqdXf?Hd>ttw);_a*$qo6jM!-H2HMPMf9J@qa<4iZ&9+iq1A8}Z6q{hJ1MQ1y1OiqEnc3v|2(Kh z$Ap)P0^3PaSpc=9?+y=^%l#^Q{W2Gun;V zQ2X30xtben!a(rN1Y(+Ds%vSs9Rg9+CEdJRSF=Av@7lqzWsn)6ZMqi^4^cy<93P#y ze5NZ?ug{(|T$(d#cGD7td zw~BVMCN-}2E;4NfWniEM{m2$Bc_}^6a;6#S@Q}5e zm_L7L!ZD%8bUsBlA;yxP;(ZG1H({8 +#include + +LOG_MODULE_REGISTER(kvida_os, LOG_LEVEL_INF); + +int main(void) +{ + LOG_INF("kvida-os starting"); + return 0; +} diff --git a/app/src/matter_manager/README.md b/app/src/matter_manager/README.md new file mode 100644 index 0000000..0d0c707 --- /dev/null +++ b/app/src/matter_manager/README.md @@ -0,0 +1,3 @@ +# matter_manager + +Exposes configured sensor profiles as Matter endpoints/clusters over Thread, and handles Matter commissioning. diff --git a/app/src/ota/README.md b/app/src/ota/README.md new file mode 100644 index 0000000..2f10218 --- /dev/null +++ b/app/src/ota/README.md @@ -0,0 +1,3 @@ +# ota + +Firmware update handling (DFU over Matter/Thread, image validation, rollback). diff --git a/app/src/power_manager/README.md b/app/src/power_manager/README.md new file mode 100644 index 0000000..48e28cb --- /dev/null +++ b/app/src/power_manager/README.md @@ -0,0 +1,3 @@ +# power_manager + +Battery-first power management: sleep/wake scheduling, power state transitions, and battery level reporting. diff --git a/app/src/rule_engine/README.md b/app/src/rule_engine/README.md new file mode 100644 index 0000000..2a6ddfe --- /dev/null +++ b/app/src/rule_engine/README.md @@ -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. diff --git a/app/src/sensor_profiles/README.md b/app/src/sensor_profiles/README.md new file mode 100644 index 0000000..941eb3a --- /dev/null +++ b/app/src/sensor_profiles/README.md @@ -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. diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..4031950 --- /dev/null +++ b/docker-compose.yml @@ -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: diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..70ba771 --- /dev/null +++ b/docker/Dockerfile @@ -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. diff --git a/west.yml b/west.yml new file mode 100644 index 0000000..59e40fd --- /dev/null +++ b/west.yml @@ -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