Skip to content

Commit 928b82f

Browse files
committed
samples: openamp: add support for stm32h747i_disco board
This add openamp sample run on stm32h747i_disco board. The CM7 on stm32h747 support memory cache. If the cache enabled on CM7, CM4 will receive incorrect data. This just disable the memory cache on CM7, future user may want to use more flexible way to fix it. Signed-off-by: HaiLong Yang <cameledyang@pm.me>
1 parent 4792151 commit 928b82f

File tree

9 files changed

+47
-2
lines changed

9 files changed

+47
-2
lines changed

samples/subsys/ipc/openamp/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ elseif("${BOARD}" STREQUAL "mps2_an521")
1616
set(BOARD_REMOTE "mps2_an521_remote")
1717
elseif("${BOARD}" STREQUAL "v2m_musca_b1")
1818
set(BOARD_REMOTE "v2m_musca_b1_ns")
19+
elseif("${BOARD}" STREQUAL "stm32h747i_disco_m7")
20+
set(BOARD_REMOTE "stm32h747i_disco_m4")
1921
else()
2022
message(FATAL_ERROR "${BOARD} was not supported for this sample")
2123
endif()

samples/subsys/ipc/openamp/README.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ This application demonstrates how to use OpenAMP with Zephyr. It is designed to
1010
demonstrate how to integrate OpenAMP with Zephyr both from a build perspective
1111
and code.
1212

13+
This application contains an extra remote core project. Master core builds
14+
process will compile the remote too. Remote core builds directory located in
15+
``build/openamp_remote-prefix/src/openamp_remote-build``.
16+
1317
Building the application for lpcxpresso54114_m4
1418
***********************************************
1519

@@ -42,6 +46,19 @@ Building the application for v2m_musca_b1
4246
:board: v2m_musca_b1
4347
:goals: debug
4448

49+
Building the application for stm32h747i_disco_m7
50+
************************************************
51+
Build process will compile the stm32h747i_disco_m4 remote project too.
52+
53+
.. code-block:: console
54+
55+
# From the root of the zephyr repository
56+
west build -b stm32h747i_disco_m7 samples/subsys/ipc/openamp
57+
# Flash stm32h747i_disco_m7 application
58+
west flash
59+
# Flash stm32h747i_disco_m4 application
60+
west flash --build-dir build/openamp_remote-prefix/src/openamp_remote-build
61+
4562
Open a serial terminal (minicom, putty, etc.) and connect the board with the
4663
following settings:
4764

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
CONFIG_IPM_STM32_HSEM=y
2+
# Disable the memory cache, write to memory directly.
3+
CONFIG_NOCACHE_MEMORY=y
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/*
2+
* Copyright (c) 2021 BrainCo Inc.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/ {
8+
chosen {
9+
/* Shared memory reserved for the inter-processor communication */
10+
zephyr,ipc_shm = &sram4;
11+
zephyr,ipc = &mailbox;
12+
};
13+
};
14+
15+
&mailbox {
16+
status = "okay";
17+
};

samples/subsys/ipc/openamp/remote/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ cmake_minimum_required(VERSION 3.20.0)
88
if(("${BOARD}" STREQUAL "lpcxpresso54114_m0")
99
OR "${BOARD}" STREQUAL "lpcxpresso55s69_cpu1"
1010
OR "${BOARD}" STREQUAL "mps2_an521_remote"
11-
OR "${BOARD}" STREQUAL "v2m_musca_b1_ns")
11+
OR "${BOARD}" STREQUAL "v2m_musca_b1_ns"
12+
OR "${BOARD}" STREQUAL "stm32h747i_disco_m4")
1213
message(STATUS "${BOARD} compiles as remote in this sample")
1314
else()
1415
message(FATAL_ERROR "${BOARD} was not supported for this sample")
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CONFIG_IPM_STM32_HSEM=y

samples/subsys/ipc/openamp/remote/src/main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ static void virtio_notify(struct virtqueue *vq)
7878
uint32_t current_core = sse_200_platform_get_cpu_id();
7979

8080
ipm_send(ipm_handle, 0, current_core ? 0 : 1, 0, 1);
81+
#elif defined(CONFIG_IPM_STM32_HSEM)
82+
ipm_send(ipm_handle, 0, 0, NULL, 0);
8183
#else
8284
uint32_t dummy_data = 0x00110011; /* Some data must be provided */
8385

samples/subsys/ipc/openamp/sample.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ sample:
44
name: OpenAMP example integration
55
tests:
66
sample.ipc.openamp:
7-
platform_allow: lpcxpresso54114_m4 lpcxpresso55s69_cpu0 mps2_an521 v2m_musca_b1
7+
platform_allow: lpcxpresso54114_m4 lpcxpresso55s69_cpu0 mps2_an521 v2m_musca_b1 stm32h747i_disco_m7
88
tags: ipm
99
harness: console
1010
harness_config:

samples/subsys/ipc/openamp/src/main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ static void virtio_notify(struct virtqueue *vq)
8989
uint32_t current_core = sse_200_platform_get_cpu_id();
9090

9191
ipm_send(ipm_handle, 0, current_core ? 0 : 1, 0, 1);
92+
#elif defined(CONFIG_IPM_STM32_HSEM)
93+
ipm_send(ipm_handle, 0, 0, NULL, 0);
9294
#else
9395
uint32_t dummy_data = 0x55005500; /* Some data must be provided */
9496

0 commit comments

Comments
 (0)