cmake: qemu: Use chardev for console
The current QEMU console configuration directly connects the console serial port to the backend using '-serial' option. This is less than ideal because only single console instance can be connected to a backend and aggregation of multiple console outputs is not possible (e.g. multiple console serial ports and semihosting console to single console backend). In order to solve this problem, single multiplexed chardev console backend is declared and all consoles are connected to it. Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
This commit is contained in:
parent
e742637147
commit
244148a883
1 changed files with 13 additions and 23 deletions
|
@ -35,33 +35,23 @@ else()
|
|||
list(APPEND QEMU_FLAGS qemu${QEMU_INSTANCE}.pid)
|
||||
endif()
|
||||
|
||||
# We can set "default" value for QEMU_PTY & QEMU_PIPE on cmake invocation.
|
||||
# Set up chardev for console.
|
||||
if(QEMU_PTY)
|
||||
# Send console output to a pseudo-tty, used for running automated tests
|
||||
set(CMAKE_QEMU_SERIAL0 pty)
|
||||
# Redirect console to a pseudo-tty, used for running automated tests.
|
||||
list(APPEND QEMU_FLAGS -chardev pty,id=con,mux=on)
|
||||
elseif(QEMU_PIPE)
|
||||
# Redirect console to a pipe, used for running automated tests.
|
||||
list(APPEND QEMU_FLAGS -chardev pipe,id=con,mux=on,path=${QEMU_PIPE})
|
||||
else()
|
||||
if(QEMU_PIPE)
|
||||
# Send console output to a pipe, used for running automated tests
|
||||
set(CMAKE_QEMU_SERIAL0 pipe:${QEMU_PIPE})
|
||||
else()
|
||||
set(CMAKE_QEMU_SERIAL0 mon:stdio)
|
||||
endif()
|
||||
# Redirect console to stdio, used for manual debugging.
|
||||
list(APPEND QEMU_FLAGS -chardev stdio,id=con,mux=on)
|
||||
endif()
|
||||
|
||||
# But also can set QEMU_PTY & QEMU_PIPE on *make* (not cmake) invocation,
|
||||
# like it was before cmake.
|
||||
if(${CMAKE_GENERATOR} STREQUAL "Unix Makefiles")
|
||||
list(APPEND QEMU_FLAGS
|
||||
-serial
|
||||
\${if \${QEMU_PTY}, pty, \${if \${QEMU_PIPE}, pipe:\${QEMU_PIPE}, ${CMAKE_QEMU_SERIAL0}}}
|
||||
# NB: \$ is not supported by Ninja
|
||||
)
|
||||
else()
|
||||
list(APPEND QEMU_FLAGS
|
||||
-serial
|
||||
${CMAKE_QEMU_SERIAL0}
|
||||
)
|
||||
endif()
|
||||
# Connect main serial port to the console chardev.
|
||||
list(APPEND QEMU_FLAGS -serial chardev:con)
|
||||
|
||||
# Connect monitor to the console chardev.
|
||||
list(APPEND QEMU_FLAGS -mon chardev=con,mode=readline)
|
||||
|
||||
# Add a BT serial device when building for bluetooth, unless the
|
||||
# application explicitly opts out with NO_QEMU_SERIAL_BT_SERVER.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue