samples: ipc: icmsg: Add support for stm32h747i_disco

With the addition of the STM32 hardware semaphore MBOX driver, ICMsg is
now supported on the stm32h747i_disco board.

Signed-off-by: Celina Sophie Kalus <hello@celinakalus.de>
This commit is contained in:
Celina Sophie Kalus 2024-05-02 14:35:18 +02:00 committed by Anas Nashif
parent 7da8ca3113
commit 3290da8f1d
8 changed files with 105 additions and 4 deletions

View file

@ -8,7 +8,8 @@ cmake_minimum_required(VERSION 3.20.0)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
if(NOT CONFIG_BOARD_NRF5340DK_NRF5340_CPUAPP)
if(NOT CONFIG_BOARD_NRF5340DK_NRF5340_CPUAPP AND
NOT CONFIG_BOARD_STM32H747I_DISCO)
message(FATAL_ERROR "${BOARD} is not supported for this sample")
endif()

View file

@ -4,6 +4,7 @@
source "share/sysbuild/Kconfig"
config NET_CORE_BOARD
config REMOTE_BOARD
string
default "nrf5340dk/nrf5340/cpunet" if $(BOARD) = "nrf5340dk"
default "stm32h747i_disco/stm32h747xx/m4" if $(BOARD) = "stm32h747i_disco"

View file

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

View file

@ -0,0 +1,41 @@
/*
* Copyright (c) 2024 Celina Sophie Kalus <hello@celinakalus.de>
*
* SPDX-License-Identifier: Apache-2.0
*/
/ {
chosen {
/delete-property/ zephyr,ipc_shm;
};
/* Define new memory regions for TX and RX */
/delete-node/ memory@38000000;
sram_tx: memory@38000000 {
zephyr,memory-region = "SRAM_TX";
compatible = "zephyr,memory-region", "mmio-sram";
reg = <0x38000000 0x08000>;
zephyr,memory-attr = <( DT_MEM_ARM(ATTR_MPU_RAM_NOCACHE) )>;
};
sram_rx: memory@38008000 {
zephyr,memory-region = "SRAM_RX";
compatible = "zephyr,memory-region", "mmio-sram";
reg = <0x38008000 0x08000>;
zephyr,memory-attr = <( DT_MEM_ARM(ATTR_MPU_RAM_NOCACHE) )>;
};
ipc0: ipc0 {
compatible = "zephyr,ipc-icmsg";
tx-region = <&sram_tx>;
rx-region = <&sram_rx>;
mboxes = <&mailbox 11>, <&mailbox 10>;
mbox-names = "tx", "rx";
status = "okay";
};
};
&mailbox {
status = "okay";
};

View file

@ -0,0 +1,5 @@
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
CONFIG_LOG_BACKEND_UART=y
CONFIG_MBOX_STM32_HSEM=y

View file

@ -0,0 +1,48 @@
/*
* Copyright (c) 2024 Celina Sophie Kalus <hello@celinakalus.de>
*
* SPDX-License-Identifier: Apache-2.0
*/
/ {
chosen {
/delete-property/ zephyr,ipc_shm;
zephyr,console = &uart8;
zephyr,shell-uart = &uart8;
};
/* Define new memory regions for TX and RX */
/delete-node/ memory@38000000;
sram_rx: memory@38000000 {
zephyr,memory-region = "SRAM_RX";
compatible = "zephyr,memory-region", "mmio-sram";
reg = <0x38000000 0x08000>;
zephyr,memory-attr = <( DT_MEM_ARM(ATTR_MPU_RAM_NOCACHE) )>;
};
sram_tx: memory@38008000 {
zephyr,memory-region = "SRAM_TX";
compatible = "zephyr,memory-region", "mmio-sram";
reg = <0x38008000 0x08000>;
zephyr,memory-attr = <( DT_MEM_ARM(ATTR_MPU_RAM_NOCACHE) )>;
};
ipc0: ipc0 {
compatible = "zephyr,ipc-icmsg";
tx-region = <&sram_tx>;
rx-region = <&sram_rx>;
mboxes = <&mailbox 10>, <&mailbox 11>;
mbox-names = "tx", "rx";
status = "okay";
};
};
&uart8 {
status = "okay";
};
&mailbox {
status = "okay";
};

View file

@ -8,7 +8,9 @@
#include <zephyr/device.h>
#include <zephyr/ipc/ipc_service.h>
#if CONFIG_NET_CORE_BOARD
#include <nrf53_cpunet_mgmt.h>
#endif /* CONFIG_NET_CORE_BOARD */
#include <string.h>
#include "common.h"
@ -137,6 +139,7 @@ int main(void)
LOG_INF("Received %zu [Bytes] in total", received);
#if CONFIG_NET_CORE_BOARD
LOG_INF("Stop network core");
nrf53_cpunet_enable(false);
@ -175,6 +178,7 @@ int main(void)
LOG_ERR("send_for_time() failure");
return ret;
}
#endif /* CONFIG_NET_CORE_BOARD */
LOG_INF("IPC-service HOST demo ended");

View file

@ -1,7 +1,7 @@
# Copyright (c) 2023 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
if("${SB_CONFIG_NET_CORE_BOARD}" STREQUAL "")
if ("${SB_CONFIG_REMOTE_BOARD}" STREQUAL "")
message(FATAL_ERROR
"Target ${BOARD} not supported for this sample. "
"There is no remote board selected in Kconfig.sysbuild")
@ -10,5 +10,5 @@ endif()
ExternalZephyrProject_Add(
APPLICATION remote
SOURCE_DIR ${APP_DIR}/remote
BOARD ${SB_CONFIG_NET_CORE_BOARD}
BOARD ${SB_CONFIG_REMOTE_BOARD}
)