mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2026-01-01 01:41:18 +01:00
Merge pull request #17751 from aabadie/pr/doc/qemu_doc_update
doc/emulator: update qemu doc with unix sockets
This commit is contained in:
commit
99670b2c4d
6
dist/tools/emulator/debug.sh
vendored
6
dist/tools/emulator/debug.sh
vendored
@ -14,7 +14,7 @@
|
||||
BOARD=$1
|
||||
APPDIR=$2
|
||||
ELFFILE=$3
|
||||
RUNTIME_TMP_DIR=$5
|
||||
EMULATOR_TMP_DIR=$5
|
||||
|
||||
# GDB command, usually a separate command for each platform (e.g. arm-none-eabi-gdb)
|
||||
: ${GDB:=gdb-multiarch}
|
||||
@ -31,7 +31,7 @@ RUNTIME_TMP_DIR=$5
|
||||
: ${DBG_FLAGS:=${DBG_DEFAULT_FLAGS} ${DBG_CUSTOM_FLAGS}}
|
||||
|
||||
# temporary file that contains the emulator pid
|
||||
EMULATOR_PIDFILE="${RUNTIME_TMP_DIR}/emulator_pid"
|
||||
EMULATOR_PIDFILE="${EMULATOR_TMP_DIR}/emulator_pid"
|
||||
# will be called by trap
|
||||
cleanup() {
|
||||
kill "$(cat ${EMULATOR_PIDFILE})"
|
||||
@ -47,7 +47,7 @@ trap '' INT
|
||||
sh -c "\
|
||||
GDB_REMOTE=${GDB_REMOTE} \
|
||||
EMULATE=1 \
|
||||
RUNTIME_TMP_DIR=${RUNTIME_TMP_DIR} \
|
||||
EMULATOR_TMP_DIR=${EMULATOR_TMP_DIR} \
|
||||
EMULATOR_PIDFILE=${EMULATOR_PIDFILE} \
|
||||
BOARD=${BOARD} \
|
||||
make -C ${APPDIR} debug-server & \
|
||||
|
||||
12
dist/tools/emulator/term.sh
vendored
12
dist/tools/emulator/term.sh
vendored
@ -20,11 +20,11 @@ APPDIR=$3
|
||||
TERMPROG=$4
|
||||
TERMFLAGS=$5
|
||||
PORT=$6
|
||||
RUNTIME_TMP_DIR=$7
|
||||
EMULATOR_TMP_DIR=$7
|
||||
|
||||
# temporary file that contains the emulator pid
|
||||
EMULATOR_PIDFILE="${RUNTIME_TMP_DIR}/emulator_pid"
|
||||
SOCAT_PIDFILE="${RUNTIME_TMP_DIR}/socat_pid"
|
||||
EMULATOR_PIDFILE="${EMULATOR_TMP_DIR}/emulator_pid"
|
||||
SOCAT_PIDFILE="${EMULATOR_TMP_DIR}/socat_pid"
|
||||
|
||||
# will be called by trap
|
||||
cleanup() {
|
||||
@ -38,7 +38,7 @@ cleanup() {
|
||||
kill "$(cat ${EMULATOR_PIDFILE})"
|
||||
rm -f "${EMULATOR_PIDFILE}"
|
||||
rm -f ${PORT}
|
||||
rmdir ${RUNTIME_TMP_DIR}
|
||||
rmdir ${EMULATOR_TMP_DIR}
|
||||
exit 0
|
||||
}
|
||||
# cleanup after script terminates
|
||||
@ -48,7 +48,7 @@ trap "cleanup terminal for ${EMULATOR} emulator" EXIT
|
||||
sh -c "\
|
||||
EMULATOR_PIDFILE=${EMULATOR_PIDFILE} \
|
||||
EMULATE=1 \
|
||||
RUNTIME_TMP_DIR=${RUNTIME_TMP_DIR} \
|
||||
EMULATOR_TMP_DIR=${EMULATOR_TMP_DIR} \
|
||||
BOARD=${BOARD} \
|
||||
make -C ${APPDIR} emulate & \
|
||||
echo \$! > ${EMULATOR_PIDFILE}" &
|
||||
@ -58,7 +58,7 @@ if [ ${EMULATOR} = "qemu" ]
|
||||
then
|
||||
sleep 1
|
||||
sh -c "\
|
||||
socat unix-connect:${RUNTIME_TMP_DIR}/uart_socket pty,link=${PORT},raw,echo=0 & \
|
||||
socat unix-connect:${EMULATOR_TMP_DIR}/uart_socket pty,link=${PORT},raw,echo=0 & \
|
||||
echo \$! > ${SOCAT_PIDFILE}" &
|
||||
fi
|
||||
|
||||
|
||||
@ -58,9 +58,9 @@ $ EMULATE=1 make BOARD=<board> -C <test application directory> all test
|
||||
|
||||
The `EMULATOR_SERIAL_PORT` variable can be used to specify a custom serial port
|
||||
on the host running the emulator.
|
||||
The default value is built based on the board and application names:
|
||||
`/tmp/riot_$(APPLICATION)_$(BOARD)_uart`.
|
||||
This variable is useful to allow several emulated sessions of the same
|
||||
The default value is built based on a random temporary directory:
|
||||
`$(EMULATOR_TMP_DIR)/uart`.
|
||||
The randomness of this variable allows several emulated sessions of the same
|
||||
application with the same board to run in parallel.
|
||||
|
||||
# Qemu
|
||||
@ -83,11 +83,9 @@ So far, in RIOT, only the @ref boards_microbit board is supported with qemu.
|
||||
|
||||
## Configuration
|
||||
|
||||
The QEMU emulated serial port is exposed on a local TCP server, redirected to a
|
||||
The QEMU emulated serial port is exposed on a local Unix socket, redirected to a
|
||||
local PTY file (using [socat](http://www.dest-unreach.org/socat/)). This makes
|
||||
it possible to open the PTY file a regular serial port.
|
||||
To allow multiple emulated sessions in parallel, the TCP port of the TCP server
|
||||
can be configured using the `QEMU_SERIAL_TCP_PORT`. The default value is 5555.
|
||||
it possible to open the PTY file in a regular serial port.
|
||||
|
||||
# Renode
|
||||
|
||||
|
||||
@ -2,12 +2,12 @@ QEMU ?= qemu-system-arm
|
||||
QEMU_MACHINE ?= $(BOARD)
|
||||
FLASHFILE ?= $(ELFFILE)
|
||||
|
||||
ifeq (,$(RUNTIME_TMP_DIR))
|
||||
RUNTIME_TMP_DIR := $(shell mktemp -td riot_$(APPLICATION)_$(BOARD).XXXXX)
|
||||
ifeq (,$(EMULATOR_TMP_DIR))
|
||||
EMULATOR_TMP_DIR := $(shell mktemp -td riot_$(APPLICATION)_$(BOARD).XXXXX)
|
||||
endif
|
||||
|
||||
EMULATOR_SERIAL_PORT ?= $(RUNTIME_TMP_DIR)/uart
|
||||
EMULATOR_MONITOR ?= $(RUNTIME_TMP_DIR)/mon
|
||||
EMULATOR_SERIAL_PORT ?= $(EMULATOR_TMP_DIR)/uart
|
||||
EMULATOR_MONITOR ?= $(EMULATOR_TMP_DIR)/mon
|
||||
|
||||
# Configure emulator variables
|
||||
EMULATOR ?= $(QEMU)
|
||||
@ -22,10 +22,10 @@ PORT = $(EMULATOR_SERIAL_PORT)
|
||||
RIOT_TERMPROG := $(TERMPROG)
|
||||
RIOT_TERMFLAGS := $(TERMFLAGS)
|
||||
TERMPROG := $(RIOTTOOLS)/emulator/term.sh
|
||||
TERMFLAGS := $(RIOT_EMULATOR) $(BOARD) $(APPDIR) $(RIOT_TERMPROG) '$(RIOT_TERMFLAGS)' $(EMULATOR_SERIAL_PORT) $(RUNTIME_TMP_DIR)
|
||||
TERMFLAGS := $(RIOT_EMULATOR) $(BOARD) $(APPDIR) $(RIOT_TERMPROG) '$(RIOT_TERMFLAGS)' $(EMULATOR_SERIAL_PORT) $(EMULATOR_TMP_DIR)
|
||||
|
||||
# Configure the debugger ,wait=off
|
||||
GDB_REMOTE ?= $(RUNTIME_TMP_DIR)/gdb_socket
|
||||
GDB_REMOTE ?= $(EMULATOR_TMP_DIR)/gdb_socket
|
||||
|
||||
QEMU_DEBUG_FLAGS += -S -gdb unix:$(GDB_REMOTE),server=on
|
||||
QEMU_DEBUG_FLAGS += $(EMULATOR_FLAGS)
|
||||
@ -33,7 +33,7 @@ QEMU_DEBUG_FLAGS += $(EMULATOR_FLAGS)
|
||||
DEBUGSERVER ?= $(EMULATOR)
|
||||
DEBUGSERVER_FLAGS ?= $(QEMU_DEBUG_FLAGS)
|
||||
|
||||
DEBUGGER_FLAGS ?= $(BOARD) $(APPDIR) $(ELFFILE) $(GDB_REMOTE) $(RUNTIME_TMP_DIR)
|
||||
DEBUGGER_FLAGS ?= $(BOARD) $(APPDIR) $(ELFFILE) $(GDB_REMOTE) $(EMULATOR_TMP_DIR)
|
||||
DEBUGGER ?= $(RIOTTOOLS)/emulator/debug.sh
|
||||
|
||||
# No flasher available with qemu emulator
|
||||
|
||||
@ -6,8 +6,8 @@ RENODE_BOARD_CONFIG ?= $(BOARDDIR)/dist/board.resc
|
||||
FLASHFILE ?= $(ELFFILE)
|
||||
EMULATORDEPS += $(RENODE_BOARD_CONFIG)
|
||||
|
||||
ifeq (,$(RUNTIME_TMP_DIR))
|
||||
RUNTIME_TMP_DIR := $(shell mktemp -td riot_$(APPLICATION)_$(BOARD).XXXXX)
|
||||
ifeq (,$(EMULATOR_TMP_DIR))
|
||||
EMULATOR_TMP_DIR := $(shell mktemp -td riot_$(APPLICATION)_$(BOARD).XXXXX)
|
||||
endif
|
||||
|
||||
# Use renode interactive commands to specify the image file and board config
|
||||
@ -35,7 +35,7 @@ endif
|
||||
|
||||
# Configure local serial port
|
||||
RENODE_SYSBUS_UART ?= sysbus.uart0
|
||||
EMULATOR_SERIAL_PORT ?= /tmp/riot_$(APPLICATION)_$(BOARD)_uart
|
||||
EMULATOR_SERIAL_PORT ?= $(EMULATOR_TMP_DIR)/uart
|
||||
RENODE_CONFIG_FLAGS += -e "emulation CreateUartPtyTerminal \"term\" \"$(EMULATOR_SERIAL_PORT)\" true"
|
||||
RENODE_CONFIG_FLAGS += -e "connector Connect $(RENODE_SYSBUS_UART) term"
|
||||
|
||||
@ -48,7 +48,7 @@ PORT = $(EMULATOR_SERIAL_PORT)
|
||||
RIOT_TERMPROG := $(TERMPROG)
|
||||
RIOT_TERMFLAGS := $(TERMFLAGS)
|
||||
TERMPROG := $(RIOTTOOLS)/emulator/term.sh
|
||||
TERMFLAGS := $(RIOT_EMULATOR) $(BOARD) $(APPDIR) $(RIOT_TERMPROG) '$(RIOT_TERMFLAGS)' $(EMULATOR_SERIAL_PORT) $(RUNTIME_TMP_DIR)
|
||||
TERMFLAGS := $(RIOT_EMULATOR) $(BOARD) $(APPDIR) $(RIOT_TERMPROG) '$(RIOT_TERMFLAGS)' $(EMULATOR_SERIAL_PORT) $(EMULATOR_TMP_DIR)
|
||||
|
||||
# Configure the debugger
|
||||
GDB_PORT ?= 3333
|
||||
@ -59,7 +59,7 @@ RENODE_DEBUG_FLAGS += -e "machine StartGdbServer $(GDB_PORT) true"
|
||||
DEBUGSERVER ?= $(EMULATOR)
|
||||
DEBUGSERVER_FLAGS ?= $(RENODE_DEBUG_FLAGS)
|
||||
|
||||
DEBUGGER_FLAGS ?= $(BOARD) $(APPDIR) $(ELFFILE) $(GDB_REMOTE) $(RUNTIME_TMP_DIR) "-ex \"monitor start\""
|
||||
DEBUGGER_FLAGS ?= $(BOARD) $(APPDIR) $(ELFFILE) $(GDB_REMOTE) $(EMULATOR_TMP_DIR) "-ex \"monitor start\""
|
||||
DEBUGGER ?= $(RIOTTOOLS)/emulator/debug.sh
|
||||
|
||||
# No flasher available with renode emulator
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user