Skip to content

Commit 3b56169

Browse files
authored
Merge pull request #830 from iabdalkader/update_openamp_config
RPC: Update openamp config and RPC examples.
2 parents 5499bd3 + 7c1cb26 commit 3b56169

File tree

15 files changed

+43
-17
lines changed

15 files changed

+43
-17
lines changed

libraries/RPC/examples/Basic_AddSub/Basic_AddSub.ino

+27-3
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,46 @@ int add(int a, int b) {
44
return a + b;
55
}
66

7-
void setup() {
7+
int sub(int a, int b) {
8+
return a - b;
9+
}
10+
11+
void setup() {
12+
Serial.begin(115200);
13+
while (!Serial) {
14+
15+
}
16+
817
RPC.begin();
918
RPC.bind("add", add);
19+
RPC.bind("sub", sub);
20+
if (HAL_GetCurrentCPUID() == CM7_CPUID) {
21+
// Introduce a brief delay to allow the M4 sufficient time
22+
// to bind remote functions before invoking them.
23+
delay(100);
24+
}
1025
pinMode(LEDG, OUTPUT);
1126
}
1227

1328
void loop() {
1429
static size_t loop_count = 0;
30+
1531
// Blink every 512 iterations
16-
if ((loop_count++ % 512) == 0) {
32+
if (HAL_GetCurrentCPUID() == CM4_CPUID && (loop_count++ % 512) == 0) {
1733
digitalWrite(LEDG, LOW);
1834
delay(10);
1935
digitalWrite(LEDG, HIGH);
2036
delay(10);
2137
}
38+
2239
int res = RPC.call("add", 1, 2).as<int>();
23-
RPC.call("sub", res, 1).as<int>();
40+
if (HAL_GetCurrentCPUID() == CM7_CPUID) {
41+
Serial.println("add(1, 2) = " + String(res));
42+
}
43+
44+
res = RPC.call("sub", res, 1).as<int>();
45+
if (HAL_GetCurrentCPUID() == CM7_CPUID) {
46+
Serial.println("sub(3, 1) = " + String(res));
47+
}
2448
delay(250);
2549
}

libraries/RPC/examples/MD5_Checksum/MD5_Checksum.ino

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ size_t hash_out_count = 0;
77
#ifdef CORE_CM4
88
size_t data_buf_size = 0;
99
#else
10-
size_t data_buf_size = 512;
10+
size_t data_buf_size = 256;
1111
#endif
1212

1313
typedef std::vector<byte> vec_t;
@@ -59,6 +59,8 @@ void setup() {
5959
#ifdef CORE_CM4
6060
RPC.bind("set_buffer_size", set_buffer_size);
6161
#else
62+
// Introduce a brief delay to allow the M4 sufficient time
63+
// to bind remote functions before invoking them.
6264
delay(100);
6365
auto ret = RPC.call("set_buffer_size", data_buf_size).as<size_t>();
6466
#endif

libraries/openamp_arduino/src/openamp_conf.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ extern int __OPENAMP_region_end__[];
158158
#define VRING_BUFF_ADDRESS (SHM_START_ADDRESS + 0x2000)
159159
#define VRING_BUFF_SIZE (SHM_SIZE - 0x2000)
160160
#define VRING_ALIGNMENT 32
161-
#define VRING_NUM_BUFFS 16 /* number of rpmsg buffers */
161+
#define VRING_NUM_BUFFS 64 /* number of rpmsg buffers */
162162

163163
/* Fixed parameter */
164164
#define NUM_RESOURCE_ENTRIES 2

variants/GENERIC_STM32H747_M4/conf/mbed_app.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"VIRTIO_DEVICE_ONLY",
2323
"NO_ATOMIC_64_SUPPORT",
2424
"METAL_MAX_DEVICE_REGIONS=2",
25-
"RPMSG_BUFFER_SIZE=2048"
25+
"RPMSG_BUFFER_SIZE=512"
2626
]
2727
}
2828
}

variants/GENERIC_STM32H747_M4/defines.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
-DMETAL_MAX_DEVICE_REGIONS=2
5353
-DNO_ATOMIC_64_SUPPORT
5454
-DNO_VTOR_RELOCATE
55-
-DRPMSG_BUFFER_SIZE=2048
55+
-DRPMSG_BUFFER_SIZE=512
5656
-DSTM32H747xx
5757
-DTARGET_CORDIO
5858
-DTARGET_CORTEX

