From 67f3a6c9896a5651e00eb22ee6e036c536aa0587 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Fri, 22 Oct 2021 07:50:50 -0400 Subject: first draft; needs tests --- tests/Makefile | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tests/Makefile (limited to 'tests/Makefile') diff --git a/tests/Makefile b/tests/Makefile new file mode 100644 index 0000000..43d4134 --- /dev/null +++ b/tests/Makefile @@ -0,0 +1,24 @@ +DEBUG := #-DDEBUG + +LIB430COREDIR = .. + +TEST_CSRC = test.c +TEST_OUT = $(patsubst %.c,%.o,$(TEST_CSRC)) + +all: $(LIB430COREDIR)/lib430core.a $(TEST_OUT) + +$(LIB430COREDIR)/lib430core.a: + @$(MAKE) -C .. + +.c.o: + @echo "Testing" $< "..." + @msp430-elf32-gcc -T../link.ld $< -o tmp.elf -nostdlib -lgcc -lc + @msp430-elf32-objcopy -Obinary tmp.elf tmp.bin + @echo "#define TESTBIN \\" > test.h + @od -t x1 tmp.bin | awk '{for (i=2; i<=NF; i++) printf "0x" $$i ", "}' >> test.h + @printf "\n#define TESTSIZE %u \n" $$(msp430-elf32-objdump tmp.elf -Dj .text | grep -E "^\s+[0-9a-fA-F]+:" | wc -l) >> test.h + @echo >> test.h + @gcc -Os -ggdb -g3 -Wall -W -pedantic $(DEBUG) -I../src -o tmp \ + core_test.c -L$(LIB430COREDIR) -l430core + @./tmp > log + @rm log tmp.elf tmp.bin tmp test.h -- cgit v1.2.3