aboutsummaryrefslogtreecommitdiffstats
path: root/usr/build.sh
diff options
context:
space:
mode:
authoruser <user@clank>2026-07-18 00:38:38 +0200
committeruser <user@clank>2026-07-18 00:38:38 +0200
commitba2d7ae1d7b319645b10aaa31a7f664f9f80c25c (patch)
treee01e6c7c710a661defe2515ff9657f08cddcb283 /usr/build.sh
parenttools: gbtype prints hub errors to stderr and exits 1 (diff)
downloadgbos-ba2d7ae1d7b319645b10aaa31a7f664f9f80c25c.tar.gz
gbos-ba2d7ae1d7b319645b10aaa31a7f664f9f80c25c.tar.xz
gbos-ba2d7ae1d7b319645b10aaa31a7f664f9f80c25c.zip
refactor: c/ -> usr/, compiled program blobs out of the source tree
Userland sources live in usr/ (fits the Unix theme better than 'c'). SDCC output .bin blobs land in build/usr/ with the other build artifacts instead of littering the source dir; programs.asm INCBINs them from there. Byte-identical ROM.
Diffstat (limited to '')
-rwxr-xr-xusr/build.sh (renamed from c/build.sh)14
1 files changed, 7 insertions, 7 deletions
diff --git a/c/build.sh b/usr/build.sh
index 8034d87..93815d2 100755
--- a/c/build.sh
+++ b/usr/build.sh
@@ -1,15 +1,15 @@
#!/bin/sh
# Build a gbos C program into a self-contained 16 KiB ROM-bank image.
# SDCC native toolchain; crt0 linked FIRST so _start is the $4000 entry.
-# usage: c/build.sh <prog.c> <out.bin>
+# usage: usr/build.sh <prog.c> <out.bin> (run from the repo root)
set -e
-SRC="$1"; OUT="$2"; B=build/c
+SRC="$1"; OUT="$2"; B=build/usr/obj
LIBDIR=/usr/share/sdcc/lib/sm83
-mkdir -p "$B"
-sdasgb -o "$B/crt0.rel" c/crt0.s
-sdasgb -o "$B/libc.rel" c/libc.s
-sdcc -msm83 -c -Ic c/libc.c -o "$B/libc_c.rel"
-sdcc -msm83 -c -Ic "$SRC" -o "$B/prog.rel"
+mkdir -p "$B" "$(dirname "$OUT")"
+sdasgb -o "$B/crt0.rel" usr/crt0.s
+sdasgb -o "$B/libc.rel" usr/libc.s
+sdcc -msm83 -c -Iusr usr/libc.c -o "$B/libc_c.rel"
+sdcc -msm83 -c -Iusr "$SRC" -o "$B/prog.rel"
# link: crt0 first (=> _start at 0x4000), then libc, program, and sm83 lib
sdldgb -n -m -w -j -i "$B/prog.ihx" \
-b _CODE=0x4000 -b _DATA=0xa000 \