Add sim65 tests

This commit is contained in:
Byron Lathi
2022-03-10 11:06:21 -06:00
parent eed7c21971
commit 6f3155cf35
4 changed files with 37 additions and 1 deletions

1
sw/.gitignore vendored
View File

@@ -31,6 +31,7 @@ lists/
# Executables
*.exe
*.bin
*.out
*.app
*.i*86

View File

@@ -1,20 +1,36 @@
CC=cl65
CFLAGS=-t none -I. --cpu "65C02"
test: CFLAGS=-t sim65c02 -I.
LDFLAGS=-C link.ld -m $(NAME).map
SIM=sim65
SIMARGS=-v -c -x 1000000
NAME=bootrom
TEST_BIN=test.bin
BIN=$(NAME).bin
HEX=$(NAME).hex
LISTS=lists
TESTS=tests
SRCS=$(wildcard *.s) $(wildcard *.c)
OBJS+=$(patsubst %.s,%.o,$(filter %s,$(SRCS)))
OBJS+=$(patsubst %.c,%.o,$(filter %c,$(SRCS)))
TEST_SRCS=$(wildcard $(TESTS)/*.s) $(wildcard $(TESTS)/*.c)
TEST_OBJS+=$(patsubst %.s,%.o,$(filter %s,$(TEST_SRCS)))
TEST_OBJS+=$(patsubst %.c,%.o,$(filter %c,$(TEST_SRCS)))
TEST_OBJS+=$(filter-out boot.o,$(filter-out main.o,$(OBJS)))
all: $(HEX)
test: $(TEST_BIN)
$(SIM) $(SIMARGS) $(TEST_BIN)
$(TEST_BIN): $(OBJS) $(TEST_OBJS)
$(CC) $(CFLAGS) $(TEST_OBJS) -o $@
$(HEX): $(BIN)
objcopy --input-target=binary --output-target=ihex $(BIN) $(HEX)
@@ -30,8 +46,10 @@ $(BIN): $(OBJS)
$(LISTS):
mkdir $(LISTS)
mkdir $(LISTS)/$(TESTS)
.PHONY: clean
clean:
rm -rf $(OBJS) $(BIN) $(HEX) $(LISTS)
rm -rf $(OBJS) $(BIN) $(HEX) $(LISTS) $(NAME).map
rm -rf $(TEST_OBJS) $(TEST_BIN)

10
sw/tests/test_main.c Normal file
View File

@@ -0,0 +1,10 @@
#include <stdio.h>
#include <spi.h>
int main(void)
{
printf("Starting spi_write_byte test...\n");
spi_write_byte(0xa5);
printf("Done!\n");
return 0;
}