1# -*- Mode: makefile -*- 2# 3# ARM SoftMMU tests - included from tests/tcg/Makefile 4# 5 6ARM_SRC=$(SRC_PATH)/tests/tcg/arm/system 7 8# Set search path for all sources 9VPATH += $(ARM_SRC) 10 11# Specific Test Rules 12 13test-armv6m-undef: test-armv6m-undef.S 14 $(CC) -mcpu=cortex-m0 -mfloat-abi=soft \ 15 -Wl,--build-id=none -x assembler-with-cpp \ 16 $< -o $@ -nostdlib -N -static \ 17 -T $(ARM_SRC)/$@.ld 18 19run-test-armv6m-undef: QEMU_OPTS+=-semihosting -M microbit -kernel 20 21ARM_TESTS+=test-armv6m-undef 22 23# These objects provide the basic boot code and helper functions for all tests 24CRT_OBJS=boot.o 25 26ARM_TEST_SRCS=$(wildcard $(ARM_SRC)/*.c) 27ARM_TESTS+=$(patsubst $(ARM_SRC)/%.c, %, $(ARM_TEST_SRCS)) 28 29CRT_PATH=$(ARM_SRC) 30LINK_SCRIPT=$(ARM_SRC)/kernel.ld 31LDFLAGS=-Wl,-T$(LINK_SCRIPT) 32CFLAGS+=-nostdlib -ggdb -O0 $(MINILIB_INC) 33LDFLAGS+=-static -nostdlib -N $(CRT_OBJS) $(MINILIB_OBJS) -lgcc 34 35# building head blobs 36.PRECIOUS: $(CRT_OBJS) 37 38%.o: $(ARM_SRC)/%.S 39 $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -x assembler-with-cpp -c $< -o $@ 40 41# Build and link the tests 42%: %.c $(LINK_SCRIPT) $(CRT_OBJS) $(MINILIB_OBJS) 43 $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS) 44 45memory: CFLAGS+=-DCHECK_UNALIGNED=0 46 47# Running 48QEMU_BASE_MACHINE=-M virt -cpu max -display none 49QEMU_OPTS+=$(QEMU_BASE_MACHINE) -semihosting-config enable=on,target=native,chardev=output -kernel 50 51# console test is manual only 52QEMU_SEMIHOST=-serial none -chardev stdio,mux=on,id=stdio0 -semihosting-config enable=on,chardev=stdio0 -mon chardev=stdio0,mode=readline 53run-semiconsole: QEMU_OPTS=$(QEMU_BASE_MACHINE) $(QEMU_SEMIHOST) -kernel 54run-semiconsole: semiconsole 55 $(call skip-test, $<, "MANUAL ONLY") 56 $(if $(V),@printf " %-7s %s %s\n" "TO RUN" $(notdir $(QEMU)) "$(QEMU_OPTS) $<") 57run-plugin-semiconsole-with-%: semiconsole 58 $(call skip-test, $<, "MANUAL ONLY") 59 60# Simple Record/Replay Test 61.PHONY: memory-record 62run-memory-record: memory-record memory 63 $(call run-test, $<, \ 64 $(QEMU) -monitor none -display none \ 65 -chardev file$(COMMA)path=$<.out$(COMMA)id=output \ 66 -icount shift=5$(COMMA)rr=record$(COMMA)rrfile=record.bin \ 67 $(QEMU_OPTS) memory) 68 69.PHONY: memory-replay 70run-memory-replay: memory-replay run-memory-record 71 $(call run-test, $<, \ 72 $(QEMU) -monitor none -display none \ 73 -chardev file$(COMMA)path=$<.out$(COMMA)id=output \ 74 -icount shift=5$(COMMA)rr=replay$(COMMA)rrfile=record.bin \ 75 $(QEMU_OPTS) memory) 76 77EXTRA_RUNS+=run-memory-replay 78 79TESTS += $(ARM_TESTS) $(MULTIARCH_TESTS) 80EXTRA_RUNS+=$(MULTIARCH_RUNS) 81