Docs

Documentation, usage, and integration

This page condenses the main ZeroKernel docs into a practical setup guide: install, configure, wire tasks, choose profiles, and validate behavior with the included compare suites.

Why this page matters

This page explains how Documentation, usage, and integration fits into the wider ZeroKernel execution model, what problem it is meant to solve, and what trade-off you are actually accepting when you use it in production firmware. The goal is not to treat Documentation, usage, and integration as an isolated API call, but to understand where it sits inside bounded scheduling, queue discipline, fault visibility, and profile selection.

Read this topic as an operational contract. Start from the smallest working path, wire it into a lean profile first, and only expand into richer routing, diagnostics, or transport state after you can prove that the timing outcome is still worth the extra flash and RAM. That mindset is what keeps ZeroKernel useful on small boards instead of turning it into another bloated abstraction.

The safest pattern is always the same: define the runtime boundary, keep the hot path short, measure the effect with compare scripts, and only then scale complexity. The examples below are not filler; they show the smallest repeatable patterns you can lift into real firmware when you need clean integration instead of ad-hoc loops.

Three practical patterns

Repository-first setup

Use this when you want a clean local source of truth and explicit control over updates.

Shell
    git clone git@github.com:ZeroBitsTech/ZeroKernel.git
cd ZeroKernel
bash scripts/run_desktop_tests.sh
  
Smallest valid runtime boot

Start from one bounded task and a visible board clock before you add queue work or network modules.

C++
    ZeroKernel.begin(boardMillis);
ZeroKernel.addTask("Sample", sampleTask, 100, 0, true);
ZeroKernel.tick();
  
PlatformIO profile lock

Pin the profile in build flags so footprint drift is intentional instead of accidental.

INI
    [env:esp32]
platform = espressif32
board = esp32dev
framework = arduino
build_flags =
  -DZEROKERNEL_PROFILE_LEAN_NET
  

What to verify while you use it

  • Validate timing before you validate aesthetics. A cleaner API is not a win if fast misses rise.
  • Prefer the smallest profile that still matches the workload, then add optional modules only when the measured payoff is obvious.
  • Keep callbacks and transport steps bounded so watchdog, panic flow, and queue limits remain meaningful.

Common mistakes that make results misleading

  • Do not copy a demo pattern into production firmware without measuring it on the real board and real build profile you plan to ship.
  • Do not read success counters without reading queue depth, timing, and workload label next to them.
  • Do not enable heavier diagnostics and compatibility flags in a lean target just because the defaults looked convenient.

Recommended working sequence

Start from the smallest valid path

Boot the runtime, register the minimum useful task set, and prove that the baseline timing is clean before adding optional layers.

Add one layer, then measure it

Introduce routing, diagnostics, or transport one layer at a time so the cost and payoff remain obvious.

Publish only repeatable results

Update docs, charts, or public claims only after the same workload survives the same validation path more than once.

Start here

This page condenses the main ZeroKernel docs into a practical setup guide: install, configure, wire tasks, choose profiles, and validate behavior with the included compare suites.

Installation

Start with actual installation paths for GitHub download, Arduino IDE, and PlatformIO before you wire any code.

Quickstart

Install the library, wire the board clock, register your first task, and run the compare scripts in the right order.

Requirements

Board families, clock assumptions, zero-heap rules, and what the runtime expects from every task.

Profiles

Choose the smallest profile that still fits your workload: POWER_SAVE, LEAN_NET, NETWORK_NODE, or diagnostic builds.

Core Runtime

Understand scheduler behavior, execution contracts, kernel states, and the real limits of the cooperative model.

tick()

See what happens in one scheduler turn, what gets drained, and why bounded work per tick matters.

addTask()

Read the task registration surface in detail, including cadence, first-run behavior, and execution contracts.

API Reference

Use a proper reference page for lifecycle calls, task control, routing, diagnostics, and operational runtime hooks.

Commands

Use the actual scripts that validate timing, enforce performance, and keep resource budgets honest.

publishDeferred

Understand bounded deferred routing, when it is safer than direct publish, and how to keep queue cost under control.

Topic Keys

Move from legacy strings to key-first routing so the hot path stays lean and deterministic.

Watchdog

See heartbeat rules, failure budgets, panic escalation, and how the runtime exposes a fault before it becomes silent.

Configuration

Tune compile-time flags, choose the correct profile, and keep conflicting settings out of your build.

Network Modules

See exactly what the optional transport modules do, what they cost, and then drill into each module on its own page.

Examples

See what each reference workload is proving before you wire ZeroKernel into a real project.

Validation

Follow the same repeatable order every time so your published numbers are credible and reproducible.

FAQ

Understand the trade-offs: cooperative limits, timing claims, transport modules, and what is still beta.

Quick start

C++
    #include <ZeroKernel.h>

unsigned long boardMillis() {
  return millis();
}

void sampleTask() {
  // bounded sensor work
}

void setup() {
  ZeroKernel.begin(boardMillis);
  ZeroKernel.addTask("Sample", sampleTask, 100, 0, true);
}

void loop() {
  ZeroKernel.tick();
}
  

Module status

ZeroTransportMetrics

Transport counters, queue depth, retry visibility

ESP32 Stable / ESP8266 BETA
ZeroHttpPump

Cooperative HTTP step pump with bounded retries

ESP32 Stable / ESP8266 BETA
ZeroMqttPump

Cooperative MQTT publish pump with queue control

ESP32 Stable / ESP8266 BETA
ZeroWiFiMaintainer

Reconnect pacing, state topic, capability-aware link gating

ESP32 Stable / ESP8266 BETA
Core runtime

Scheduler, watchdog, commands, events, safe mode, panic flow

Stable

Validation commands

Shell
    bash scripts/run_desktop_tests.sh
  
Shell
    bash scripts/run_desktop_benchmark.sh --enforce-performance
  
Shell
    bash scripts/run_resource_matrix.sh --enforce-budget
  
Shell
    bash scripts/run_workload_matrix.sh
  
Shell
    bash scripts/run_esp32_env_monitor_compare.sh /dev/ttyUSB1
  
Shell
    bash scripts/run_esp32_gateway_compare.sh /dev/ttyUSB1
  
Shell
    bash scripts/run_esp32_industrial_compare.sh /dev/ttyUSB1
  

Overview FAQ

Should I start on the overview page or jump to quickstart?

Read this page once for the mental model, then move directly to quickstart for actual setup.

Is this enough to ship production firmware?

Use these pages as the foundation, then validate on your exact board, transport path, and workload before calling a build production-ready.

What is the safest way to validate this page on real hardware?

Start from the leanest profile that still matches the topic, run the narrowest compare script for this behavior, and only then move to heavier mixed workloads. Do not jump straight to a fully loaded build if the base timing is not yet proven.