mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
make: replace emulate% targets with EMULATE variable
This commit is contained in:
parent
753e13fba3
commit
08108f85b4
@ -397,11 +397,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)))
|
||||
# Include emulator code when required and if available
|
||||
ifeq (1,$(EMULATE))
|
||||
# Use renode as default emulator
|
||||
RIOT_EMULATOR ?= renode
|
||||
-include $(RIOTMAKE)/tools/$(RIOT_EMULATOR).inc.mk
|
||||
TERMDEPS += $(EMULATORDEPS)
|
||||
DEBUGDEPS += $(EMULATORDEPS)
|
||||
endif
|
||||
|
||||
# Include common serial logic to define TERMPROG, TERMFLAGS variables based on
|
||||
@ -746,20 +748,10 @@ debug-server:
|
||||
$(call check_cmd,$(DEBUGSERVER),Debug server program)
|
||||
$(DEBUGSERVER) $(DEBUGSERVER_FLAGS)
|
||||
|
||||
emulate: all $(EMULATORDEPS)
|
||||
ifeq (,$(filter term cleanterm debug%,$(MAKECMDGOALS)))
|
||||
ifeq (1,$(EMULATE))
|
||||
emulate:
|
||||
$(call check_cmd,$(EMULATOR),Emulation program)
|
||||
$(EMULATOR) $(EMULATOR_FLAGS)
|
||||
else
|
||||
@:
|
||||
endif
|
||||
|
||||
emulate-only: $(EMULATORDEPS)
|
||||
ifeq (,$(filter term cleanterm debug%,$(MAKECMDGOALS)))
|
||||
$(call check_cmd,$(EMULATOR),Emulation program)
|
||||
$(EMULATOR) $(EMULATOR_FLAGS)
|
||||
else
|
||||
@:
|
||||
endif
|
||||
|
||||
reset:
|
||||
|
3
dist/tools/emulator/debug.sh
vendored
3
dist/tools/emulator/debug.sh
vendored
@ -45,9 +45,10 @@ trap '' INT
|
||||
# start emulator GDB server
|
||||
sh -c "\
|
||||
GDB_PORT=${GDB_PORT} \
|
||||
EMULATE=1 \
|
||||
EMULATOR_PIDFILE=${EMULATOR_PIDFILE} \
|
||||
BOARD=${BOARD} \
|
||||
make -C ${APPDIR} emulate-only debug-server & \
|
||||
make -C ${APPDIR} debug-server & \
|
||||
echo \$! > ${EMULATOR_PIDFILE}" &
|
||||
# Start the debugger and connect to the GDB server
|
||||
sh -c "${DBG} ${DBG_FLAGS} ${ELFFILE}"
|
||||
|
3
dist/tools/emulator/term.sh
vendored
3
dist/tools/emulator/term.sh
vendored
@ -45,8 +45,9 @@ trap "cleanup terminal for ${EMULATOR} emulator" EXIT
|
||||
# start emulator in background
|
||||
sh -c "\
|
||||
EMULATOR_PIDFILE=${EMULATOR_PIDFILE} \
|
||||
EMULATE=1 \
|
||||
BOARD=${BOARD} \
|
||||
make -C ${APPDIR} emulate-only & \
|
||||
make -C ${APPDIR} emulate & \
|
||||
echo \$! > ${EMULATOR_PIDFILE}" &
|
||||
|
||||
# with qemu, start socat redirector in background
|
||||
|
@ -4,17 +4,19 @@ EMULATOR_MONITOR_PORT ?= 45454
|
||||
EMULATOR_MONITOR_FLAGS ?= telnet::$(EMULATOR_MONITOR_PORT),server,nowait
|
||||
FLASHFILE ?= $(ELFFILE)
|
||||
|
||||
QEMU_SERIAL_TCP_PORT ?= 5555
|
||||
EMULATOR_FLAGS = -machine $(EMULATOR_MACHINE) -device loader,file=$(ELFFILE) \
|
||||
-serial telnet::5555,server,nowait,nodelay \
|
||||
-serial telnet::$(QEMU_SERIAL_TCP_PORT),server,nowait,nodelay \
|
||||
-monitor $(EMULATOR_MONITOR_FLAGS) \
|
||||
-nographic
|
||||
|
||||
# Configure the qemu terminal access
|
||||
PORT = /tmp/riot_$(APPLICATION)_$(BOARD)_uart
|
||||
EMULATOR_SERIAL_PORT ?= /tmp/riot_$(APPLICATION)_$(BOARD)_uart
|
||||
PORT = $(EMULATOR_SERIAL_PORT)
|
||||
RIOT_TERMPROG := $(TERMPROG)
|
||||
RIOT_TERMFLAGS := $(TERMFLAGS)
|
||||
TERMPROG := $(RIOTTOOLS)/emulator/term.sh
|
||||
TERMFLAGS := $(RIOT_EMULATOR) $(BOARD) $(APPDIR) $(RIOT_TERMPROG) '$(RIOT_TERMFLAGS)' $(PORT)
|
||||
TERMFLAGS := $(RIOT_EMULATOR) $(BOARD) $(APPDIR) $(RIOT_TERMPROG) '$(RIOT_TERMFLAGS)' $(EMULATOR_SERIAL_PORT)
|
||||
|
||||
# Configure the debugger
|
||||
GDB_PORT ?= 3333
|
||||
@ -26,3 +28,7 @@ DEBUGSERVER_FLAGS ?= $(QEMU_DEBUG_FLAGS)
|
||||
|
||||
DEBUGGER_FLAGS ?= $(BOARD) $(APPDIR) $(ELFFILE) $(GDB_PORT)
|
||||
DEBUGGER ?= $(RIOTTOOLS)/emulator/debug.sh
|
||||
|
||||
# No flasher available with qemu emulator
|
||||
FLASHER ?=
|
||||
FFLAGS ?=
|
||||
|
@ -30,19 +30,21 @@ ifneq (1,$(RENODE_SHOW_GUI))
|
||||
endif
|
||||
|
||||
# Configure local serial port
|
||||
PORT = /tmp/riot_$(APPLICATION)_$(BOARD)_uart
|
||||
RENODE_CONFIG_FLAGS += -e "emulation CreateUartPtyTerminal \"term\" \"$(PORT)\" true"
|
||||
RENODE_CONFIG_FLAGS += -e "connector Connect sysbus.uart0 term"
|
||||
RENODE_SYSBUS_UART ?= sysbus.uart0
|
||||
EMULATOR_SERIAL_PORT ?= /tmp/riot_$(APPLICATION)_$(BOARD)_uart
|
||||
RENODE_CONFIG_FLAGS += -e "emulation CreateUartPtyTerminal \"term\" \"$(EMULATOR_SERIAL_PORT)\" true"
|
||||
RENODE_CONFIG_FLAGS += -e "connector Connect $(RENODE_SYSBUS_UART) term"
|
||||
|
||||
# Set emulator variables
|
||||
EMULATOR_FLAGS ?= $(RENODE_CONFIG_FLAGS) -e start
|
||||
EMULATOR ?= $(RENODE)
|
||||
|
||||
# Configure the terminal
|
||||
PORT = $(EMULATOR_SERIAL_PORT)
|
||||
RIOT_TERMPROG := $(TERMPROG)
|
||||
RIOT_TERMFLAGS := $(TERMFLAGS)
|
||||
TERMPROG := $(RIOTTOOLS)/emulator/term.sh
|
||||
TERMFLAGS := $(RIOT_EMULATOR) $(BOARD) $(APPDIR) $(RIOT_TERMPROG) '$(RIOT_TERMFLAGS)' $(PORT)
|
||||
TERMFLAGS := $(RIOT_EMULATOR) $(BOARD) $(APPDIR) $(RIOT_TERMPROG) '$(RIOT_TERMFLAGS)' $(EMULATOR_SERIAL_PORT)
|
||||
|
||||
# Configure the debugger
|
||||
GDB_PORT ?= 3333
|
||||
@ -54,3 +56,7 @@ DEBUGSERVER_FLAGS ?= $(RENODE_DEBUG_FLAGS)
|
||||
|
||||
DEBUGGER_FLAGS ?= $(BOARD) $(APPDIR) $(ELFFILE) $(GDB_PORT) "-ex \"monitor start\""
|
||||
DEBUGGER ?= $(RIOTTOOLS)/emulator/debug.sh
|
||||
|
||||
# No flasher available with renode emulator
|
||||
FLASHER ?=
|
||||
FFLAGS ?=
|
||||
|
Loading…
Reference in New Issue
Block a user