samples: openamp: Add support for mps2_an521
AN521 is a dual core FPGA on MPS2+ with both cores are CM33. Add openAMP to support on it. Core 0 is primary core, it runs as master, core 1 is remote, it runs as slave. Signed-off-by: Karl Zhang <karl.zhang@linaro.org>
This commit is contained in:
parent
faeeb4abea
commit
88c3679933
7 changed files with 55 additions and 3 deletions
|
@ -5,8 +5,13 @@ cmake_minimum_required(VERSION 3.13.1)
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
#
|
#
|
||||||
|
|
||||||
|
set(REMOTE_ZEPHYR_DIR ${CMAKE_CURRENT_BINARY_DIR}/openamp_remote-prefix/src/openamp_remote-build/zephyr)
|
||||||
|
|
||||||
if("${BOARD}" STREQUAL "lpcxpresso54114_m4")
|
if("${BOARD}" STREQUAL "lpcxpresso54114_m4")
|
||||||
set(BOARD_REMOTE "lpcxpresso54114_m0")
|
set(BOARD_REMOTE "lpcxpresso54114_m0")
|
||||||
|
elseif("${BOARD}" STREQUAL "mps2_an521")
|
||||||
|
set(QEMU_EXTRA_FLAGS "-device;loader,file=${REMOTE_ZEPHYR_DIR}/zephyr.elf")
|
||||||
|
set(BOARD_REMOTE "mps2_an521_nonsecure")
|
||||||
else()
|
else()
|
||||||
message(FATAL_ERROR "${BOARD} was not supported for this sample")
|
message(FATAL_ERROR "${BOARD} was not supported for this sample")
|
||||||
endif()
|
endif()
|
||||||
|
@ -28,7 +33,7 @@ ExternalProject_Add(
|
||||||
INSTALL_COMMAND "" # This particular build system has no install command
|
INSTALL_COMMAND "" # This particular build system has no install command
|
||||||
CMAKE_CACHE_ARGS -DBOARD:string=${BOARD_REMOTE}
|
CMAKE_CACHE_ARGS -DBOARD:string=${BOARD_REMOTE}
|
||||||
CMAKE_CACHE_ARGS -DDTC_OVERLAY_FILE:string=${DTC_OVERLAY_FILE}
|
CMAKE_CACHE_ARGS -DDTC_OVERLAY_FILE:string=${DTC_OVERLAY_FILE}
|
||||||
BUILD_BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/openamp_remote-prefix/src/openamp_remote-build/zephyr/zephyr.bin"
|
BUILD_BYPRODUCTS "${REMOTE_ZEPHYR_DIR}/zephyr.bin"
|
||||||
# NB: Do we need to pass on more CMake variables?
|
# NB: Do we need to pass on more CMake variables?
|
||||||
BUILD_ALWAYS True
|
BUILD_ALWAYS True
|
||||||
)
|
)
|
||||||
|
|
|
@ -18,6 +18,14 @@ Building the application for lpcxpresso54114_m4
|
||||||
:board: lpcxpresso54114_m4
|
:board: lpcxpresso54114_m4
|
||||||
:goals: debug
|
:goals: debug
|
||||||
|
|
||||||
|
Building the application for mps2_an521
|
||||||
|
***************************************
|
||||||
|
|
||||||
|
.. zephyr-app-commands::
|
||||||
|
:zephyr-app: samples/subsys/ipc/openamp
|
||||||
|
:board: mps2_an521
|
||||||
|
:goals: debug
|
||||||
|
|
||||||
Open a serial terminal (minicom, putty, etc.) and connect the board with the
|
Open a serial terminal (minicom, putty, etc.) and connect the board with the
|
||||||
following settings:
|
following settings:
|
||||||
|
|
||||||
|
|
20
samples/subsys/ipc/openamp/mps2_an521.overlay
Normal file
20
samples/subsys/ipc/openamp/mps2_an521.overlay
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2019 Linaro Limited
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
/ {
|
||||||
|
chosen {
|
||||||
|
/*
|
||||||
|
* shared memory reserved for the inter-processor communication
|
||||||
|
*/
|
||||||
|
zephyr,ipc_shm = &sramx;
|
||||||
|
zephyr,ipc = &mhu0;
|
||||||
|
};
|
||||||
|
|
||||||
|
sramx: memory@28180000 {
|
||||||
|
compatible = "mmio-sram";
|
||||||
|
reg = <0x28180000 0x8000>;
|
||||||
|
};
|
||||||
|
};
|
|
@ -4,7 +4,9 @@ cmake_minimum_required(VERSION 3.13.1)
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
#
|
#
|
||||||
if(("${BOARD}" STREQUAL "lpcxpresso54114_m0"))
|
|
||||||
|
if(("${BOARD}" STREQUAL "lpcxpresso54114_m0")
|
||||||
|
OR "${BOARD}" STREQUAL "mps2_an521_nonsecure")
|
||||||
message(INFO " ${BOARD} compile as slave in this sample")
|
message(INFO " ${BOARD} compile as slave in this sample")
|
||||||
else()
|
else()
|
||||||
message(FATAL_ERROR "${BOARD} was not supported for this sample")
|
message(FATAL_ERROR "${BOARD} was not supported for this sample")
|
||||||
|
|
|
@ -73,9 +73,15 @@ static u32_t virtio_get_features(struct virtio_device *vdev)
|
||||||
|
|
||||||
static void virtio_notify(struct virtqueue *vq)
|
static void virtio_notify(struct virtqueue *vq)
|
||||||
{
|
{
|
||||||
|
#if defined(CONFIG_SOC_MPS2_AN521)
|
||||||
|
u32_t current_core = sse_200_platform_get_cpu_id();
|
||||||
|
|
||||||
|
ipm_send(ipm_handle, 0, current_core ? 0 : 1, 0, 1);
|
||||||
|
#else
|
||||||
u32_t dummy_data = 0x00110011; /* Some data must be provided */
|
u32_t dummy_data = 0x00110011; /* Some data must be provided */
|
||||||
|
|
||||||
ipm_send(ipm_handle, 0, 0, &dummy_data, sizeof(dummy_data));
|
ipm_send(ipm_handle, 0, 0, &dummy_data, sizeof(dummy_data));
|
||||||
|
#endif /* #if defined(CONFIG_SOC_MPS2_AN521) */
|
||||||
}
|
}
|
||||||
|
|
||||||
struct virtio_dispatch dispatch = {
|
struct virtio_dispatch dispatch = {
|
||||||
|
|
|
@ -4,7 +4,7 @@ sample:
|
||||||
name: OpenAMP example integration
|
name: OpenAMP example integration
|
||||||
tests:
|
tests:
|
||||||
sample.ipc.openamp:
|
sample.ipc.openamp:
|
||||||
platform_whitelist: lpcxpresso54114_m4
|
platform_whitelist: lpcxpresso54114_m4 mps2_an521
|
||||||
tags: ipm
|
tags: ipm
|
||||||
harness: console
|
harness: console
|
||||||
harness_config:
|
harness_config:
|
||||||
|
|
|
@ -84,9 +84,15 @@ static void virtio_set_features(struct virtio_device *vdev,
|
||||||
|
|
||||||
static void virtio_notify(struct virtqueue *vq)
|
static void virtio_notify(struct virtqueue *vq)
|
||||||
{
|
{
|
||||||
|
#if defined(CONFIG_SOC_MPS2_AN521)
|
||||||
|
u32_t current_core = sse_200_platform_get_cpu_id();
|
||||||
|
|
||||||
|
ipm_send(ipm_handle, 0, current_core ? 0 : 1, 0, 1);
|
||||||
|
#else
|
||||||
u32_t dummy_data = 0x55005500; /* Some data must be provided */
|
u32_t dummy_data = 0x55005500; /* Some data must be provided */
|
||||||
|
|
||||||
ipm_send(ipm_handle, 0, 0, &dummy_data, sizeof(dummy_data));
|
ipm_send(ipm_handle, 0, 0, &dummy_data, sizeof(dummy_data));
|
||||||
|
#endif /* #if defined(CONFIG_SOC_MPS2_AN521) */
|
||||||
}
|
}
|
||||||
|
|
||||||
struct virtio_dispatch dispatch = {
|
struct virtio_dispatch dispatch = {
|
||||||
|
@ -279,6 +285,11 @@ void main(void)
|
||||||
k_thread_create(&thread_data, thread_stack, APP_TASK_STACK_SIZE,
|
k_thread_create(&thread_data, thread_stack, APP_TASK_STACK_SIZE,
|
||||||
(k_thread_entry_t)app_task,
|
(k_thread_entry_t)app_task,
|
||||||
NULL, NULL, NULL, K_PRIO_COOP(7), 0, K_NO_WAIT);
|
NULL, NULL, NULL, K_PRIO_COOP(7), 0, K_NO_WAIT);
|
||||||
|
|
||||||
|
#if defined(CONFIG_SOC_MPS2_AN521)
|
||||||
|
wakeup_cpu1();
|
||||||
|
k_sleep(500);
|
||||||
|
#endif /* #if defined(CONFIG_SOC_MPS2_AN521) */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure we clear out the status flag very early (before we bringup the
|
/* Make sure we clear out the status flag very early (before we bringup the
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue