1# Copyright (c) 2021 Linaro
2# Copyright 2024 Arm Limited and/or its affiliates <open-source-office@arm.com>
3# SPDX-License-Identifier: Apache-2.0
4
5# The FVP variant must be used to enable Ethos-U55 NPU support, but QEMU also
6# supports the AN547 without the NPU.
7#
8# Default emulation:
9#     QEMU is used by default for corstone300/an547 and
10#     FVP  is used by default for corstone300/fvp.
11#     FVP  is used by default for corstone310/fvp.
12#
13
14
15if(CONFIG_BOARD_MPS3_CORSTONE300_AN547 OR CONFIG_BOARD_MPS3_CORSTONE300_AN547_NS)
16  set(SUPPORTED_EMU_PLATFORMS qemu)
17
18  # QEMU settings
19  set(QEMU_CPU_TYPE_${ARCH} cortex-m55)
20  set(QEMU_FLAGS_${ARCH}
21    -cpu ${QEMU_CPU_TYPE_${ARCH}}
22    -machine mps3-an547
23    -nographic
24    -vga none
25    )
26elseif(CONFIG_BOARD_MPS3_CORSTONE300_FVP OR CONFIG_BOARD_MPS3_CORSTONE300_FVP_NS)
27  set(SUPPORTED_EMU_PLATFORMS armfvp)
28  set(ARMFVP_BIN_NAME FVP_Corstone_SSE-300_Ethos-U55)
29elseif(CONFIG_BOARD_MPS3_CORSTONE300)
30  string(REPLACE "mps3/corstone300;" "" board_targets "${board_targets}")
31  string(REPLACE ";" "\n" board_targets "${board_targets}")
32  message(FATAL_ERROR "Please use a target from the list below: \n${board_targets}\n")
33elseif(CONFIG_BOARD_MPS3_CORSTONE310_FVP OR CONFIG_BOARD_MPS3_CORSTONE310_FVP_NS)
34  set(SUPPORTED_EMU_PLATFORMS armfvp)
35  set(ARMFVP_BIN_NAME FVP_Corstone_SSE-310)
36  if(CONFIG_BOARD_MPS3_CORSTONE310_FVP)
37    set(ARMFVP_FLAGS
38      # default is '0x11000000' but should match cpu<i>.INITSVTOR which is 0.
39      -C mps3_board.sse300.iotss3_systemcontrol.INITSVTOR_RST=0
40    )
41  endif()
42endif()
43
44board_set_debugger_ifnset(qemu)
45
46if (CONFIG_BUILD_WITH_TFM)
47  # Override the binary used by qemu, to use the combined
48  # TF-M (Secure) & Zephyr (Non Secure) image (when running
49  # in-tree tests).
50  set(QEMU_KERNEL_OPTION "-device;loader,file=${CMAKE_BINARY_DIR}/zephyr/tfm_merged.hex")
51endif()
52
53# FVP Parameters
54# -C indicate a config option in the form of:
55#   instance.parameter=value
56# Run the FVP with --list-params to list all options
57set(ARMFVP_FLAGS ${ARMFVP_FLAGS}
58  -C mps3_board.uart0.out_file=-
59  -C mps3_board.uart0.unbuffered_output=1
60  -C mps3_board.uart1.out_file=-
61  -C mps3_board.uart1.unbuffered_output=1
62  -C mps3_board.uart2.out_file=-
63  -C mps3_board.uart2.unbuffered_output=1
64  -C mps3_board.visualisation.disable-visualisation=1
65  -C mps3_board.telnetterminal0.start_telnet=0
66  -C mps3_board.telnetterminal1.start_telnet=0
67  -C mps3_board.telnetterminal2.start_telnet=0
68  )
69