Open an issue with:
- What happened (expected vs actual response from the socket)
- The exact command that triggered it
- Platform (
-Dplatform=value) and Zig version (zig version) - Whether it is a real-hardware or QEMU run
- Fork → branch → PR.
- Keep commits atomic with clear messages.
zig build testmust pass.zig build -Dplatform=qemu_amd64 testmust pass (cross-platform commands are tested on every platform).- No hidden allocations in hot paths — stack and compile-time buffers only.
- No
unsafeequivalent: avoid@ptrCast/@intToPtroutside of explicit C-interop (i.e.,@cImportblocks).
# Native FreeBSD 15.1 host or cross-compilation from any host with Zig 0.15+
# QEMU dev loop (default)
zig build
# Run tests
zig build test
# Cross-compile for Banana Pi BPI-M64 (Chimp v0.2)
zig build -Dtarget=aarch64-freebsd.15.1 -Dplatform=bpi_m64
# Cross-compile for PinePhone (Porcupine v0.3)
zig build -Dtarget=aarch64-freebsd.15.1 -Dplatform=pinephoneThe resulting binary is zig-out/bin/bsdos-hal. Copy it to the target device
and run as root:
./bsdos-hal &
echo "hal_version" | nc -U /var/run/bsdos-hal.sock- Add a variant to the
Platformenum insrc/platform.zig. - Wire up the
std.mem.eqlbranch in thecurrentcomptime block. - Set the
has_*flags for the new platform (follow existing patterns). - Set
i2c_sensor_busfor the new platform if it has I2C. - Add a row to the platform table in
README.md. - Add a row to the capability table in
README.md. zig build -Dplatform=<new_platform> testmust pass.
- Write the handler function in
src/main.zigwith apurpose/input/output/sideEffectscontract comment (see existing functions for the pattern). - Add it to
processTextCmd— cross-platform commands go in the first block; platform-gated commands go inside the appropriateif (comptime platform.has_*)block. - If the command is platform-gated, add it to the
gatedlist inisPlatformGatedCmdso it returns"unsupported on <platform>"instead of"unknown"on platforms that lack it. - Add a unit test in
src/main.zigcovering at least: success case, missing argument case, invalid argument case. - Update the Commands table in
README.md.
- All structs
packedorextern, explicitly aligned to 64 bytes where used in data paths (cache-line alignment for Cortex-A53). comptimefor lookup tables and state machine layouts.- Errors handled explicitly — never ignore a result.
- Response buffers are 4 KiB stack slices (
var buf: [4096]u8 = undefined); responses must fit within that limit.
By contributing, you agree that your contributions are licensed under MIT.