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 b7f9a62..ddd451c 100644 Binary files a/README.md and b/README.md differ diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt new file mode 100644 index 0000000..6a96653 --- /dev/null +++ b/app/CMakeLists.txt @@ -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. diff --git a/app/Kconfig b/app/Kconfig new file mode 100644 index 0000000..d3e1164 --- /dev/null +++ b/app/Kconfig @@ -0,0 +1 @@ +rsource "Kconfig.zephyr" diff --git a/app/prj.conf b/app/prj.conf new file mode 100644 index 0000000..1a14476 --- /dev/null +++ b/app/prj.conf @@ -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 diff --git a/app/src/config_manager/README.md b/app/src/config_manager/README.md new file mode 100644 index 0000000..525cbd4 --- /dev/null +++ b/app/src/config_manager/README.md @@ -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. diff --git a/app/src/gpio_manager/README.md b/app/src/gpio_manager/README.md new file mode 100644 index 0000000..1e9a727 --- /dev/null +++ b/app/src/gpio_manager/README.md @@ -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. diff --git a/app/src/hal/README.md b/app/src/hal/README.md new file mode 100644 index 0000000..b8d7cc6 --- /dev/null +++ b/app/src/hal/README.md @@ -0,0 +1,3 @@ +# hal + +Hardware abstraction layer: wraps nRF54L15 peripherals (GPIO, ADC, I2C) behind a board-independent interface used by the other modules. diff --git a/app/src/main.c b/app/src/main.c new file mode 100644 index 0000000..ac75236 --- /dev/null +++ b/app/src/main.c @@ -0,0 +1,10 @@ +#include +#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