Skip to content

Commit 86e9e63

Browse files
Jakub Klimczakcfriedt
authored andcommitted
samples: subsys: console: echo: Add VIRTIO Console overlay
Add overlay files for testing the VIRTIO Console device with this sample along with a section in the README. Signed-off-by: Jakub Klimczak <[email protected]>
1 parent 5520e3b commit 86e9e63

File tree

3 files changed

+61
-0
lines changed

3 files changed

+61
-0
lines changed

samples/subsys/console/echo/README.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,27 @@ board. Alternatively you can run this using QEMU, as described in
3333
Following the initial prompt given by the firmware, start pressing keys on a
3434
keyboard, and they will be echoed back to the terminal program you are using.
3535

36+
Running on QEMU
37+
===============
38+
39+
On QEMU you can use the VIRTIO console device. It is already configured in
40+
Zephyr. To use it, run:
41+
42+
.. zephyr-app-commands::
43+
:zephyr-app: samples/subsys/console/echo
44+
:board: qemu_x86_64
45+
:gen-args: -DDTC_OVERLAY_FILE=virtconsole.overlay -DEXTRA_CONF_FILE=overlay-virtconsole.conf
46+
:goals: run
47+
:compact:
48+
49+
It is possible to use multiple inputs/outputs at once by configuring them
50+
in the ``overlay-virtconsole.conf`` file.
51+
52+
* Add ``CONFIG_UART_VIRTIO_CONSOLE_F_MULTIPORT=y`` to enable the
53+
multiport feature.
54+
* Configure more ports using the ``CONFIG_QEMU_EXTRA_FLAGS`` option.
55+
Refer to the QEMU manual for details.
56+
3657
Sample Output
3758
=============
3859

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Copyright (c) 2025 Antmicro <www.antmicro.com>
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
CONFIG_VIRTIO=y
5+
CONFIG_PCIE=y
6+
CONFIG_UART_VIRTIO_CONSOLE=y
7+
CONFIG_HEAP_MEM_POOL_SIZE=32768
8+
9+
# The VIRTIO console cannot be used as early console
10+
CONFIG_BOOT_BANNER=n
11+
CONFIG_EARLY_CONSOLE=n
12+
CONFIG_X86_VERY_EARLY_CONSOLE=n
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* Copyright (c) 2025 Antmicro <www.antmicro.com>
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/ {
8+
chosen {
9+
zephyr,console = &virtio_console;
10+
};
11+
};
12+
13+
&pcie0 {
14+
virtio_pci: virtio_pci {
15+
compatible = "virtio,pci";
16+
17+
vendor-id = <0x1af4>;
18+
device-id = <0x1003>;
19+
20+
interrupts = <0xb 0x0 0x0>;
21+
interrupt-parent = <&intc>;
22+
23+
virtio_console: virtio_console {
24+
compatible = "virtio,console";
25+
status = "okay";
26+
};
27+
};
28+
};

0 commit comments

Comments
 (0)