Commit af94cf55 authored by Carlo Caione's avatar Carlo Caione Committed by Carles Cufi
Browse files

sample: mbox: Introduce MBOX NRFX IPC sample



Make use of the new MBOX APIs to create a ping-pong sample application.
This sample is using the NRFX IPC peripheral to send and receive signals
on different channels

Signed-off-by: default avatarCarlo Caione <ccaione@baylibre.com>
parent 012591c4
Loading
Loading
Loading
Loading
+36 −0
Original line number Diff line number Diff line
#
# Copyright (c) 2021 Carlo Caione <ccaione@baylibre.com>
#
# SPDX-License-Identifier: Apache-2.0
#

cmake_minimum_required(VERSION 3.20.0)

set(REMOTE_ZEPHYR_DIR ${CMAKE_CURRENT_BINARY_DIR}/mbox_ipc_remote-prefix/src/mbox_ipc_remote-build/zephyr)

if("${BOARD}" STREQUAL "nrf5340dk_nrf5340_cpuapp")
  set(BOARD_REMOTE "nrf5340dk_nrf5340_cpunet")
else()
  message(FATAL_ERROR "${BOARD} is not supported for this sample")
endif()

message(INFO " ${BOARD} compile as Main in this sample")

find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(mbox_ipc)

enable_language(C ASM)

target_sources(app PRIVATE src/main.c)

include(ExternalProject)

ExternalProject_Add(
  mbox_ipc_remote
  SOURCE_DIR ${APPLICATION_SOURCE_DIR}/remote
  INSTALL_COMMAND ""      # This particular build system has no install command
  CMAKE_CACHE_ARGS -DBOARD:STRING=${BOARD_REMOTE}
  BUILD_BYPRODUCTS "${REMOTE_ZEPHYR_DIR}/${KERNEL_BIN_NAME}"
  # NB: Do we need to pass on more CMake variables?
  BUILD_ALWAYS True
)
+2 −0
Original line number Diff line number Diff line
CONFIG_MBOX_NRFX=y
CONFIG_BOARD_ENABLE_CPUNET=y
+18 −0
Original line number Diff line number Diff line
/*
 * Copyright (c) 2021 Carlo Caione <ccaione@baylibre.com>
 *
 * SPDX-License-Identifier: Apache-2.0
 */

/ {
	soc {
		mbox: mbox@2a000 {
			compatible = "nordic,mbox-nrf-ipc";
			reg = <0x2a000 0x1000>;
			tx-mask = <0x0000ffff>;
			rx-mask = <0x0000ffff>;
			interrupts = <42 NRF_DEFAULT_IRQ_PRIORITY>;
			status = "okay";
		};
	};
};
+2 −0
Original line number Diff line number Diff line
CONFIG_PRINTK=y
CONFIG_MBOX=y
+18 −0
Original line number Diff line number Diff line
#
# Copyright (c) 2021 Carlo Caione <ccaione@baylibre.com>
#
# SPDX-License-Identifier: Apache-2.0
#

cmake_minimum_required(VERSION 3.20.0)

if("${BOARD}" STREQUAL "nrf5340dk_nrf5340_cpunet")
  message(INFO " ${BOARD} compile as remote in this sample")
else()
  message(FATAL_ERROR "${BOARD} is not supported for this sample")
endif()

find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(mbox_ipc_remote)

target_sources(app PRIVATE src/main.c)
Loading