Files
fantemp/README.md
BlackMark 00849d25d5 ide: the Atmel Studio solution master has, on the libavr port
master opens in Studio, so this branch should too. One project, the port's own
chip, flags mirrored by hand against the CMake build — and the acceptance is
not that it builds but that it builds the same firmware: .text (7094 B) and
.data (336 B) come out byte-identical to the CMake output from the same
sources.

libavr is found through $(LIBAVR_ROOT), the variable the CMake build already
uses, so no machine path is committed; Studio expands it from the environment.
The toolchain is named by flavour only, since nothing Studio ships can compile
-std=c++26 and the path to one that can is per-machine state.

The componentinfo file the project cannot load without is generated by
libavr's tools/atmelstudio/componentinfo.py and ignored here, as are Studio's
output directories. Release is what the flag gate compares, the presets
defining no debug build; Debug carries the -Og -gdwarf-4 pair libavr's own
debug preset uses.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-27 18:37:56 +02:00

2.0 KiB
Raw Blame History

fantemp

Temperature-controlled fan firmware (ATmega328P, 16 MHz), rewritten on libavr: thermistor on ADC0 sampled free-running and averaged over 1000 conversions, fan on OC0B at 50 kHz, 115200 Bd serial console (help lists the commands), temperature histogram persisted to EEPROM, watchdog-reset path into a boot-section bootloader.

The SteinhartHart math of the legacy firmware (runtime doubles + libm log) is gone: the Beta equation and the cubic fan curve are evaluated consteval into flash tables — the firmware itself never touches floating point.

Build against a libavr checkout:

LIBAVR_ROOT=/path/to/libavr cmake --preset atmega328p-generated
cmake --build --preset atmega328p-generated

Atmel Studio

master carries a Studio solution, so this branch does too: ide/fantemp.atsln builds the same firmware — byte-identical .text and .data to the CMake build — from the same sources, with the flags mirrored by hand. Studio finds libavr through $(LIBAVR_ROOT), the same environment variable the CMake build uses, and needs a GCC 16.1 toolchain registered as flavour avr-g++-16.1.0; nothing older can compile -std=c++26.

One generated file is required before the project will load, and one command checks the flags have not drifted (both from libavr's tools/atmelstudio/):

python $LIBAVR_ROOT/tools/atmelstudio/componentinfo.py \
    ide/fantemp.componentinfo.xml --device ATmega328P
python $LIBAVR_ROOT/tools/atmelstudio/check-flags.py --solution ide/fantemp.atsln \
    --compile-commands build/atmega328p-generated/compile_commands.json \
    --log build/atmelstudio.log

CMake remains the build system; the solution is there so the project opens in Studio as its predecessor did. Only the Release configuration is gated against CMake — the presets define no debug build — and Debug carries the -Og -gdwarf-4 pair libavr's own debug preset uses.

Legacy (yazoalfa submodules) stays on master.