Add software files

This commit is contained in:
Byron Lathi
2022-03-05 18:48:19 -06:00
parent bc98b67ddf
commit a2fdcc5553
4 changed files with 99 additions and 0 deletions

27
sw/Makefile Normal file
View File

@@ -0,0 +1,27 @@
CC=cl65
CFLAGS=-t none
LDFLAGS=-C link.ld
NAME=main
BIN=$(NAME).bin
HEX=$(NAME).hex
SRCS=$(wildcard *.S) $(wildcard *.c)
OBJS+=$(patsubst %.S,%.o,$(filter %S,$(SRCS)))
OBJS+=$(patsubst %.c,%.o,$(filter %c,$(SRCS)))
all: $(BIN)
objcopy --input-target=binary --output-target=ihex $(BIN) $(HEX)
$(BIN): $(OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $@
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
.PHONY: clean
clean:
rm -rf $(OBJS) $(BIN) $(HEX)