feat: add lab-rv32i-freertos-heap-models card
This commit is contained in:
Executable
+50
@@ -0,0 +1,50 @@
|
||||
#!/usr/bin/env sh
|
||||
set -eu
|
||||
|
||||
nm=${RISCV_NM:-riscv64-unknown-elf-nm}
|
||||
readelf=${RISCV_READELF:-riscv64-unknown-elf-readelf}
|
||||
elf=build/task01_heap_models/prog.elf
|
||||
heap_object=build/common/cpp_heap.o
|
||||
|
||||
if "$nm" -C -u "$elf" | grep -Eq '__cxa_|_Unwind_|std::|libstdc\+\+'; then
|
||||
echo "unexpected hosted C++ runtime dependency in $elf" >&2
|
||||
"$nm" -C -u "$elf" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if "$nm" -C --defined-only "$elf" | grep -Eq \
|
||||
'vtable for|typeinfo for|typeinfo name for'; then
|
||||
echo "unexpected virtual dispatch or RTTI metadata in $elf" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if "$readelf" -S "$elf" | grep -Eq \
|
||||
'\.init_array|\.eh_frame|\.gcc_except_table'; then
|
||||
echo "unexpected initializer, exception, or unwind section in $elf" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for symbol in \
|
||||
'operator new(unsigned int)' \
|
||||
'operator new[](unsigned int)' \
|
||||
'operator delete(void*)' \
|
||||
'operator delete[](void*)' \
|
||||
'operator delete(void*, unsigned int)' \
|
||||
'operator delete[](void*, unsigned int)'
|
||||
do
|
||||
if ! "$nm" -C --defined-only "$heap_object" | grep -Fq "$symbol"; then
|
||||
echo "missing allocation function: $symbol" >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
for symbol in heap_models_debug_checkpoint g_fragmented_stats g_final_stats
|
||||
do
|
||||
if ! "$nm" --defined-only "$elf" | grep -Fq "$symbol"; then
|
||||
echo "missing debugger evidence symbol: $symbol" >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
echo "PASS ABI: complete new/delete bridge and zero hosted C++ runtime"
|
||||
|
||||
Executable
+47
@@ -0,0 +1,47 @@
|
||||
#!/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/main.tex"
|
||||
|
||||
read_tex_command() {
|
||||
sed -n "s/^\\\\newcommand{\\\\$1}{\\([^}]*\\)}$/\\1/p" "$tex_path" | head -n 1
|
||||
}
|
||||
|
||||
publisher=$(read_tex_command PublisherDomain)
|
||||
area=$(read_tex_command CardArea)
|
||||
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
|
||||
commit=$(git -C "$repo_root" rev-parse HEAD 2>/dev/null || printf '%s' uncommitted)
|
||||
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"
|
||||
(
|
||||
cd "$repo_root/doc"
|
||||
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"
|
||||
Executable
+10
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env sh
|
||||
set -eu
|
||||
|
||||
tb=${1:?usage: run_sim.sh /path/to/tb [build-dir]}
|
||||
build_dir=${2:-build}
|
||||
|
||||
echo "== task01_heap_models =="
|
||||
"$tb" --bin "$build_dir/task01_heap_models/prog.bin" \
|
||||
--cycles 400000 --cpuret
|
||||
|
||||
Executable
+15
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env sh
|
||||
set -eu
|
||||
|
||||
cxx=${CXX_HOST:-c++}
|
||||
build_dir=${1:-host-build}
|
||||
mkdir -p "$build_dir"
|
||||
|
||||
$cxx -std=c++17 -Wall -Wextra -Werror -pedantic \
|
||||
-fsanitize=address,undefined -fno-omit-frame-pointer \
|
||||
-Itests/host-shim -Iinclude \
|
||||
tests/heap_stats_host.cpp -o "$build_dir/heap_stats_host"
|
||||
|
||||
ASAN_OPTIONS=detect_leaks=1 "$build_dir/heap_stats_host"
|
||||
echo "PASS host: HeapStats mapping and watermark history"
|
||||
|
||||
Reference in New Issue
Block a user