From e1558b4487e397d6a42499b1bee4a5c6f48d1c42 Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Fri, 20 Nov 2020 14:17:54 +0100 Subject: [PATCH 1/5] makefiles/tools/qemu: add common qemu makefile --- makefiles/tools/qemu.inc.mk | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 makefiles/tools/qemu.inc.mk diff --git a/makefiles/tools/qemu.inc.mk b/makefiles/tools/qemu.inc.mk new file mode 100644 index 0000000000..9644dfcee5 --- /dev/null +++ b/makefiles/tools/qemu.inc.mk @@ -0,0 +1,9 @@ +EMULATOR ?= qemu-system-arm +EMULATOR_MACHINE ?= $(BOARD) +EMULATOR_MONITOR_PORT ?= 45454 +EMULATOR_MONITOR_FLAGS ?= telnet::$(EMULATOR_MONITOR_PORT),server,nowait + +EMULATOR_FLAGS = -machine $(EMULATOR_MACHINE) -device loader,file=$(ELFFILE) \ + -serial stdio \ + -monitor $(EMULATOR_MONITOR_FLAGS) \ + -nographic From 8560d13410bd2631b517a5cc16012b0fa832eb6d Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Fri, 20 Nov 2020 14:18:18 +0100 Subject: [PATCH 2/5] boards/microbit: use common qemu include --- boards/microbit/Makefile.include | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/boards/microbit/Makefile.include b/boards/microbit/Makefile.include index ec6606b587..c3fa25ff60 100644 --- a/boards/microbit/Makefile.include +++ b/boards/microbit/Makefile.include @@ -12,11 +12,7 @@ else ifeq (pyocd,$(PROGRAMMER)) endif # QEMU 4.0 added microbit system emulation. -EMULATOR = qemu-system-arm -EMULATOR_FLAGS = -M microbit -device loader,file=$(ELFFILE) \ - -serial stdio \ - -monitor telnet::45454,server,nowait \ - -nographic +include $(RIOTMAKE)/tools/qemu.inc.mk # include nrf51 boards common configuration include $(RIOTBOARD)/common/nrf51/Makefile.include From 19590a9f74c8295ac80780e165871142f183e3d7 Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Fri, 20 Nov 2020 14:21:55 +0100 Subject: [PATCH 3/5] Makefile.include: include emulator logic when emulate target is used --- Makefile.include | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Makefile.include b/Makefile.include index 350d15fd08..e3dd7383d3 100644 --- a/Makefile.include +++ b/Makefile.include @@ -395,6 +395,13 @@ include $(BOARDDIR)/Makefile.include INCLUDES += -I$(RIOTCPU)/$(CPU)/include include $(RIOTCPU)/$(CPU)/Makefile.include +# Include emulator code if available and if emulate target is used +ifneq (,$(filter emulate,$(MAKECMDGOALS))) + # Use renode as default emulator + RIOT_EMULATOR ?= renode + -include $(RIOTMAKE)/tools/$(RIOT_EMULATOR).inc.mk +endif + # Assume GCC/GNU as supported toolchain if CPU's Makefile.include doesn't # provide this macro TOOLCHAINS_SUPPORTED ?= gnu From 85765e1e33b07d64b077bec1a39bf2e092af3cc8 Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Fri, 20 Nov 2020 14:22:37 +0100 Subject: [PATCH 4/5] boards/cc2538dk: remove useless include of renode --- boards/cc2538dk/Makefile.include | 3 --- 1 file changed, 3 deletions(-) diff --git a/boards/cc2538dk/Makefile.include b/boards/cc2538dk/Makefile.include index aa93b15f7c..966f546ddf 100644 --- a/boards/cc2538dk/Makefile.include +++ b/boards/cc2538dk/Makefile.include @@ -6,7 +6,4 @@ PROGRAMMER_SERIAL ?= 06EB PORT_LINUX ?= $(word 2,$(shell $(RIOTTOOLS)/usb-serial/find-tty.sh '^$(PROGRAMMER_SERIAL)')) PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbserial*))) -# setup emulator -include $(RIOTMAKE)/tools/renode.inc.mk - include $(RIOTBOARD)/common/cc2538/Makefile.include From ba8825928eac4f1a9d6fe1732e1968e39f373c7e Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Fri, 20 Nov 2020 14:23:23 +0100 Subject: [PATCH 5/5] boards/microbit: use qemu as default emulator --- boards/microbit/Makefile.include | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boards/microbit/Makefile.include b/boards/microbit/Makefile.include index c3fa25ff60..388569066b 100644 --- a/boards/microbit/Makefile.include +++ b/boards/microbit/Makefile.include @@ -12,7 +12,7 @@ else ifeq (pyocd,$(PROGRAMMER)) endif # QEMU 4.0 added microbit system emulation. -include $(RIOTMAKE)/tools/qemu.inc.mk +RIOT_EMULATOR ?= qemu # include nrf51 boards common configuration include $(RIOTBOARD)/common/nrf51/Makefile.include