diff --git a/code/boot/.gitignore b/code/boot/.gitignore index 3059021..a789783 100644 --- a/code/boot/.gitignore +++ b/code/boot/.gitignore @@ -5,3 +5,6 @@ *.s19 map.txt build/ + +# Build system generated files +src/version.s diff --git a/code/boot/README.md b/code/boot/README.md index 3b32827..ef6caf3 100644 --- a/code/boot/README.md +++ b/code/boot/README.md @@ -15,12 +15,14 @@ Make makefile is provided for building on Linux. To generate an S-Record run: ```sh +make generate make boot.s19 ``` To generate a binary run: ```sh +make generate make ``` diff --git a/code/boot/genver.sh b/code/boot/genver.sh new file mode 100755 index 0000000..0624365 --- /dev/null +++ b/code/boot/genver.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env sh + +# Script to generate version information + +# Current git tag +TAG="$(git describe --always --dirty --tags)" +DATE="$(date)" + +# Output filename +OUTFILE='src/version.s' + +sed -e "s//$TAG/g" -e "s//$DATE/g" < "$OUTFILE" +; CHIBI PC-09 Prototype #1 Boot ROM -- Version Information +; Copyright (c) 2024-2025 Amber Zeller, Gale Faraday +; Licensed under MIT + +; This file generated by genver.sh + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +;; Boot ROM Version & Build Information +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + + SECTION VERSION + + EXPORT VERMSG + +VERMSG + fcc "CHIBI PC-09 BOOT ROM " + fcb \$0A + fcn "BUILT " +EOF diff --git a/code/boot/linkscript b/code/boot/linkscript index e36add1..4139da4 100644 --- a/code/boot/linkscript +++ b/code/boot/linkscript @@ -3,3 +3,4 @@ section SERIAL section MEMTEST section VECTORS high 100000 +section VERSION high diff --git a/code/boot/makefile b/code/boot/makefile index 209c5b1..50b56be 100644 --- a/code/boot/makefile +++ b/code/boot/makefile @@ -1,6 +1,6 @@ # Makefile for CHIBI PC-09 Firmware -.PHONY: all clean +.PHONY: generate all clean .IGNORE: clean .DEFAULT_GOAL := all @@ -13,6 +13,7 @@ TARGREC := $(TARGET).s19 TARGROM := $(TARGET).bin SRCDIR := src/ BUILDDIR := build/ +GENS := $(SRCDIR)version.s SRCS := $(wildcard $(SRCDIR)*.s) OBJS := $(patsubst $(SRCDIR)%.s,$(BUILDDIR)%.o,$(SRCS)) INCS := $(wildcard $(SRCDIR)*.inc) @@ -47,6 +48,12 @@ $(OBJS): $(BUILDDIR)%.o : $(SRCDIR)%.s -@mkdir -p $(BUILDDIR) $(AS) $(ASFLAGS) -o $@ $< +generate: $(GENS) + +$(GENS): + ./genver.sh + clean: @echo 'Cleaning up intermediary files...' @rm -rv $(TARGROM) $(TARGREC) map.txt $(BUILDDIR) + @rm -rv $(GENS)