Skip to content

Commit

Permalink
samples: ipc: static_vrings add NXP boards support
Browse files Browse the repository at this point in the history
This commit adds support for these NXP Multi-core boards for
IPC static_vrings sample using OpenAmp lib:
 - lpcxpresso55s69
 - mimxrt1160_evk
 - mimxrt1170_evk
 - mimxrt1170_evkb

Signed-off-by: Tomas Galbicka <[email protected]>
  • Loading branch information
TomasGalbickaNXP authored and aescolar committed Apr 30, 2024
1 parent bd699d0 commit 950382c
Show file tree
Hide file tree
Showing 22 changed files with 777 additions and 4 deletions.
15 changes: 14 additions & 1 deletion samples/subsys/ipc/ipc_service/static_vrings/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#
# Copyright (c) 2021 Carlo Caione <[email protected]>
# Copyright 2024 NXP
#
# SPDX-License-Identifier: Apache-2.0
#
Expand All @@ -8,12 +9,24 @@ cmake_minimum_required(VERSION 3.20.0)

find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})

if(NOT CONFIG_BOARD_NRF5340DK_NRF5340_CPUAPP)
set(REMOTE_ZEPHYR_DIR ${CMAKE_CURRENT_BINARY_DIR}/../remote/zephyr)

if(NOT (CONFIG_BOARD_NRF5340DK_NRF5340_CPUAPP OR
CONFIG_BOARD_LPCXPRESSO55S69_LPC55S69_CPU0 OR
CONFIG_BOARD_MIMXRT1160_EVK_MIMXRT1166_CM7 OR
CONFIG_BOARD_MIMXRT1170_EVK_MIMXRT1176_CM7
)
)
message(FATAL_ERROR "${BOARD} is not supported for this sample")
endif()

project(ipc_service)

if(CONFIG_INCLUDE_REMOTE_DIR)
target_include_directories(zephyr_interface
INTERFACE ${REMOTE_ZEPHYR_DIR}/include/public)
endif()

target_sources(app PRIVATE src/main.c)

include(ExternalProject)
11 changes: 11 additions & 0 deletions samples/subsys/ipc/ipc_service/static_vrings/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Copyright 2024 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
5 changes: 5 additions & 0 deletions samples/subsys/ipc/ipc_service/static_vrings/Kconfig.sysbuild
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright 2023 Nordic Semiconductor ASA
# Copyright 2024 NXP
#
# SPDX-License-Identifier: Apache-2.0

Expand All @@ -7,3 +8,7 @@ source "share/sysbuild/Kconfig"
config NET_CORE_BOARD
string
default "nrf5340dk/nrf5340/cpunet" if $(BOARD) = "nrf5340dk"
default "lpcxpresso55s69/lpc55s69/cpu1" if $(BOARD) = "lpcxpresso55s69"
default "mimxrt1160_evk/mimxrt1166/cm4" if $(BOARD) = "mimxrt1160_evk"
default "mimxrt1170_evk/mimxrt1176/cm4" if $(BOARD) = "mimxrt1170_evk"
default "mimxrt1170_evkb/mimxrt1176/cm4" if $(BOARD) = "mimxrt1170_evkb"
36 changes: 36 additions & 0 deletions samples/subsys/ipc/ipc_service/static_vrings/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,42 @@ Building the application for nrf5340dk/nrf5340/cpuapp
:goals: debug
:west-args: --sysbuild

Building the application for lpcxpresso55s69/lpc55s69/cpu0
**********************************************************

.. zephyr-app-commands::
:zephyr-app: samples/subsys/ipc/ipc_service/static_vrings
:board: lpcxpresso55s69/lpc55s69/cpu0
:goals: debug
:west-args: --sysbuild

Building the application for mimxrt1160_evk/mimxrt1166/cm7
**********************************************************

.. zephyr-app-commands::
:zephyr-app: samples/subsys/ipc/ipc_service/static_vrings
:board: mimxrt1160_evk/mimxrt1166/cm7
:goals: debug
:west-args: --sysbuild

