Skip to content

Commit 8cd5104

Browse files
Phuc Phamtiennguyenzg
authored andcommitted
samples: boards: renesas: Add OpenAMP sample for Renesas RZ/V2L
Add OpenAMP sample support for board Renesas RZ/V2L-SMARC Signed-off-by: Phuc Pham <[email protected]> Signed-off-by: Tien Nguyen <[email protected]>
1 parent 1fda7d7 commit 8cd5104

File tree

3 files changed

+157
-17
lines changed

3 files changed

+157
-17
lines changed

samples/boards/renesas/openamp_linux_zephyr/README.rst

Lines changed: 70 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,39 @@ Building the application
2020
Zephyr
2121
======
2222

23-
Build command:
23+
Build command for RZ/G3S-SMARC
24+
------------------------------
2425

2526
.. zephyr-app-commands::
2627
:zephyr-app: samples/boards/renesas/openamp_linux_zephyr
2728
:board: rzg3s_smarc/r9a08g045s33gbg/cm33
2829
:goals: build
2930
:compact:
3031

32+
Build command for RZ/V2L-SMARC
33+
------------------------------
34+
35+
.. zephyr-app-commands::
36+
:zephyr-app: samples/boards/renesas/openamp_linux_zephyr
37+
:board: rzv2l_smarc/r9a07g054l23gbg/cm33
38+
:goals: build
39+
:compact:
40+
3141
Running the sample
32-
*************************
42+
******************
3343

3444
Linux setup
3545
===========
3646

37-
The sample currently supports the Linux RZ/G Multi-OS Package V2.2.0. The build steps for Renesas Multi-OS Package V2.2.0 are described below.
47+
For RZ/G3S-SMARC
48+
----------------
49+
50+
The sample currently supports the Linux RZ/G Multi-OS Package v3.0.0. The build steps for Renesas Multi-OS Package are described below.
3851

39-
1. Follow the procedures in ''3.Multi-OS Package Setup'' of `Release Note for RZ/G Multi-OS Package V2.2.0 <https://www.renesas.com/en/document/rln/release-note-rzg-multi-os-package-v220?r=1522841>`_
52+
1. Follow the procedures in ''3.2 Integration of Multi-OS Package related stuff'' of `Quick Start Guide for RZ/G3S Multi-OS Package`_
4053
without initiating the build process.
41-
2. For RZ/G3S, add ``PLAT_M33_BOOT_SUPPORT=1`` by following this guide:
42-
`RZ/G3S SMARC Evaluation Board Kit <https://docs.zephyrproject.org/latest/boards/renesas/rzg3s_smarc/doc/index.html#programming-and-debugging>`_
54+
55+
2. For RZ/G3S, add ``PLAT_M33_BOOT_SUPPORT=1`` by following this guide: `RZ/G3S SMARC Evaluation Board Kit`_
4356

4457
3. Insert the highlighted lines of code into the following file: meta-rz-features/meta-rz-multi-os/meta-rzg3s/recipes-example/rpmsg-sample/files/platform_info.c
4558

@@ -63,12 +76,44 @@ The sample currently supports the Linux RZ/G Multi-OS Package V2.2.0. The build
6376
6477
4. Start the build.
6578

66-
5. For deploying bootloader files, Linux kernel image, device tree and rootfs, follow the procedures in ''3.5.1 In case of configuring CA55 as Boot CPU'' of `Release Note for RZ/G Multi-OS Package V2.2.0 <https://www.renesas.com/en/document/rln/release-note-rzg-multi-os-package-v220?r=1522841>`_
79+
5. For deploying bootloader files, Linux kernel image, device tree and rootfs, please refer to: `SMARC EVK of RZ/G3S Linux Start-up Guide`_
80+
81+
For RZ/V2L-SMARC
82+
----------------
83+
84+
The sample currently supports the Linux RZ/V Multi-OS Package v3.1.1. The build steps for Renesas Multi-OS Package are described below.
85+
86+
1. Follow the steps (1) and (2) from the ''Flashing'' section of `RZ/V2L SMARC Evaluation Board Kit`_
87+
88+
2. Insert the highlighted lines of code into the following file: meta-rz-features/meta-rz-multi-os/meta-rzv2l/recipes-example/rpmsg-sample/files/platform_info.c
89+
90+
.. code-block:: c
91+
:emphasize-lines: 5,6,7,8,9,10
92+
93+
if (ret) {
94+
LPRINTF("failed rpmsg_init_vdev");
95+
goto err;
96+
}
97+
/* RPMsg virtio enables callback for avail flags */
98+
ret = virtqueue_enable_cb(rpmsg_vdev->rvq);
99+
if (ret) {
100+
LPRINTF("Failed release availability flags");
101+
goto err;
102+
}
103+
#ifndef __linux__ /* uC3 */
104+
start_ipi_task(rproc);
105+
#endif
106+
return rpmsg_virtio_get_rpmsg_device(rpmsg_vdev);
107+
108+
3. Start the build.
109+
110+
4. For deploying bootloader files, Linux kernel image, device tree and rootfs, follow the steps (4) to (8) from the ''Flashing'' section of
111+
`RZ/V2L SMARC Evaluation Board Kit`_
67112

68113
Zephyr setup
69114
============
70115

71-
1. Flash the sample to the board.
116+
1. Flash the sample to the board by following the ''Flashing'' instructions for your board.
72117

