| 1 | # -*- Mode: makefile -*- |
| 2 | # |
| 3 | # ARM SoftMMU tests - included from tests/tcg/Makefile |
| 4 | # |
| 5 | |
| 6 | ARM_SRC=$(SRC_PATH)/tests/tcg/arm/system |
| 7 | |
| 8 | # Set search path for all sources |
| 9 | VPATH += $(ARM_SRC) |
| 10 | |
| 11 | # Specific Test Rules |
| 12 | |
| 13 | test-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 -static \ |
| 17 | -T $(ARM_SRC)/$@.ld |
| 18 | |
| 19 | run-test-armv6m-undef: QEMU_OPTS=-semihosting-config enable=on,target=native,chardev=output -M microbit -kernel |
| 20 | |
| 21 | ARM_TESTS+=test-armv6m-undef |
| 22 | |
| 23 | # These objects provide the basic boot code and helper functions for all tests |
| 24 | CRT_OBJS=boot.o |
| 25 | |
| 26 | ARM_TEST_SRCS=$(wildcard $(ARM_SRC)/*.c) |
| 27 | ARM_TESTS+=$(patsubst $(ARM_SRC)/%.c, %, $(ARM_TEST_SRCS)) |
| 28 | |
| 29 | CRT_PATH=$(ARM_SRC) |
| 30 | LINK_SCRIPT=$(ARM_SRC)/kernel.ld |
| 31 | LDFLAGS=-Wl,-T$(LINK_SCRIPT) |
| 32 | CFLAGS+=-march=armv7-a+fp -ffreestanding -nostdlib -ggdb -O0 $(MINILIB_INC) |
| 33 | LDFLAGS+=-static -nostdlib $(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 -Wa,--noexecstack -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 | |
| 45 | memory: CFLAGS+=-DCHECK_UNALIGNED=0 |
| 46 | |
| 47 | # Running |
| 48 | QEMU_BASE_MACHINE=-M virt -cpu max -display none |
| 49 | QEMU_OPTS+=$(QEMU_BASE_MACHINE) -semihosting-config enable=on,target=native,chardev=output -kernel |
| 50 | |
| 51 | # console test is manual only |
| 52 | QEMU_SEMIHOST=-serial none -chardev stdio,mux=on,id=stdio0 -semihosting-config enable=on,chardev=stdio0 -mon chardev=stdio0,mode=readline |
| 53 | run-semiconsole: QEMU_OPTS=$(QEMU_BASE_MACHINE) $(QEMU_SEMIHOST) -kernel |
| 54 | run-semiconsole: semiconsole |
| 55 | $(call skip-test, $<, "MANUAL ONLY") |
| 56 | $(if $(V),@printf " %-7s %s %s\n" "TO RUN" $(notdir $(QEMU)) "$(QEMU_OPTS) $<") |
| 57 | run-plugin-semiconsole-with-%: semiconsole |
| 58 | $(call skip-test, $<, "MANUAL ONLY") |
| 59 | |
| 60 | # Simple Record/Replay Test |
| 61 | .PHONY: memory-record |
| 62 | run-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 |
| 70 | run-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 | |
| 77 | EXTRA_RUNS+=run-memory-replay |
| 78 | |
| 79 | TESTS += $(ARM_TESTS) $(MULTIARCH_TESTS) |
| 80 | EXTRA_RUNS+=$(MULTIARCH_RUNS) |