1# SPDX-License-Identifier: Apache-2.0
2
3set(SUPPORTED_EMU_PLATFORMS qemu)
4
5if(CONFIG_BOARD_MPS2_AN385)
6  set(QEMU_CPU_TYPE_${ARCH} cortex-m3)
7  set(QEMU_FLAGS_${ARCH}
8    -cpu ${QEMU_CPU_TYPE_${ARCH}}
9    -machine mps2-an385
10    -nographic
11    -vga none
12    )
13elseif(CONFIG_BOARD_MPS2_AN521_CPU0 OR CONFIG_BOARD_MPS2_AN521_CPU0_NS OR CONFIG_BOARD_MPS2_AN521_CPU1)
14  set(QEMU_CPU_TYPE_${ARCH} cortex-m33)
15  set(QEMU_FLAGS_${ARCH}
16    -cpu ${QEMU_CPU_TYPE_${ARCH}}
17    -machine mps2-an521
18    -nographic
19    -m 16
20    -vga none
21    )
22endif()
23
24board_set_debugger_ifnset(qemu)
25
26if(CONFIG_BOARD_MPS2_AN521_CPU0 OR CONFIG_BOARD_MPS2_AN521_CPU0_NS OR CONFIG_BOARD_MPS2_AN521_CPU1)
27  # To enable a host tty switch between serial and pty
28  #  -chardev serial,path=/dev/ttyS0,id=hostS0
29  # pty is not available on Windows.
30  if(CMAKE_HOST_UNIX)
31    list(APPEND QEMU_EXTRA_FLAGS -chardev pty,id=hostS0 -serial chardev:hostS0)
32  endif()
33
34  if(CONFIG_BUILD_WITH_TFM)
35    # Override the binary used by qemu, to use the combined
36    # TF-M (Secure) & Zephyr (Non Secure) image (when running
37    # in-tree tests).
38    set(QEMU_KERNEL_OPTION "-device;loader,file=${CMAKE_BINARY_DIR}/zephyr/tfm_merged.hex")
39  elseif(CONFIG_OPENAMP)
40    set(QEMU_EXTRA_FLAGS "-device;loader,file=${REMOTE_ZEPHYR_DIR}/zephyr.elf")
41  elseif(CONFIG_BOARD_MPS2_AN521_CPU1)
42    set(CPU0_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/zephyr/boards/arm/mps2/empty_cpu0-prefix/src/empty_cpu0-build/zephyr)
43    set(QEMU_KERNEL_OPTION "-device;loader,file=${CPU0_BINARY_DIR}/zephyr.elf")
44    list(APPEND QEMU_EXTRA_FLAGS "-device;loader,file=${PROJECT_BINARY_DIR}/${KERNEL_ELF_NAME}")
45  endif()
46endif()
47