1cmake_minimum_required(VERSION 3.20.0) 2# Copyright (c) 2019 Linaro Limited 3# Copyright (c) 2018-2021 Nordic Semiconductor ASA 4# 5# SPDX-License-Identifier: Apache-2.0 6# 7 8set(REMOTE_ZEPHYR_DIR ${CMAKE_CURRENT_BINARY_DIR}/rpmsg_service_remote-prefix/src/rpmsg_service_remote-build/zephyr) 9 10if("${BOARD}" STREQUAL "nrf5340dk_nrf5340_cpuapp") 11 set(BOARD_REMOTE "nrf5340dk_nrf5340_cpunet") 12elseif("${BOARD}" STREQUAL "bl5340_dvk_cpuapp") 13 set(BOARD_REMOTE "bl5340_dvk_cpunet") 14elseif("${BOARD}" STREQUAL "lpcxpresso54114_m4") 15 set(BOARD_REMOTE "lpcxpresso54114_m0") 16elseif("${BOARD}" STREQUAL "mps2_an521") 17 set(QEMU_EXTRA_FLAGS "-device;loader,file=${REMOTE_ZEPHYR_DIR}/zephyr.elf") 18 set(BOARD_REMOTE "mps2_an521_remote") 19elseif("${BOARD}" STREQUAL "v2m_musca_b1") 20 set(BOARD_REMOTE "v2m_musca_b1_ns") 21elseif("${BOARD}" STREQUAL "esp32_devkitc_wrover") 22 set(BOARD_REMOTE "esp32_net") 23elseif("${BOARD}" STREQUAL "esp32s3_devkitm") 24 set(BOARD_REMOTE "esp32s3_devkitm_appcpu") 25else() 26 message(FATAL_ERROR "${BOARD} was not supported for this sample") 27endif() 28 29message(STATUS "${BOARD} compile as Master in this sample") 30 31find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) 32project(rpmsg_service) 33 34enable_language(C ASM) 35 36target_sources(app PRIVATE src/main.c) 37 38if("${BOARD}" STREQUAL "esp32_devkitc_wrover" OR "${BOARD}" STREQUAL "esp32s3_devkitm") 39 set_source_files_properties(${REMOTE_ZEPHYR_DIR}/esp32_net_firmware.c PROPERTIES GENERATED TRUE) 40 target_sources(app PRIVATE src/main.c ${REMOTE_ZEPHYR_DIR}/esp32_net_firmware.c) 41endif() 42 43include(ExternalProject) 44 45ExternalProject_Add( 46 rpmsg_service_remote 47 SOURCE_DIR ${APPLICATION_SOURCE_DIR}/remote 48 INSTALL_COMMAND "" # This particular build system has no install command 49 CMAKE_CACHE_ARGS -DBOARD:STRING=${BOARD_REMOTE} 50 BUILD_BYPRODUCTS "${REMOTE_ZEPHYR_DIR}/${KERNEL_BIN_NAME}" 51 # NB: Do we need to pass on more CMake variables? 52 BUILD_ALWAYS True 53) 54 55if(("${BOARD}" STREQUAL "lpcxpresso54114_m4")) 56 add_dependencies(core_m0_inc_target rpmsg_service_remote) 57elseif("${BOARD}" STREQUAL "esp32_devkitc_wrover" OR "${BOARD}" STREQUAL "esp32s3_devkitm") 58 add_dependencies(app rpmsg_service_remote) 59endif() 60 61target_include_directories(app PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) 62