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

View File

@@ -30,3 +30,10 @@ test_bb_spi:
script: script:
- cd hw/fpga/simulation/modelsim/ - cd hw/fpga/simulation/modelsim/
- vsim -do "do bb_spi_testbench.do" - vsim -do "do bb_spi_testbench.do"
test-sw:
stage: test
image: bslathi19/cc65-pipeline
script:
- cd sw/
- make test

1
sw/.gitignore vendored
View File

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

View File

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