Building the application for mimxrt1170_evk/mimxrt1176/cm7
**********************************************************

.. zephyr-app-commands::
:zephyr-app: samples/subsys/ipc/ipc_service/static_vrings
:board: mimxrt1170_evk/mimxrt1176/cm7
:goals: debug
:west-args: --sysbuild

Building the application for mimxrt1170_evk@B/mimxrt1176/cm7
************************************************************

.. zephyr-app-commands::
:zephyr-app: samples/subsys/ipc/ipc_service/static_vrings
:board: mimxrt1170_evk@B/mimxrt1176/cm7
:goals: debug
:west-args: --sysbuild

Open a serial terminal (minicom, putty, etc.) and connect the board with the
following settings:

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CONFIG_SECOND_CORE_MCUX=y
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/*
* Copyright 2024 NXP
*
* SPDX-License-Identifier: Apache-2.0
*/

#include <zephyr/dt-bindings/ipc_service/static_vrings.h>
#include <zephyr/dt-bindings/memory-attr/memory-attr-arm.h>

/ {
chosen {
/* Delete ipc chosen property where old IPM mailbox driver bellow is
* configured.
*/
/delete-property/ zephyr,ipc;
/delete-property/ zephyr,ipc_shm;
};

/* Define memory regions for IPC
* Note that shared memory must have specific MPU attributes set.
*/
sram4_ipc0: memory@20040000{
compatible = "zephyr,memory-region", "mmio-sram";
reg = <0x20040000 DT_SIZE_K(8)>;
zephyr,memory-region="SRAM4_IPC0";
zephyr,memory-attr = <( DT_MEM_ARM(ATTR_MPU_IO))>;
};

sram4_ipc1: memory@20042000{
compatible = "zephyr,memory-region", "mmio-sram";
reg = <0x20042000 DT_SIZE_K(8)>;
zephyr,memory-region="SRAM4_IPC1";
zephyr,memory-attr = <( DT_MEM_ARM(ATTR_MPU_IO))>;
};

soc {
/* Delete IPM Driver node nxp,lpc-mailbox */
/delete-node/ mailbox@8b000;

/* Attach MBOX driver to Mailbox Unit */
mbox:mailbox0@5008b000 {
compatible = "nxp,mbox-mailbox";
reg = <0x5008b000 0xEC>;
interrupts = <31 0>;
rx-channels = <4>;
#mbox-cells = <1>;
status = "okay";
};
};

ipc {
/delete-node/ ipc0;

ipc0: ipc0 {
compatible = "zephyr,ipc-openamp-static-vrings";
memory-region = <&sram4_ipc0>;
mboxes = <&mbox 0>, <&mbox 1>;
mbox-names = "tx", "rx";
role = "host";
status = "okay";
};

ipc1: ipc1 {
compatible = "zephyr,ipc-openamp-static-vrings";
memory-region = <&sram4_ipc1>;
mboxes = <&mbox 2>, <&mbox 3>;
mbox-names = "tx", "rx";
role = "host";
zephyr,priority = <1 PRIO_COOP>;
zephyr,buffer-size = <128>;
status = "okay";
};
};
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CONFIG_MBOX_NXP_IMX_MU=y
CONFIG_SECOND_CORE_MCUX=y
CONFIG_INCLUDE_REMOTE_DIR=y
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/*
* Copyright 2024 NXP
*
* SPDX-License-Identifier: Apache-2.0
*/

#include <zephyr/dt-bindings/ipc_service/static_vrings.h>
#include <zephyr/dt-bindings/memory-attr/memory-attr-arm.h>

/ {
chosen {
/* Delete ipc chosen property where old IPM mailbox driver bellow is
* configured.
*/
/delete-property/ zephyr,ipc;
/delete-property/ zephyr,ipc_shm;

zephyr,console = &lpuart1;
zephyr,shell-uart = &lpuart1;
};

/* Define memory regions for IPC
* Note that shared memory must have specific MPU attributes set.
*/
ocram2_ipc0: memory@202c0000{
compatible = "zephyr,memory-region", "mmio-sram";
reg = <0x202c0000 DT_SIZE_K(32)>;
zephyr,memory-region="OCRAM2_IPC0";
zephyr,memory-attr = <( DT_MEM_ARM(ATTR_MPU_IO))>;
};
ocram2_ipc1: memory@202c8000{
compatible = "zephyr,memory-region", "mmio-sram";
reg = <0x202c8000 DT_SIZE_K(32)>;
zephyr,memory-region="OCRAM2_IPC1";
zephyr,memory-attr = <( DT_MEM_ARM(ATTR_MPU_IO))>;
};

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";
};
};

