build: generated presets and a check entry point
tools/make_presets.py emits the uniform pipeline the hand-grown file had drifted from — generated configure/build/test presets and workflows for all 37 chips, reflect configure/build for libavr's 12-chip spot set — and tools/check.sh runs every chip's workflow (--full adds the reflect spot) as the port's gate. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
37
tools/check.sh
Executable file
37
tools/check.sh
Executable file
@@ -0,0 +1,37 @@
|
||||
#!/bin/bash
|
||||
# The port's gate: every chip's generated workflow — build, size matrix, and
|
||||
# the simulator-driven protocol suites. --full adds the reflect-spot builds
|
||||
# (libavr's rule: reflect compiles are bounded to its spot set, never the
|
||||
# full matrix). LIBAVR_ROOT must point at the libavr checkout.
|
||||
set -e
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
full=0
|
||||
[[ "$1" == "--full" ]] && { full=1; shift; }
|
||||
|
||||
CHIPS=(attiny13 attiny13a attiny25 attiny45 attiny85
|
||||
atmega8 atmega8a atmega16 atmega16a atmega32 atmega32a
|
||||
atmega48 atmega48a atmega48p atmega48pa
|
||||
atmega88 atmega88a atmega88p atmega88pa
|
||||
atmega168 atmega168a atmega168p atmega168pa
|
||||
atmega328 atmega328p
|
||||
atmega164a atmega164p atmega164pa
|
||||
atmega324a atmega324p atmega324pa
|
||||
atmega644 atmega644a atmega644p atmega644pa
|
||||
atmega1284 atmega1284p)
|
||||
REFLECT_SPOT=(attiny13a attiny85 atmega8 atmega16a atmega32a atmega48pa
|
||||
atmega88 atmega168pa atmega328p atmega164a atmega644p atmega1284)
|
||||
|
||||
for chip in "${CHIPS[@]}"; do
|
||||
echo "==== $chip ===="
|
||||
cmake --workflow --preset "$chip-generated" "$@"
|
||||
done
|
||||
|
||||
if ((full)); then
|
||||
for chip in "${REFLECT_SPOT[@]}"; do
|
||||
echo "==== $chip reflect ===="
|
||||
cmake --workflow --preset "$chip-reflect" "$@"
|
||||
done
|
||||
fi
|
||||
|
||||
echo "check: every chip green"
|
||||
90
tools/make_presets.py
Executable file
90
tools/make_presets.py
Executable file
@@ -0,0 +1,90 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Regenerate CMakePresets.json — one uniform pipeline per chip.
|
||||
|
||||
Every chip gets generated-mode configure/build/test presets and a workflow
|
||||
running all three. Reflect-mode presets (configure + build, no tests — the
|
||||
port's TUs compile identically; the sims prove nothing new there) exist for
|
||||
libavr's reflect spot set only, mirroring its rule: the full reflect matrix
|
||||
is never built, one chip per hardware class and pack vintage is.
|
||||
|
||||
Run from the repo root: tools/make_presets.py
|
||||
"""
|
||||
|
||||
import json
|
||||
import os
|
||||
|
||||
CHIPS = [
|
||||
"attiny13", "attiny13a", "attiny25", "attiny45", "attiny85",
|
||||
"atmega8", "atmega8a", "atmega16", "atmega16a", "atmega32", "atmega32a",
|
||||
"atmega48", "atmega48a", "atmega48p", "atmega48pa",
|
||||
"atmega88", "atmega88a", "atmega88p", "atmega88pa",
|
||||
"atmega168", "atmega168a", "atmega168p", "atmega168pa",
|
||||
"atmega328", "atmega328p",
|
||||
"atmega164a", "atmega164p", "atmega164pa",
|
||||
"atmega324a", "atmega324p", "atmega324pa",
|
||||
"atmega644", "atmega644a", "atmega644p", "atmega644pa",
|
||||
"atmega1284", "atmega1284p",
|
||||
]
|
||||
|
||||
# libavr's REFLECT_SPOT (tools/check.sh): one chip per hardware class and
|
||||
# pack vintage.
|
||||
REFLECT_SPOT = [
|
||||
"attiny13a", "attiny85", "atmega8", "atmega16a", "atmega32a",
|
||||
"atmega48pa", "atmega88", "atmega168pa", "atmega328p", "atmega164a",
|
||||
"atmega644p", "atmega1284",
|
||||
]
|
||||
|
||||
|
||||
def main():
|
||||
configure = [{
|
||||
"name": "base",
|
||||
"hidden": True,
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build/${presetName}",
|
||||
"toolchainFile": "$env{LIBAVR_ROOT}/cmake/avr-toolchain.cmake",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release",
|
||||
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
|
||||
"CMAKE_COLOR_DIAGNOSTICS": "ON",
|
||||
},
|
||||
}]
|
||||
build, test, workflows = [], [], []
|
||||
|
||||
def add(chip, mode):
|
||||
name = f"{chip}-{mode}"
|
||||
configure.append({
|
||||
"name": name,
|
||||
"inherits": "base",
|
||||
"cacheVariables": {
|
||||
"LIBAVR_MCU": chip,
|
||||
"LIBAVR_REFLECT": "ON" if mode == "reflect" else "OFF",
|
||||
},
|
||||
})
|
||||
build.append({"name": name, "configurePreset": name})
|
||||
steps = [{"type": "configure", "name": name}, {"type": "build", "name": name}]
|
||||
if mode == "generated":
|
||||
test.append({"name": name, "configurePreset": name, "output": {"outputOnFailure": True}})
|
||||
steps.append({"type": "test", "name": name})
|
||||
workflows.append({"name": name, "steps": steps})
|
||||
|
||||
for chip in CHIPS:
|
||||
add(chip, "generated")
|
||||
for chip in REFLECT_SPOT:
|
||||
add(chip, "reflect")
|
||||
|
||||
presets = {
|
||||
"version": 8,
|
||||
"configurePresets": configure,
|
||||
"buildPresets": build,
|
||||
"testPresets": test,
|
||||
"workflowPresets": workflows,
|
||||
}
|
||||
path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "CMakePresets.json")
|
||||
with open(path, "w") as f:
|
||||
json.dump(presets, f, indent=1)
|
||||
f.write("\n")
|
||||
print(f"{len(CHIPS)} chips, {len(REFLECT_SPOT)} reflect: {os.path.normpath(path)}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user