summaryrefslogtreecommitdiff
path: root/stn/Makefile
diff options
context:
space:
mode:
authorThomas Albers <thomas@thomaslabs.org>2023-08-14 10:47:54 +0200
committerThomas Albers <thomas@thomaslabs.org>2023-08-14 10:47:54 +0200
commitad2623d8c4bc51638343ae9a628f8647ff558155 (patch)
treed41e8390824e6fee4c02eb044c7f5acb94b478bf /stn/Makefile
Initial commitHEADmaster
Diffstat (limited to 'stn/Makefile')
-rw-r--r--stn/Makefile40
1 files changed, 40 insertions, 0 deletions
diff --git a/stn/Makefile b/stn/Makefile
new file mode 100644
index 0000000..861b459
--- /dev/null
+++ b/stn/Makefile
@@ -0,0 +1,40 @@
+ASM=crt0.asm
+SRC=stn.c
+
+OBJ=$(ASM:%.asm=build/%.rel) $(SRC:%.c=build/%.rel)
+IHX=build/stn.ihx
+TARGET=stn.hex
+
+CFLAGS=-mz80 -I../dev/include -I. --Werror
+LDFLAGS=-mz80 --no-std-crt0 --code-loc 0x4100 --data-loc 0xC000 -Wl-b_GSINIT=0x4080
+
+all : $(TARGET)
+
+build/%.rel : %.asm
+ @echo ' (AS)' $<
+ @sdcpp -P -I. -I../dev/include -DASSEMBLY $< > build/$<
+ @sdasz80 -g -o $@ build/$<
+
+build/%.rel : %.c
+ @echo ' (CC)' $<
+ @sdcc $(CFLAGS) -c -o $@ $<
+
+$(IHX) : $(OBJ)
+ @echo ' (LD)' $(OBJ)
+ @sdcc $(LDFLAGS) -o $@ $(OBJ)
+
+$(TARGET) : $(IHX)
+ @hex2bin.py $< $@
+
+.PHONY : upload
+upload :
+
+
+.PHONE : flash
+flash :
+ @zup -a 5 -P -b38400 -p /dev/ttyUSB0 "w:0:4000:$(TARGET)"
+# zup -a 5 -P -p /dev/ttyUSB0 "w:0:4000:$(TARGET)"
+
+.PHONY : clean
+clean :
+ @rm -rf build/* $(TARGET)