ipc {
/delete-node/ ipc0;

ipc0: ipc0 {
compatible = "zephyr,ipc-openamp-static-vrings";
memory-region = <&ocram2_ipc0>;
mboxes = <&mbox 0>, <&mbox 1>;
mbox-names = "tx", "rx";
role = "host";
status = "okay";
};

ipc1: ipc1 {
compatible = "zephyr,ipc-openamp-static-vrings";
memory-region = <&ocram2_ipc1>;
mboxes = <&mbox 2>, <&mbox 3>;
mbox-names = "tx", "rx";
role = "host";
zephyr,priority = <1 PRIO_COOP>;
zephyr,buffer-size = <128>;
status = "okay";
};
};
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CONFIG_MBOX_NXP_IMX_MU=y
CONFIG_SECOND_CORE_MCUX=y
CONFIG_INCLUDE_REMOTE_DIR=y
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/*
* Copyright 2024 NXP
*
* SPDX-License-Identifier: Apache-2.0
*/

#include <zephyr/dt-bindings/ipc_service/static_vrings.h>
#include <zephyr/dt-bindings/memory-attr/memory-attr-arm.h>

/ {
chosen {
/* Delete ipc chosen property where old IPM mailbox driver bellow is
* configured.
*/
/delete-property/ zephyr,ipc;
/delete-property/ zephyr,ipc_shm;

zephyr,console = &lpuart1;
zephyr,shell-uart = &lpuart1;
};

/* Define memory regions for IPC
* Note that shared memory must have specific MPU attributes set.
*/
ocram2_ipc0: memory@202c0000{
compatible = "zephyr,memory-region", "mmio-sram";
reg = <0x202c0000 DT_SIZE_K(32)>;
zephyr,memory-region="OCRAM2_IPC0";
zephyr,memory-attr = <( DT_MEM_ARM(ATTR_MPU_IO))>;
};
ocram2_ipc1: memory@202c8000{
compatible = "zephyr,memory-region", "mmio-sram";
reg = <0x202c8000 DT_SIZE_K(32)>;
zephyr,memory-region="OCRAM2_IPC1";
zephyr,memory-attr = <( DT_MEM_ARM(ATTR_MPU_IO))>;
};

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";
};
};

ipc {
/delete-node/ ipc0;

ipc0: ipc0 {
compatible = "zephyr,ipc-openamp-static-vrings";
memory-region = <&ocram2_ipc0>;
mboxes = <&mbox 0>, <&mbox 1>;
mbox-names = "tx", "rx";
role = "host";
status = "okay";
};

ipc1: ipc1 {
compatible = "zephyr,ipc-openamp-static-vrings";
memory-region = <&ocram2_ipc1>;
mboxes = <&mbox 2>, <&mbox 3>;
mbox-names = "tx", "rx";
role = "host";
zephyr,priority = <1 PRIO_COOP>;
zephyr,buffer-size = <128>;
status = "okay";
};
};
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CONFIG_MBOX_NXP_IMX_MU=y
CONFIG_SECOND_CORE_MCUX=y
CONFIG_INCLUDE_REMOTE_DIR=y
Loading

0 comments on commit 950382c

Please sign in to comment.