1# SPDX-License-Identifier: Apache-2.0
2#
3# Copyright 2024 Espressif
4
5# Prepare the full board name to be used for the remote target
6string(REPLACE "procpu" "appcpu" REMOTE_CPU "${BOARD_QUALIFIERS}")
7string(CONFIGURE "${BOARD}${REMOTE_CPU}" IPM_REMOTE_BOARD)
8
9if(${REMOTE_CPU} STREQUAL ${BOARD_QUALIFIERS})
10  # Make sure the remote build is using different target than host CPU
11  message(FATAL_ERROR "BOARD_QUALIFIERS name error. Please check the target board name string.")
12endif()
13
14# Add external project
15ExternalZephyrProject_Add(
16    APPLICATION ipm_esp32_remote
17    SOURCE_DIR ${APP_DIR}/remote
18    BOARD ${IPM_REMOTE_BOARD}
19  )
20
21# Add dependencies so that the remote sample will be built first
22# This is required because some primary cores need information from the
23# remote core's build, such as the output image's LMA
24add_dependencies(ipm_esp32 ipm_esp32_remote)
25sysbuild_add_dependencies(CONFIGURE ipm_esp32 ipm_esp32_remote)
26
27if(SB_CONFIG_BOOTLOADER_MCUBOOT)
28  # Make sure MCUboot is flashed first
29  sysbuild_add_dependencies(FLASH ipm_esp32_remote mcuboot)
30endif()
31