flowrs-engine/tools/qemu-mips-wasm/fixtures/baremetal/build.sh
flowRS 49c9d04fbc flowRS engine, cut from flowRS bd343e051a2e
Built alone from an empty CARGO_HOME, its tests passed, and flowrsc checked, ran and exported a
document from the conformance corpus; the export built alone.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-05 13:37:09 -05:00

16 lines
862 B
Shell
Executable file

#!/bin/bash
# The bare-metal fixture, built with LLVM (Homebrew's clang and ld.lld have the Mips target;
# no GCC, no vendor library): a whole-chip ELF with its own reset code and configuration words.
# build.sh <out dir>
set -euo pipefail
D=$(cd "$(dirname "$0")" && pwd)
O=${1:-$D/out}
mkdir -p "$O"
CC=/opt/homebrew/opt/llvm/bin/clang
LD=/opt/homebrew/bin/ld.lld
FLAGS="--target=mipsel-none-elf -march=mips32r2 -mabi=32 -mno-abicalls -fno-pic -G0 -msoft-float -O2 -ffreestanding -fno-builtin -Wall -Werror"
$CC $FLAGS -c "$D/start.S" -o "$O/start.o"
$CC $FLAGS -c "$D/main.c" -o "$O/main.o"
$LD -T "$D/link.ld" -nostdlib --no-pie -z max-page-size=16 "$O/start.o" "$O/main.o" -o "$O/pic32-baremetal.elf"
/opt/homebrew/opt/llvm/bin/llvm-objdump -h "$O/pic32-baremetal.elf" | grep -E "reset|config|vectors|text|data|bss"
shasum -a 256 "$O/pic32-baremetal.elf"