soc: nxp: imxrt: add CONFIG_SECOND_CORE_MCUX_LAUNCHER

Add CONFIG_SECOND_CORE_MCUX_LAUNCHER. This Kconfig is only enabled when
using sysbuild targeting the Cortex-M4 core on the RT11xx series, and
results in loading a minimal application to the Cortex-M7 core that
boots the Cortex-M4 core. This makes developing on the M4 core simpler,
as the user can now simply target the core with sysbuild enabled and
flashing the application will work as expected.

Signed-off-by: Daniel DeGrasse <daniel@degrasse.com>
This commit is contained in:
Daniel DeGrasse 2024-12-06 16:58:29 -06:00 committed by Benjamin Cabé
commit a7ad63c1d0
5 changed files with 74 additions and 0 deletions

View file

@ -124,6 +124,13 @@ config SECOND_CORE_MCUX
generated header specifying the VMA and LMA of each memory section
to load
config SECOND_CORE_MCUX_REMOTE_DIR
string "Directory to with output image header from second core"
depends on SECOND_CORE_MCUX
help
Sets the remote directory to include the output image header data
from when launching a second core image
if SOC_SERIES_IMXRT10XX || SOC_SERIES_IMXRT11XX || SOC_SERIES_IMXRT118X
config PM_MCUX_GPC

View file

@ -0,0 +1,12 @@
# Copyright 2024 Daniel DeGrasse <daniel@degrasse.com>
# SPDX-License-Identifier: Apache-2.0
config SECOND_CORE_MCUX_LAUNCHER
bool "Load minimal application to primary core to boot secondary one"
default y if (SOC_MIMXRT1176_CM4 || SOC_MIMXRT1166_CM4)
depends on SOC_SERIES_IMXRT11XX
help
Load a minimal application to the primary core to boot the secondary
one. The primary core will be loaded with the samples/basic/minimal
application, and the appropriate configuration will be set to
boot the secondary core during startup.

View file

@ -16,4 +16,10 @@ if(CONFIG_MEMC_MCUX_FLEXSPI)
endif()
endif()
if(CONFIG_SECOND_CORE_MCUX_REMOTE_DIR)
# Add remote directory to include within the build
zephyr_include_directories(${CONFIG_SECOND_CORE_MCUX_REMOTE_DIR})
endif()
set(SOC_LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/linker.ld CACHE INTERNAL "")

View file

@ -0,0 +1,42 @@
# Copyright 2024 Daniel DeGrasse <daniel@degrasse.com>
# SPDX-License-Identifier: Apache-2.0
# Based on Nordic's implementation of VPR launcher, which is
# Copyright (c) 2024 Nordic Semiconductor ASA
if(SB_CONFIG_SECOND_CORE_MCUX_LAUNCHER)
# M7 is the boot core, and will start secondary core
set(launcher_core "cm7")
string(REPLACE "/" ";" launcher_quals ${BOARD_QUALIFIERS})
list(LENGTH launcher_quals launcher_quals_len)
list(GET launcher_quals 1 launcher_soc)
string(CONCAT launcher_board ${BOARD} "/" ${launcher_soc} "/" ${launcher_core})
set(launcher_image "cm4_launcher")
ExternalZephyrProject_Add(
APPLICATION ${launcher_image}
SOURCE_DIR ${ZEPHYR_BASE}/samples/basic/minimal
BOARD ${launcher_board}
)
set(remote_dir "${APPLICATION_BINARY_DIR}/${DEFAULT_IMAGE}/zephyr/include/public")
# Enable CONFIG_SECOND_CORE_MCUX and CONFIG_BUILD_OUTPUT_HEX
# for the application running on the CM4 core
set_config_bool(${DEFAULT_IMAGE} CONFIG_SECOND_CORE_MCUX 1)
set_config_bool(${DEFAULT_IMAGE} CONFIG_BUILD_OUTPUT_HEX 1)
# Enable CONFIG_SECOND_CORE_MCUX for the image running on the CM7 core
set_config_bool(${launcher_image} CONFIG_SECOND_CORE_MCUX 1)
# Set the initial include path for the image running on the CM7 core to
# include the image header output by the CM4 image
set_config_string(${launcher_image} CONFIG_SECOND_CORE_MCUX_REMOTE_DIR ${remote_dir})
# Add dependency on CM4 core image to CM7 image. This way,
# the CM4 image will be built first. This is required because the M7 image
# depends on output headers generated by the M4 image.
add_dependencies(${launcher_image} ${DEFAULT_IMAGE})
sysbuild_add_dependencies(CONFIGURE ${launcher_image} ${DEFAULT_IMAGE})
endif()

View file

@ -0,0 +1,7 @@
# Copyright 2024 Daniel DeGrasse <daniel@degrasse.com>
# SPDX-License-Identifier: Apache-2.0
if(SB_CONFIG_SOC_SERIES_IMXRT11XX)
# Include RT11XX specific sysbuild
include(${SOC_${SB_CONFIG_SOC}_DIR}/imxrt11xx/sysbuild.cmake OPTIONAL)
endif()