boards: arm: mps2_an521: Enable qemu host tty

This configure and connect host /dev/pts/N to arm qemu uart-1. It can
use a real device like /dev/ttyS0. Just switch config between serial
and pty chardev options.

In addition, this update QEMU_EXTRA_FLAGS to use only variables instead
hard coded values.

Signed-off-by: Gerson Fernando Budke <gerson.budke@ossystems.com.br>
This commit is contained in:
Gerson Fernando Budke 2021-09-30 23:01:36 -03:00 committed by Christopher Friedt
commit 47f7befc36
2 changed files with 10 additions and 1 deletions

View file

@ -12,6 +12,10 @@ set(QEMU_FLAGS_${ARCH}
)
board_set_debugger_ifnset(qemu)
# To enable a host tty switch between serial and pty
# -chardev serial,path=/dev/ttyS0,id=hostS0
list(APPEND QEMU_EXTRA_FLAGS -chardev pty,id=hostS0 -serial chardev:hostS0)
if (CONFIG_BUILD_WITH_TFM)
# Override the binary used by qemu, to use the combined
# TF-M (Secure) & Zephyr (Non Secure) image (when running
@ -21,5 +25,5 @@ if (CONFIG_BUILD_WITH_TFM)
elseif (CONFIG_SOC_MPS2_AN521_CPU1)
set(CPU0_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/zephyr/boards/arm/mps2_an521/empty_cpu0-prefix/src/empty_cpu0-build/zephyr)
set(QEMU_KERNEL_OPTION "-device;loader,file=${CPU0_BINARY_DIR}/zephyr.elf")
set(QEMU_EXTRA_FLAGS "-device;loader,file=${CMAKE_CURRENT_BINARY_DIR}/zephyr/zephyr.elf")
list(APPEND QEMU_EXTRA_FLAGS "-device;loader,file=${PROJECT_BINARY_DIR}/${KERNEL_ELF_NAME}")
endif()

View file

@ -20,6 +20,7 @@
led1 = &led_1;
sw0 = &user_button_0;
sw1 = &user_button_1;
uart-1 = &uart1;
watchdog0 = &wdog0;
};
@ -110,3 +111,7 @@
&nvic {
arm,num-irq-priority-bits = <3>;
};
&uart1 {
status = "okay";
};