feat: publish FreeRTOS C FC02 card

This commit is contained in:
2026-07-19 16:36:02 +02:00
commit e3420748ee
208 changed files with 57240 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
#!/usr/bin/env sh
set -eu
nm=${RISCV_NM:-riscv64-unknown-elf-nm}
readelf=${RISCV_READELF:-riscv64-unknown-elf-readelf}
elf=build/task01_first_task/prog.elf
if "$nm" --defined-only "$elf" | awk '{print $3}' | grep -Eq '^_Z|^__cxa_|^_Unwind_'; then
echo "unexpected C++ or unwind symbol in the C teaching ELF" >&2
exit 1
fi
if "$readelf" -S "$elf" | grep -Eq '\.init_array|\.eh_frame|\.gcc_except_table'; then
echo "unexpected C++ initialization or unwind section in $elf" >&2
"$readelf" -S "$elf" >&2
exit 1
fi
for symbol in sum_task_entry supervisor_task_entry task01_debug_checkpoint task01_debug_checkpoint_committed xTaskCreate vTaskDelete; do
if ! "$nm" --defined-only "$elf" | grep -Eq "[[:space:]]${symbol}$"; then
echo "required C/FreeRTOS symbol is missing: $symbol" >&2
exit 1
fi
done
echo "PASS ABI: freestanding C11 task callback, no C++ runtime or mangled symbols"
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env sh
set -eu
tb=${1:?usage: check_determinism.sh /path/to/tb [build-dir]}
build_dir=${2:-build}
artifact="$build_dir/task01_first_task/prog.bin"
reference="$build_dir/determinism-1.log"
run_once() {
output=$1
"$tb" --bin "$artifact" --cycles 2000000 --cpuret >"$output"
}
run_once "$reference"
run_once "$build_dir/determinism-2.log"
run_once "$build_dir/determinism-3.log"
cmp "$reference" "$build_dir/determinism-2.log"
cmp "$reference" "$build_dir/determinism-3.log"
echo "PASS determinism: three clean Hazard3 processes produced identical evidence"
+40
View File
@@ -0,0 +1,40 @@
#!/usr/bin/env sh
set -eu
cpp_card=${CPP_CARD:-../lab-rv32i-freertos-task-stack-vector}
contract=config/paired-experiment.json
test -f "$cpp_card/include/FreeRTOSConfig.h" || {
echo "paired K02 not found at $cpp_card" >&2
exit 1
}
cmp include/FreeRTOSConfig.h "$cpp_card/include/FreeRTOSConfig.h"
cmp vendor/FreeRTOS-Kernel/UPSTREAM.md "$cpp_card/vendor/FreeRTOS-Kernel/UPSTREAM.md"
check_hash() {
path=$1
key=$2
expected=$(jq -r ".kernel.files_sha256[\"$key\"]" "$contract")
actual=$(sha256sum "$path" | awk '{print $1}')
test "$actual" = "$expected" || {
echo "pair contract hash mismatch: $path" >&2
exit 1
}
}
check_hash vendor/FreeRTOS-Kernel/tasks.c tasks.c
check_hash vendor/FreeRTOS-Kernel/list.c list.c
check_hash vendor/FreeRTOS-Kernel/portable/MemMang/heap_4.c heap_4.c
check_hash vendor/FreeRTOS-Kernel/portable/GCC/RISC-V/port.c port.c
check_hash vendor/FreeRTOS-Kernel/portable/GCC/RISC-V/portASM.S portASM.S
config_hash=$(sha256sum include/FreeRTOSConfig.h | awk '{print $1}')
test "$config_hash" = "$(jq -r .config.sha256 "$contract")"
grep -Fq 'work_limit = 20000U' "$cpp_card/src/tasks/task01_task_wrapper.cpp"
grep -Fq 'expected_sum = 200010000U' "$cpp_card/src/tasks/task01_task_wrapper.cpp"
grep -Fq 'worker_stack_words = 256U' "$cpp_card/src/tasks/task01_task_wrapper.cpp"
grep -Fq 'supervisor_stack_words = 160U' "$cpp_card/src/tasks/task01_task_wrapper.cpp"
echo "PASS pair: kernel/config/workload/stack contract matches K02 C++"
+52
View File
@@ -0,0 +1,52 @@
#!/usr/bin/env sh
set -eu
script_dir=$(CDPATH= cd "$(dirname "$0")" && pwd)
repo_root=$(CDPATH= cd "$script_dir/.." && pwd)
tex_path="$repo_root/doc/generated/main.tex"
read_tex_command() {
sed -n "s/^\\\\newcommand{\\\\$1}{\\([^}]*\\)}$/\\1/p" "$tex_path" | head -n 1
}
publisher=mpabi
area=inf
series=$(read_tex_command CardSeries)
number=$(read_tex_command CardNumber)
slug=$(read_tex_command CardSlug)
version=$(read_tex_command CardVersion)
uuid=$(read_tex_command DocumentUUID)
if [ -z "$publisher" ] || [ -z "$area" ] || [ -z "$series" ] || \
[ -z "$number" ] || [ -z "$slug" ] || [ -z "$version" ] || [ -z "$uuid" ]; then
echo "missing card metadata in $tex_path" >&2
exit 1
fi
commit=${GITEA_SHA:-${GITHUB_SHA:-}}
if [ -z "$commit" ]; then
git_root=$(git -C "$repo_root" rev-parse --show-toplevel 2>/dev/null || true)
if [ "$git_root" = "$repo_root" ]; then
commit=$(git -C "$repo_root" rev-parse HEAD)
else
commit=local
fi
fi
short_commit=$(printf '%s' "$commit" | cut -c1-12)
meta="$repo_root/doc/build-meta.tex"
trap 'rm -f "$meta"' EXIT HUP INT TERM
printf '\\newcommand{\\BuildCommit}{%s}\n' "$short_commit" > "$meta"
out="$repo_root/doc/pdf"
mkdir -p "$out"
find "$out" -maxdepth 1 -type f -name '*.pdf' -delete
(
cd "$repo_root/doc/generated"
latexmk -pdf -interaction=nonstopmode -halt-on-error -outdir="$out" main.tex
)
target="$out/$publisher-$area-$series-$number-$slug-$version-$uuid.pdf"
mv "$out/main.pdf" "$target"
find "$out" -maxdepth 1 -type f \( -name '*.aux' -o -name '*.log' -o \
-name '*.out' -o -name '*.fls' -o -name '*.fdb_latexmk' \) -delete
printf '%s\n' "$target"
+8
View File
@@ -0,0 +1,8 @@
#!/usr/bin/env sh
set -eu
tb=${1:?usage: run_sim.sh /path/to/tb [build-dir]}
build_dir=${2:-build}
echo "== task01_first_task =="
"$tb" --bin "$build_dir/task01_first_task/prog.bin" --cycles 2000000 --cpuret