73118
2. Open a serial terminal (minicom, putty, etc.) and connect to the board with the following
74119
settings:
@@ -173,3 +218,20 @@ The following message will appear on the Zephyr console.
173218
I: OpenAMP[remote] Linux sample client responder started
174219
I: OpenAMP demo ended
175220
I: OpenAMP Linux sample client responder ended
221+
222+
References
223+
**********
224+
225+
.. target-notes::
226+
227+
.. _Quick Start Guide for RZ/G3S Multi-OS Package:
228+
https://www.renesas.com/en/document/qsg/quick-start-guide-rzg3s-multi-os-package
229+
230+
.. _RZ/G3S SMARC Evaluation Board Kit:
231+
https://docs.zephyrproject.org/latest/boards/renesas/rzg3s_smarc/doc/index.html#programming-and-debugging
232+
233+
.. _SMARC EVK of RZ/G3S Linux Start-up Guide:
234+
https://www.renesas.com/en/document/gde/smarc-evk-rzg3s-linux-start-guide-rev106
235+
236+
.. _RZ/V2L SMARC Evaluation Board Kit:
237+
https://docs.zephyrproject.org/latest/boards/renesas/rzv2l_smarc/doc/index.html#flashing
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
/*
2+
* Copyright (c) 2025 Renesas Electronics Corporation
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
/ {
7+
/*
8+
* Allocating whole openamp region as reserved memory
9+
* to save MPU entries
10+
*/
11+
reserved-memory {
12+
#address-cells = <1>;
13+
#size-cells = <1>;
14+
ranges;
15+
16+
openamp_shm: memory-region@62F00000 {
17+
compatible = "zephyr,memory-region";
18+
reg = <0x62F00000 0x900000>;
19+
zephyr,memory-region = "openamp_memory";
20+
zephyr,memory-attr = <( DT_MEM_ARM(ATTR_MPU_IO) )>;
21+
};
22+
};
23+
24+
chosen {
25+
zephyr,ipc_shm = &vring_shm0;
26+
zephyr,ipc = &mbox_consumer;
27+
};
28+
29+
vring_ctrl0: memory@63000000 {
30+
compatible = "mmio-sram";
31+
reg = <0x63000000 0x50000>;
32+
};
33+
34+
vring_ctrl1: memory@63050000 {
35+
compatible = "mmio-sram";
36+
reg = <0x63050000 0x50000>;
37+
};
38+
39+
vring_shm0: memory@63200000 {
40+
compatible = "mmio-sram";
41+
reg = <0x63200000 0x300000>;
42+
};
43+
44+
rsctbl: memory@62F00000 {
45+
compatible = "mmio-sram";
46+
reg = <0x62F00000 0x1000>;
47+
};
48+
49+
mhu1_shm: memory@62F01008 {
50+
compatible = "mmio-sram";
51+
reg = <0x62F01008 0x8>;
52+
};
53+
54+
mhu3_shm: memory@62F01018 {
55+
compatible = "mmio-sram";
56+
reg = <0x62F01018 0x8>;
57+
};
58+
59+
mhu4_shm: memory@62F01020 {
60+
compatible = "mmio-sram";
61+
reg = <0x62F01020 0x8>;
62+
};
63+
64+
mhu5_shm: memory@62F01028 {
65+
compatible = "mmio-sram";
66+
reg = <0x62F01028 0x8>;
67+
};
68+
69+
mbox_consumer: mbox-consumer {
70+
compatible = "vnd,mbox-consumer";
71+
mboxes = <&mbox1 1>, <&mbox1 0>;
72+
mbox-names = "tx", "rx";
73+
};
74+
75+
};
76+
77+
&mbox1 {
78+
shared-memory = <&mhu1_shm>;
79+
status = "okay";
80+
};

samples/boards/renesas/openamp_linux_zephyr/src/main_remote.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ static void new_service_cb(struct rpmsg_device *rdev, const char *name, uint32_t
122122
int mailbox_notify(void *priv, uint32_t id)
123123
{
124124
ARG_UNUSED(priv);
125-
126125
mbox_send_dt(&tx_channel, NULL);
127126
return 0;
128127
}
@@ -209,7 +208,6 @@ static void platform_deinit(void)
209208
static void cleanup_system(void)
210209
{
211210
struct fw_resource_table *rsc_tbl = (struct fw_resource_table *)RSC_TABLE_ADDR;
212-
213211
rpmsg_deinit_vdev(&rvdev);
214212
rproc_virtio_remove_vdev(rvdev.vdev);
215213
/*
@@ -236,13 +234,6 @@ struct rpmsg_device *platform_create_rpmsg_vdev(unsigned int vdev_index, unsigne
236234
return NULL;
237235
}
238236

239-
/* Set gfeatures because they should be equal to dfeatures
240-
* when create_ept is called. As rproc_virtio_create_vdev
241-
* doesn't set them because its VIRTIO_DEVICE not DRIVER.
242-
* Assume the virtio driver support all remote features.
243-
*/
244-
virtio_set_features(vdev, 0x1);
245-
246237
/* wait master rpmsg init completion */
247238
rproc_virtio_wait_remote_ready(vdev);
248239

@@ -264,6 +255,13 @@ struct rpmsg_device *platform_create_rpmsg_vdev(unsigned int vdev_index, unsigne
264255
goto failed;
265256
}
266257

258+
/* Set gfeatures because they should be equal to dfeatures
259+
* when create_ept is called. As rproc_virtio_create_vdev
260+
* doesn't set them because its VIRTIO_DEVICE not DRIVER.
261+
* Assume the virtio driver support all remote features.
262+
*/
263+
virtio_set_features(vdev, 0x1);
264+
267265
rpmsg_virtio_init_shm_pool(&shpool, NULL, SHM_SIZE);
268266
ret = rpmsg_init_vdev(&rvdev, vdev, ns_cb, shm_io, &shpool);
269267

0 commit comments

Comments
 (0)