Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RPC: Update openamp config and RPC examples. #830

Merged
merged 2 commits into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 27 additions & 3 deletions libraries/RPC/examples/Basic_AddSub/Basic_AddSub.ino
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,46 @@ int add(int a, int b) {
return a + b;
}

void setup() {
int sub(int a, int b) {
return a - b;
}

void setup() {
Serial.begin(115200);
while (!Serial) {

}

RPC.begin();
RPC.bind("add", add);
RPC.bind("sub", sub);
if (HAL_GetCurrentCPUID() == CM7_CPUID) {
// Introduce a brief delay to allow the M4 sufficient time
// to bind remote functions before invoking them.
delay(100);
}
pinMode(LEDG, OUTPUT);
}

void loop() {
static size_t loop_count = 0;

// Blink every 512 iterations
if ((loop_count++ % 512) == 0) {
if (HAL_GetCurrentCPUID() == CM4_CPUID && (loop_count++ % 512) == 0) {
digitalWrite(LEDG, LOW);
delay(10);
digitalWrite(LEDG, HIGH);
delay(10);
}

int res = RPC.call("add", 1, 2).as<int>();
RPC.call("sub", res, 1).as<int>();
if (HAL_GetCurrentCPUID() == CM7_CPUID) {
Serial.println("add(1, 2) = " + String(res));
}

res = RPC.call("sub", res, 1).as<int>();
if (HAL_GetCurrentCPUID() == CM7_CPUID) {
Serial.println("sub(3, 1) = " + String(res));
}
delay(250);
}
4 changes: 3 additions & 1 deletion libraries/RPC/examples/MD5_Checksum/MD5_Checksum.ino
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ size_t hash_out_count = 0;
#ifdef CORE_CM4
size_t data_buf_size = 0;
#else
size_t data_buf_size = 512;
size_t data_buf_size = 256;
#endif

typedef std::vector<byte> vec_t;
Expand Down Expand Up @@ -59,6 +59,8 @@ void setup() {
#ifdef CORE_CM4
RPC.bind("set_buffer_size", set_buffer_size);
#else
// Introduce a brief delay to allow the M4 sufficient time
// to bind remote functions before invoking them.
delay(100);
auto ret = RPC.call("set_buffer_size", data_buf_size).as<size_t>();
#endif
Expand Down
2 changes: 1 addition & 1 deletion libraries/openamp_arduino/src/openamp_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ extern int __OPENAMP_region_end__[];
#define VRING_BUFF_ADDRESS (SHM_START_ADDRESS + 0x2000)
#define VRING_BUFF_SIZE (SHM_SIZE - 0x2000)
#define VRING_ALIGNMENT 32
#define VRING_NUM_BUFFS 16 /* number of rpmsg buffers */
#define VRING_NUM_BUFFS 64 /* number of rpmsg buffers */

/* Fixed parameter */
#define NUM_RESOURCE_ENTRIES 2
Expand Down
2 changes: 1 addition & 1 deletion variants/GENERIC_STM32H747_M4/conf/mbed_app.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"VIRTIO_DEVICE_ONLY",
"NO_ATOMIC_64_SUPPORT",
"METAL_MAX_DEVICE_REGIONS=2",
"RPMSG_BUFFER_SIZE=2048"
"RPMSG_BUFFER_SIZE=512"
]
}
}
Expand Down
2 changes: 1 addition & 1 deletion variants/GENERIC_STM32H747_M4/defines.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
-DMETAL_MAX_DEVICE_REGIONS=2
-DNO_ATOMIC_64_SUPPORT
-DNO_VTOR_RELOCATE
-DRPMSG_BUFFER_SIZE=2048
-DRPMSG_BUFFER_SIZE=512
-DSTM32H747xx
-DTARGET_CORDIO
-DTARGET_CORTEX
Expand Down
2 changes: 1 addition & 1 deletion variants/GIGA/conf/mbed_app.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"VIRTIO_DRIVER_ONLY",
"NO_ATOMIC_64_SUPPORT",
"METAL_MAX_DEVICE_REGIONS=2",
"RPMSG_BUFFER_SIZE=2048"
"RPMSG_BUFFER_SIZE=512"
]
}
}
Expand Down
2 changes: 1 addition & 1 deletion variants/GIGA/defines.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
-DMETAL_MAX_DEVICE_REGIONS=2
-DNO_ATOMIC_64_SUPPORT
-DQSPI_NO_SAMPLE_SHIFT
-DRPMSG_BUFFER_SIZE=2048
-DRPMSG_BUFFER_SIZE=512
-DSTM32H747xx
-DTARGET_CORDIO
-DTARGET_CORTEX
Expand Down
2 changes: 1 addition & 1 deletion variants/NICLA_VISION/conf/mbed_app.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"VIRTIO_DRIVER_ONLY",
"NO_ATOMIC_64_SUPPORT",
"METAL_MAX_DEVICE_REGIONS=2",
"RPMSG_BUFFER_SIZE=100"
"RPMSG_BUFFER_SIZE=512"
]
}
}
Expand Down
2 changes: 1 addition & 1 deletion variants/NICLA_VISION/defines.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
-DMETAL_MAX_DEVICE_REGIONS=2
-DNO_ATOMIC_64_SUPPORT
-DQSPI_NO_SAMPLE_SHIFT
-DRPMSG_BUFFER_SIZE=2048
-DRPMSG_BUFFER_SIZE=512
-DSTM32H747xx
-DT1oI2C
-DT1oI2C_UM11225
Expand Down
2 changes: 1 addition & 1 deletion variants/OPTA/conf/mbed_app.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"VIRTIO_DRIVER_ONLY",
"NO_ATOMIC_64_SUPPORT",
"METAL_MAX_DEVICE_REGIONS=2",
"RPMSG_BUFFER_SIZE=2048"
"RPMSG_BUFFER_SIZE=512"
]
}
}
Expand Down
2 changes: 1 addition & 1 deletion variants/OPTA/defines.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
-DMETAL_MAX_DEVICE_REGIONS=2
-DNO_ATOMIC_64_SUPPORT
-DQSPI_NO_SAMPLE_SHIFT
-DRPMSG_BUFFER_SIZE=2048
-DRPMSG_BUFFER_SIZE=512
-DSTM32H747xx
-DTARGET_CORDIO
-DTARGET_CORTEX
Expand Down
2 changes: 1 addition & 1 deletion variants/PORTENTA_H7_M7/conf/mbed_app.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"VIRTIO_DRIVER_ONLY",
"NO_ATOMIC_64_SUPPORT",
"METAL_MAX_DEVICE_REGIONS=2",
"RPMSG_BUFFER_SIZE=2048",
"RPMSG_BUFFER_SIZE=512",
"LSE_STARTUP_TIMEOUT=200"
]
}
Expand Down
2 changes: 1 addition & 1 deletion variants/PORTENTA_H7_M7/defines.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
-DMETAL_MAX_DEVICE_REGIONS=2
-DNO_ATOMIC_64_SUPPORT
-DQSPI_NO_SAMPLE_SHIFT
-DRPMSG_BUFFER_SIZE=2048
-DRPMSG_BUFFER_SIZE=512
-DSTM32H747xx
-DTARGET_CORDIO
-DTARGET_CORTEX
Expand Down
2 changes: 1 addition & 1 deletion variants/PORTENTA_X8/conf/mbed_app.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"VIRTIO_DEVICE_ONLY",
"NO_ATOMIC_64_SUPPORT",
"METAL_MAX_DEVICE_REGIONS=2",
"RPMSG_BUFFER_SIZE=2048"
"RPMSG_BUFFER_SIZE=512"
]
}
}
Expand Down
2 changes: 1 addition & 1 deletion variants/PORTENTA_X8/defines.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
-DMETAL_MAX_DEVICE_REGIONS=2
-DNO_ATOMIC_64_SUPPORT
-DNO_VTOR_RELOCATE
-DRPMSG_BUFFER_SIZE=2048
-DRPMSG_BUFFER_SIZE=512
-DSTM32H747xx
-DTARGET_CORTEX
-DTARGET_CORTEX_M
Expand Down