samples: mbox: Add support for NXP RT boards

This commit adds mbox sample support for these NXP boards:
 - MIMXRT1160-EVK
 - MIMXRT1170-EVK
 - MIMXRT1170-EVKB

Signed-off-by: Tomas Galbicka <tomas.galbicka@nxp.com>
This commit is contained in:
Tomas Galbicka 2023-12-21 14:15:22 +00:00 committed by Maureen Helm
commit d161d05e33
18 changed files with 307 additions and 1 deletions

View file

@ -1,5 +1,6 @@
#
# Copyright (c) 2021 Carlo Caione <ccaione@baylibre.com>
# Copyright 2023 NXP
#
# SPDX-License-Identifier: Apache-2.0
#
@ -8,9 +9,14 @@ cmake_minimum_required(VERSION 3.20.0)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
set(REMOTE_ZEPHYR_DIR ${CMAKE_CURRENT_BINARY_DIR}/../remote/zephyr)
if(("${BOARD}" STREQUAL "nrf5340dk_nrf5340_cpuapp") OR
("${BOARD}" STREQUAL "nrf5340bsim_nrf5340_cpuapp") OR
("${BOARD}" STREQUAL "adp_xc7k_ae350") OR
("${BOARD}" STREQUAL "mimxrt1170_evkb_cm7") OR
("${BOARD}" STREQUAL "mimxrt1170_evk_cm7") OR
("${BOARD}" STREQUAL "mimxrt1160_evk_cm7") OR
("${BOARD}" STREQUAL "mimxrt595_evk_cm33"))
message(STATUS "${BOARD} compile as Main in this sample")
else()
@ -21,4 +27,9 @@ project(mbox_ipc)
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.c)

View file

@ -0,0 +1,11 @@
# Copyright 2023 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

@ -1,4 +1,5 @@
# Copyright 2023 Nordic Semiconductor ASA
# Copyright 2023 NXP
#
# SPDX-License-Identifier: Apache-2.0
@ -10,3 +11,6 @@ string
default "nrf5340bsim_nrf5340_cpunet" if $(BOARD) = "nrf5340bsim_nrf5340_cpuapp"
default "adp_xc7k_ae350" if $(BOARD) = "adp_xc7k_ae350"
default "nrf5340dk_nrf5340_cpunet" if $(BOARD) = "mimxrt595_evk_cm33"
default "mimxrt1170_evkb_cm4" if $(BOARD) = "mimxrt1170_evkb_cm7"
default "mimxrt1170_evk_cm4" if $(BOARD) = "mimxrt1170_evk_cm7"
default "mimxrt1160_evk_cm4" if $(BOARD) = "mimxrt1160_evk_cm7"

View file

@ -0,0 +1,3 @@
CONFIG_MBOX_NXP_IMX_MU=y
CONFIG_INCLUDE_REMOTE_DIR=y
CONFIG_SECOND_CORE_MCUX=y

View file

@ -0,0 +1,29 @@
/*
* Copyright 2023 NXP
*
* SPDX-License-Identifier: Apache-2.0
*/
/ {
chosen {
/* Delete ipc chosen property where old IPM mailbox driver bellow is
* configured.
*/
/delete-property/ zephyr,ipc;
};
soc {
/* Delete IPM Driver node nxp,imx-mu */
/delete-node/ mailbox@40c48000;
/* Attach MBOX driver to MU Unit */
mbox:mbox@40c48000 {
compatible = "nxp,mbox-imx-mu";
reg = <0x40c48000 0x4000>;
interrupts = <118 0>;
rx-channels = <4>;
#mbox-cells = <1>;
status = "okay";
};
};
};

View file

@ -0,0 +1,3 @@
CONFIG_MBOX_NXP_IMX_MU=y
CONFIG_INCLUDE_REMOTE_DIR=y
CONFIG_SECOND_CORE_MCUX=y

View file

@ -0,0 +1,29 @@
/*
* Copyright 2023 NXP
*
* SPDX-License-Identifier: Apache-2.0
*/
/ {
chosen {
/* Delete ipc chosen property where old IPM mailbox driver bellow is
* configured.
*/
/delete-property/ zephyr,ipc;
};
soc {
/* Delete IPM Driver node nxp,imx-mu */
/delete-node/ mailbox@40c48000;
/* Attach MBOX driver to MU Unit */
mbox:mbox@40c48000 {
compatible = "nxp,mbox-imx-mu";
reg = <0x40c48000 0x4000>;
interrupts = <118 0>;
rx-channels = <4>;
#mbox-cells = <1>;
status = "okay";
};
};
};

