1 # -*- Mode: makefile -*-
3 # ARM SoftMMU tests - included from tests/tcg/Makefile
6 ARM_SRC=$(SRC_PATH)/tests/tcg/arm/system
8 # Set search path for all sources
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 \
19 run-test-armv6m-undef: QEMU_OPTS=-semihosting-config enable=on,target=native,chardev=output -M microbit -kernel
21 ARM_TESTS+=test-armv6m-undef
23 # These objects provide the basic boot code and helper functions for all tests
26 ARM_TEST_SRCS=$(wildcard $(ARM_SRC)/*.c)
27 ARM_TESTS+=$(patsubst $(ARM_SRC)/%.c, %, $(ARM_TEST_SRCS))
30 LINK_SCRIPT=$(ARM_SRC)/kernel.ld
31 LDFLAGS=-Wl,-T$(LINK_SCRIPT)
32 CFLAGS+=-nostdlib -ggdb -O0 $(MINILIB_INC)
33 LDFLAGS+=-static -nostdlib $(CRT_OBJS) $(MINILIB_OBJS) -lgcc
36 .PRECIOUS: $(CRT_OBJS)
39 $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -x assembler-with-cpp -Wa,--noexecstack -c $< -o $@
41 # Build and link the tests
42 %: %.c $(LINK_SCRIPT) $(CRT_OBJS) $(MINILIB_OBJS)
43 $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS)
45 memory: CFLAGS+=-DCHECK_UNALIGNED=0
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
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")
60 # Simple Record/Replay Test
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 \
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 \
77 EXTRA_RUNS+=run-memory-replay
79 TESTS += $(ARM_TESTS) $(MULTIARCH_TESTS)
80 EXTRA_RUNS+=$(MULTIARCH_RUNS)