samples: drivers: ipm: update to use sysbuild

Update ipm_mcux sample to use sysbuild for multicore images

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
This commit is contained in:
Daniel DeGrasse 2022-08-04 10:58:40 -05:00 committed by Carles Cufí
parent e033677787
commit 1aa01c18bb
9 changed files with 54 additions and 35 deletions

View File

@ -1,40 +1,22 @@
cmake_minimum_required(VERSION 3.20.0)
# Copyright (c) 2017, NXP
# Copyright (c) 2017-2022, NXP
#
# SPDX-License-Identifier: Apache-2.0
#
set(REMOTE_ZEPHYR_DIR ${CMAKE_CURRENT_BINARY_DIR}/ipm_mcux_remote-prefix/src/ipm_mcux_remote-build/zephyr)
if("${BOARD}" STREQUAL "lpcxpresso54114_m4")
set(BOARD_REMOTE "lpcxpresso54114_m0")
elseif("${BOARD}" STREQUAL "lpcxpresso55s69_cpu0")
set(BOARD_REMOTE "lpcxpresso55s69_cpu1")
else()
message(FATAL_ERROR "${BOARD} was not supported for this sample")
endif()
message(STATUS "${BOARD} compile as Master in this sample")
set(REMOTE_ZEPHYR_DIR ${CMAKE_CURRENT_BINARY_DIR}/../ipm_mcux_remote/zephyr)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
message(STATUS "${BOARD} compile as Master in this sample")
project(ipm_mcux)
enable_language(C ASM)
if(CONFIG_INCLUDE_REMOTE_DIR)
target_include_directories(zephyr_interface
INTERFACE ${REMOTE_ZEPHYR_DIR}/include/public)
endif()
target_sources(app PRIVATE src/main_master.c)
include(ExternalProject)
ExternalProject_Add(
ipm_mcux_remote
SOURCE_DIR ${APPLICATION_SOURCE_DIR}/remote
INSTALL_COMMAND "" # This particular build system has no install command
CMAKE_CACHE_ARGS -DBOARD:STRING=${BOARD_REMOTE}
CMAKE_CACHE_ARGS -DDTC_OVERLAY_FILE:STRING=${DTC_OVERLAY_FILE}
BUILD_BYPRODUCTS "${REMOTE_ZEPHYR_DIR}/${KERNEL_BIN_NAME}"
BUILD_ALWAYS True
)
add_dependencies(second_core_inc_target ipm_mcux_remote)
target_include_directories(app PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})

View File

@ -0,0 +1,11 @@
# Copyright 2022 NXP
#
# SPDX-License-Identifier: Apache-2.0
source "Kconfig.zephyr"
config INCLUDE_REMOTE_DIR
bool "Include remote core header directory"
help
Include remote build header files. Can be used if primary image
needs to be aware of size or base address of secondary image

View File

@ -0,0 +1,10 @@
# Copyright 2022 NXP
#
# SPDX-License-Identifier: Apache-2.0
source "share/sysbuild/Kconfig"
config IPM_REMOTE_BOARD
string
default "lpcxpresso54114_m0" if $(BOARD) = "lpcxpresso54114_m4"
default "lpcxpresso55s69_cpu1" if $(BOARD) = "lpcxpresso55s69_cpu0"

View File

@ -0,0 +1 @@
CONFIG_INCLUDE_REMOTE_DIR=y

View File

@ -1,6 +1,5 @@
CONFIG_PRINTK=y
CONFIG_IPM=y
CONFIG_SECOND_CORE_MCUX=y
CONFIG_SECOND_IMAGE_MCUX="${ZEPHYR_BINARY_DIR}/../ipm_mcux_remote-prefix/src/ipm_mcux_remote-build/zephyr/${KERNEL_BIN_NAME}"
CONFIG_TIMESLICE_SIZE=1
CONFIG_MAIN_STACK_SIZE=2048

View File

@ -1,17 +1,13 @@
cmake_minimum_required(VERSION 3.20.0)
# Copyright (c) 2017, NXP
# Copyright (c) 2017-2022, NXP
#
# SPDX-License-Identifier: Apache-2.0
#
if(("${BOARD}" STREQUAL "lpcxpresso54114_m0")
OR "${BOARD}" STREQUAL "lpcxpresso55s69_cpu1")
message(STATUS "${BOARD} compiles as remote in this sample")
else()
message(FATAL_ERROR "${BOARD} was not supported for this sample")
endif()
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
message(STATUS "${BOARD} compiles as remote in this sample")
project(ipm_mcux_remote)
target_sources(app PRIVATE src/main_remote.c)

View File

@ -2,3 +2,5 @@ CONFIG_STDOUT_CONSOLE=n
CONFIG_PRINTK=n
CONFIG_IPM=y
CONFIG_PLATFORM_SPECIFIC_INIT=n
CONFIG_SECOND_CORE_MCUX=y
CONFIG_BUILD_OUTPUT_HEX=y

View File

@ -7,6 +7,7 @@ tests:
platform_allow: lpcxpresso54114_m4 lpcxpresso55s69_cpu0
tags: ipm
harness: console
sysbuild: True
harness_config:
type: multi_line
regex:

View File

@ -0,0 +1,17 @@
# SPDX-License-Identifier: Apache-2.0
#
# Copyright 2022 NXP
# Add external project
ExternalZephyrProject_Add(
APPLICATION ipm_mcux_remote
SOURCE_DIR ${APP_DIR}/remote
BOARD ${SB_CONFIG_IPM_REMOTE_BOARD}
)
# Add a dependency so that the remote sample will be built and flashed first
# This is required because some primary cores need information from the
# remote core's build, such as the output image's LMA
add_dependencies(ipm_mcux ipm_mcux_remote)
# Place remote image first in the image list
set(IMAGES "ipm_mcux_remote" ${IMAGES})