View file

@ -0,0 +1,3 @@
CONFIG_MBOX_NXP_IMX_MU=y
CONFIG_SECOND_CORE_MCUX=y
CONFIG_INCLUDE_REMOTE_DIR=y

View file

@ -0,0 +1,29 @@
/*
* Copyright 2023 NXP
*
* SPDX-License-Identifier: Apache-2.0
*/
/ {
chosen {
/* Delete ipc chosen property where old IPM mailbox driver bellow is
* configured.
*/
/delete-property/ zephyr,ipc;
};
soc {
/* Delete IPM Driver node nxp,imx-mu */
/delete-node/ mailbox@40c48000;
/* Attach MBOX driver to MU Unit */
mbox:mbox@40c48000 {
compatible = "nxp,mbox-imx-mu";
reg = <0x40c48000 0x4000>;
interrupts = <118 0>;
rx-channels = <4>;
#mbox-cells = <1>;
status = "okay";
};
};
};

View file

@ -1,5 +1,6 @@
#
# Copyright (c) 2021 Carlo Caione <ccaione@baylibre.com>
# Copyright 2023 NXP
#
# SPDX-License-Identifier: Apache-2.0
#
@ -10,6 +11,9 @@ find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
if(("${BOARD}" STREQUAL "nrf5340dk_nrf5340_cpunet") OR
("${BOARD}" STREQUAL "nrf5340bsim_nrf5340_cpunet") OR
("${BOARD}" STREQUAL "mimxrt1170_evkb_cm4") OR
("${BOARD}" STREQUAL "mimxrt1170_evk_cm4") OR
("${BOARD}" STREQUAL "mimxrt1160_evk_cm4") OR
("${BOARD}" STREQUAL "adp_xc7k_ae350"))
message(STATUS "${BOARD} compile as remote in this sample")
else()

View file

@ -0,0 +1,4 @@
CONFIG_MBOX_NXP_IMX_MU=y
CONFIG_BUILD_OUTPUT_INFO_HEADER=y
CONFIG_BUILD_OUTPUT_HEX=y
CONFIG_SECOND_CORE_MCUX=y

View file

@ -0,0 +1,48 @@
/*
* Copyright 2023 NXP
*
* SPDX-License-Identifier: Apache-2.0
*/
/ {
chosen {
zephyr,flash = &ocram;
zephyr,console = &lpuart1;
zephyr,shell-uart = &lpuart1;
/* Delete ipc chosen property where old IPM mailbox driver bellow is
* configured.
*/
/delete-property/ zephyr,ipc;
};
soc {
/delete-node/ gpt@400f0000;
/* Replace GPT2 with another GPT kernel timer */
gpt2_hw_timer:gpt@400f0000 {
compatible = "nxp,gpt-hw-timer";
reg = <0x400f0000 0x4000>;
interrupts = <120 0>;
status = "okay";
};
/* Delete IPM Driver node nxp,imx-mu */
/delete-node/ mailbox@40c4c000;
/* Attach MBOX driver to MU Unit */
mbox:mbox@40c4c000 {
compatible = "nxp,mbox-imx-mu";
reg = <0x40c4c000 0x4000>;
interrupts = <118 0>;
rx-channels = <4>;
#mbox-cells = <1>;
status = "okay";
};
};
};
/* Disable primary GPT timer */
&gpt_hw_timer {
status = "disabled";
};

View file

@ -0,0 +1,4 @@
CONFIG_MBOX_NXP_IMX_MU=y
CONFIG_BUILD_OUTPUT_INFO_HEADER=y
CONFIG_BUILD_OUTPUT_HEX=y
CONFIG_SECOND_CORE_MCUX=y

View file

