Add sim65 tests
This commit is contained in:
@@ -30,3 +30,10 @@ test_bb_spi:
|
||||
script:
|
||||
- cd hw/fpga/simulation/modelsim/
|
||||
- vsim -do "do bb_spi_testbench.do"
|
||||
|
||||
test-sw:
|
||||
stage: test
|
||||
image: bslathi19/cc65-pipeline
|
||||
script:
|
||||
- cd sw/
|
||||
- make test
|
||||
|
||||
1
sw/.gitignore
vendored
1
sw/.gitignore
vendored
@@ -31,6 +31,7 @@ lists/
|
||||
|
||||
# Executables
|
||||
*.exe
|
||||
*.bin
|
||||
*.out
|
||||
*.app
|
||||
*.i*86
|
||||
|
||||
20
sw/Makefile
20
sw/Makefile
@@ -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
10
sw/tests/test_main.c
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user