Files
LithosAnanake/Kconfig.heartbeat
T
rajamesandJunie a8b70e88d3 Reorganize source tree: kernel/, v3/, v4/ split and board infrastructure
Source tree reorganization:
- Move StarForth v3 engine to v3/ (src/, include/, Makefile)
- Move kernel to kernel/ (src/, include/, linker/, Makefile)
- Create v4/ skeleton for F18-ISA golden model (DECOMPOSITION.md, JUSTIFICATION.md)
- Move FABRIC-0..4.md to docs/fabric/
- Move ONTOLOGY.md and ROADMAP.md to docs/

Board infrastructure:
- Add boards/ser5/, boards/raspi/, boards/milkv/, boards/zynq7020/
- Each board has board.mk (ISA, CPU flags, boot recipe) and README.md
- Root Makefile becomes thin dispatcher: boot_image, all, clean, docs take TARGET
- make boot_image TARGET=SER5|RASPI|MILKV builds one GPT/MBR image per board
- ZYNQ7020 target exists but stops with clear error (ARMv7 port not built yet)
- scripts/mkdiskimage.sh builds disk images for all boards

Docs pipeline:
- docs/book/ with LaTeX master (main.tex) and Makefile
- pandoc converts Markdown to LaTeX at build time
- Two Lua filters: table-widths.lua (wide tables wrap), code-breaks.lua (inline code breaks)
- make docs builds single PDF (754 pages, 0 missing characters)
- make docs TARGET=<board> adds board appendix
- build/docs/<book|board>/meta.tex stamps git commit into PDF

Bug fixes:
- 42 include paths that only worked by accident now use correct relative paths
- clang-18 hardcode replaced with configurable CC variable (fixed aarch64 build)
- Pi 5: kernel_2712.img linked at 0x80000, .bss zeroed, memory reserved
- Doxyfile, .clang-tidy, README.md, Kconfig paths updated

Verified:
- Hosted v3 build passes 1012 tests, 0 failures
- SER5 image boots in QEMU (OVMF), POST passes, K exact (65536 = Q48_ONE)
- Milk-V image boots in QEMU (OpenSBI + U-Boot + bootefi), POST passes
- make clean TARGET=<board> removes only that board and its ISA objects
- make all builds all boards, hosted v3, and docs in one run

Co-authored-by: Junie <junie@jetbrains.com>
2026-10-01 15:40:09 -04:00

86 lines
3.9 KiB
Plaintext

menu "Heartbeat / adaptive tick coordinator"
config HEARTBEAT_THREAD_ENABLED
bool "Run vm_tick() in a background thread (HEARTBEAT_THREAD_ENABLED)"
depends on STARFORTH_VARIANT_HOSTED
default y
help
y = OPTIMAL: vm_tick() runs in a dedicated background thread.
n = legacy inline tick, driven from the main interpreter loop.
Kernel-build resolution (Phase 4 of the Kconfig migration, the
phase's named verification target): `depends on
STARFORTH_VARIANT_HOSTED` above means this symbol is invisible for
a kernel-variant config -- CONFIG_HEARTBEAT_THREAD_ENABLED simply
never appears in a kernel .config/auto.conf, so
mk/Kconfig.mk's kconfig_bool bridge resolves it to 0 for kernel
builds without needing a special case. This is UI/model
correctness (menuconfig can't offer a choice LithosAnanke has no
way to honor -- there are no pthreads in a freestanding kernel),
not the sole enforcement mechanism: kernel/Makefile additionally
keeps its own unconditional `VM_FEATURE_OVERRIDES +=
-DHEARTBEAT_THREAD_ENABLED=0` post-override exactly as it was
before this migration. Deliberately redundant with the `depends
on` above -- the Kconfig model documents *why* the kernel can't
offer this choice, the Makefile-level override *guarantees* the
kernel never ships with a threaded heartbeat even if the Kconfig
tree, a hand-edited auto.conf, or a future refactor ever
disagrees. Belt-and-suspenders on purpose: the failure mode this
guards against (a freestanding kernel image linking against
pthreads that don't exist) is silent-until-boot and expensive to
debug on real hardware, not the kind of thing to trust to a single
layer.
config HEARTBEAT_TICK_NS
int "Heartbeat thread wake period, nanoseconds (HEARTBEAT_TICK_NS)"
depends on HEARTBEAT_THREAD_ENABLED
default 10000
help
Background heartbeat thread wake frequency (default 10000ns = 1ms).
Only meaningful when HEARTBEAT_THREAD_ENABLED is on.
config HEARTBEAT_CHECK_FREQUENCY
int "Word-execution gate for a tick, executions (HEARTBEAT_CHECK_FREQUENCY)"
default 256
help
vm_tick() is gated by executed-word count, not just wall time --
this is how many word executions must occur between heartbeat
checks. This is also, note well, the same counter that makes
vm->heartbeat.tick_count a purely execution-driven virtual clock
(see docs/working/architecture/VM-FLEET-ATTRACTOR-DESIGN-20260705.md,
rev t) -- the value Loop #3 heat decay reads instead of real
nanoseconds, to keep dict_hash architecture-invariant.
config HEARTBEAT_WINDOW_TUNING_FREQUENCY
int "Rolling window width re-tune interval, ticks (HEARTBEAT_WINDOW_TUNING_FREQUENCY)"
default 1000
help
How many heartbeat ticks between Loop #5 (window width inference)
runs.
config HEARTBEAT_SLOPE_VALIDATION_FREQUENCY
int "Decay slope re-validation interval, ticks (HEARTBEAT_SLOPE_VALIDATION_FREQUENCY)"
default 5000
help
How many heartbeat ticks between Loop #6 (decay slope inference)
revalidation runs.
config EMERGENCY_CONSOLE_ENABLED
bool "Interactive fault handler / debug-escape REPL (EMERGENCY_CONSOLE_ENABLED)"
default n
help
Decided 2026-09-05: no console for the running system unless a
thumbdrive is present -- n (the new default) is the production/
high-security posture. When n: the kernel boots headless (no
banner, no prompt, no interactive surface at all) until a real
identity logs in via an attached thumbdrive (a regular user's
WIREBIND login or Zuse's own attach/genesis-mint -- neither is
special), and a runtime error halts the VM rather than handing
control back to an interactive console (no fallthrough surface).
Set to y only for debugging/recovery builds: the kernel shows its
interactive console immediately at boot regardless of any
thumbdrive, and REPL errors recover and continue instead of
halting. Applies to both the hosted VM and the kernel build.
endmenu