@ -0,0 +1,48 @@
/*
* Copyright 2023 NXP
*
* SPDX-License-Identifier: Apache-2.0
*/
/ {
chosen {
zephyr,flash = &ocram;
zephyr,console = &lpuart1;
zephyr,shell-uart = &lpuart1;
/* Delete ipc chosen property where old IPM mailbox driver bellow is
* configured.
*/
/delete-property/ zephyr,ipc;
};
soc {
/delete-node/ gpt@400f0000;
/* Replace GPT2 with another GPT kernel timer */
gpt2_hw_timer:gpt@400f0000 {
compatible = "nxp,gpt-hw-timer";
reg = <0x400f0000 0x4000>;
interrupts = <120 0>;
status = "okay";
};
/* Delete IPM Driver node nxp,imx-mu */
/delete-node/ mailbox@40c4c000;
/* Attach MBOX driver to MU Unit */
mbox:mbox@40c4c000 {
compatible = "nxp,mbox-imx-mu";
reg = <0x40c4c000 0x4000>;
interrupts = <118 0>;
rx-channels = <4>;
#mbox-cells = <1>;
status = "okay";
};
};
};
/* Disable primary GPT timer */
&gpt_hw_timer {
status = "disabled";
};

View file

@ -0,0 +1,4 @@
CONFIG_MBOX_NXP_IMX_MU=y
CONFIG_BUILD_OUTPUT_INFO_HEADER=y
CONFIG_BUILD_OUTPUT_HEX=y
CONFIG_SECOND_CORE_MCUX=y

View file

@ -0,0 +1,49 @@
/*
* Copyright 2023 NXP
*
* SPDX-License-Identifier: Apache-2.0
*/
/ {
chosen {
zephyr,flash = &ocram;
zephyr,console = &lpuart1;
zephyr,shell-uart = &lpuart1;
/* Delete ipc chosen property where old IPM mailbox driver bellow is
* configured.
*/
/delete-property/ zephyr,ipc;
};
soc {
/delete-node/ gpt@400f0000;
/* Replace GPT2 with another GPT kernel timer */
gpt2_hw_timer:gpt@400f0000 {
compatible = "nxp,gpt-hw-timer";
reg = <0x400f0000 0x4000>;
interrupts = <120 0>;
status = "okay";
};
/* Delete IPM Driver node nxp,imx-mu */
/delete-node/ mailbox@40c4c000;
/* Attach MBOX driver to MU Unit */
mbox:mbox@40c4c000 {
compatible = "nxp,mbox-imx-mu";
reg = <0x40c4c000 0x4000>;
interrupts = <118 0>;
rx-channels = <4>;
#mbox-cells = <1>;
status = "okay";
};
};
};
/* Disable primary GPT timer */
&gpt_hw_timer {
status = "disabled";
};

View file

@ -9,9 +9,20 @@ tests:
- nrf5340dk_nrf5340_cpuapp
- adp_xc7k_ae350
- mimxrt595_evk_cm33
- mimxrt1170_evkb_cm7
- mimxrt1170_evk_cm7
- mimxrt1160_evk_cm7
integration_platforms:
- nrf5340dk_nrf5340_cpuapp
harness: remote
harness: console
harness_config:
type: multi_line
ordered: false
regex:
- "Ping \\(on channel 0\\)"
- "Pong \\(on channel 0\\)"
- "Ping \\(on channel 1\\)"
- "Pong \\(on channel 1\\)"
sample.drivers.mbox.simu:
platform_allow:
- nrf5340bsim_nrf5340_cpuapp

View file

@ -1,4 +1,5 @@
# Copyright (c) 2023 Nordic Semiconductor ASA
# Copyright 2023 NXP
# SPDX-License-Identifier: Apache-2.0
if("${SB_CONFIG_REMOTE_BOARD}" STREQUAL "")
@ -18,3 +19,14 @@ ExternalZephyrProject_Add(
native_simulator_set_child_images(${DEFAULT_IMAGE} ${REMOTE_APP})
native_simulator_set_final_executable(${DEFAULT_IMAGE})
if ("${BOARD}" STREQUAL "mimxrt1170_evkb_cm7" OR
"${BOARD}" STREQUAL "mimxrt1170_evk_cm7" OR
"${BOARD}" STREQUAL "mimxrt1160_evk_cm7"
)
# For these NXP boards the main core application is dependent on
# 'zephyr_image_info.h' generated by remote application.
# Let's build the remote application first
add_dependencies(${DEFAULT_IMAGE} ${REMOTE_APP})
endif()