1# SPDX-License-Identifier: Apache-2.0
2
3find_program(
4  RENODE
5  renode
6  )
7
8set(RENODE_FLAGS
9  --disable-xwt
10  --port -2
11  --pid-file renode.pid
12  )
13
14# Check if there is any Renode script overlay defined for the target board
15set(resc_overlay_file ${APPLICATION_SOURCE_DIR}/boards/${BOARD}.resc)
16if(EXISTS ${resc_overlay_file})
17  set(RENODE_OVERLAY include "@${resc_overlay_file}\;")
18  message(STATUS "Found Renode script overlay: ${resc_overlay_file}")
19endif()
20
21add_custom_target(run_renode
22  COMMAND
23  ${RENODE}
24  ${RENODE_FLAGS}
25  -e '$$elf=@${PROJECT_BINARY_DIR}/${KERNEL_ELF_NAME}\; include @${RENODE_SCRIPT}\; ${RENODE_OVERLAY} s'
26  WORKING_DIRECTORY ${APPLICATION_BINARY_DIR}
27  DEPENDS ${logical_target_for_zephyr_elf}
28  USES_TERMINAL
29  )
30