variants/GIGA/conf/mbed_app.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"VIRTIO_DRIVER_ONLY",
1717
"NO_ATOMIC_64_SUPPORT",
1818
"METAL_MAX_DEVICE_REGIONS=2",
19-
"RPMSG_BUFFER_SIZE=2048"
19+
"RPMSG_BUFFER_SIZE=512"
2020
]
2121
}
2222
}

variants/GIGA/defines.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
-DMETAL_MAX_DEVICE_REGIONS=2
5454
-DNO_ATOMIC_64_SUPPORT
5555
-DQSPI_NO_SAMPLE_SHIFT
56-
-DRPMSG_BUFFER_SIZE=2048
56+
-DRPMSG_BUFFER_SIZE=512
5757
-DSTM32H747xx
5858
-DTARGET_CORDIO
5959
-DTARGET_CORTEX

variants/NICLA_VISION/conf/mbed_app.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"VIRTIO_DRIVER_ONLY",
1818
"NO_ATOMIC_64_SUPPORT",
1919
"METAL_MAX_DEVICE_REGIONS=2",
20-
"RPMSG_BUFFER_SIZE=100"
20+
"RPMSG_BUFFER_SIZE=512"
2121
]
2222
}
2323
}

variants/NICLA_VISION/defines.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
-DMETAL_MAX_DEVICE_REGIONS=2
5555
-DNO_ATOMIC_64_SUPPORT
5656
-DQSPI_NO_SAMPLE_SHIFT
57-
-DRPMSG_BUFFER_SIZE=2048
57+
-DRPMSG_BUFFER_SIZE=512
5858
-DSTM32H747xx
5959
-DT1oI2C
6060
-DT1oI2C_UM11225

variants/OPTA/conf/mbed_app.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"VIRTIO_DRIVER_ONLY",
1717
"NO_ATOMIC_64_SUPPORT",
1818
"METAL_MAX_DEVICE_REGIONS=2",
19-
"RPMSG_BUFFER_SIZE=2048"
19+
"RPMSG_BUFFER_SIZE=512"
2020
]
2121
}
2222
}

variants/OPTA/defines.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
-DMETAL_MAX_DEVICE_REGIONS=2
5454
-DNO_ATOMIC_64_SUPPORT
5555
-DQSPI_NO_SAMPLE_SHIFT
56-
-DRPMSG_BUFFER_SIZE=2048
56+
-DRPMSG_BUFFER_SIZE=512
5757
-DSTM32H747xx
5858
-DTARGET_CORDIO
5959
-DTARGET_CORTEX

variants/PORTENTA_H7_M7/conf/mbed_app.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"VIRTIO_DRIVER_ONLY",
2323
"NO_ATOMIC_64_SUPPORT",
2424
"METAL_MAX_DEVICE_REGIONS=2",
25-
"RPMSG_BUFFER_SIZE=2048",
25+
"RPMSG_BUFFER_SIZE=512",
2626
"LSE_STARTUP_TIMEOUT=200"
2727
]
2828
}

variants/PORTENTA_H7_M7/defines.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
-DMETAL_MAX_DEVICE_REGIONS=2
5656
-DNO_ATOMIC_64_SUPPORT
5757
-DQSPI_NO_SAMPLE_SHIFT
58-
-DRPMSG_BUFFER_SIZE=2048
58+
-DRPMSG_BUFFER_SIZE=512
5959
-DSTM32H747xx
6060
-DTARGET_CORDIO
6161
-DTARGET_CORTEX

variants/PORTENTA_X8/conf/mbed_app.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"VIRTIO_DEVICE_ONLY",
1717
"NO_ATOMIC_64_SUPPORT",
1818
"METAL_MAX_DEVICE_REGIONS=2",
19-
"RPMSG_BUFFER_SIZE=2048"
19+
"RPMSG_BUFFER_SIZE=512"
2020
]
2121
}
2222
}

variants/PORTENTA_X8/defines.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
-DMETAL_MAX_DEVICE_REGIONS=2
4545
-DNO_ATOMIC_64_SUPPORT
4646
-DNO_VTOR_RELOCATE
47-
-DRPMSG_BUFFER_SIZE=2048
47+
-DRPMSG_BUFFER_SIZE=512
4848
-DSTM32H747xx
4949
-DTARGET_CORTEX
5050
-DTARGET_CORTEX_M

0 commit comments

Comments
 (0)