RPMsg-Lite Example
Supported Development Boards
This example can run on the following development boards:
eh-lb551
eh-lb555
sf32lb56-lcd series
sf32lb58-lcd series
Overview
This example demonstrates the basic usage of the RPMsg-Lite component.
How to Use the Example
RPMsg-Lite uses queue4 and queue5 as bidirectional communication channels. HCPU acts as master and LCPU acts as remote. The master’s endpoint is 30, and the remote’s endpoint is 40. The shared buffer must be allocated in LCPU’s RAM, with the address specified by the macro
RPMSG_BUF_ADDR_MASTER, and buffer size specified by the macroRPMSG_BUF_SIZE. These macros are defined in header filessrc\common\ipc_config.h,project\hcpu\custom_mem_map.h, andproject\lcpu\custom_mem_map.h.It is recommended to initialize the RPMsg-Lite module during the
INIT_APP_EXPORTstage to avoid premature mailbox interrupt activation affecting the data_service module.HCPU’s main function is located in
src/hcpu/main.c, and LCPU’s main function is insrc/lcpu/main.c.For compilation methods, refer to the general project compilation. For example, execute
scons --board=eh-lb551 -j8in theproject\hcpudirectory to compile programs running on the eh-lb551 board, where –board is followed by the board name. To compile programs for 555hdk, execute the commandscons --board=eh-lb555 -j8. After compilation, use thebuild_eh-lb551/download.batcommand to download the bin file to the board.
Example Output
HCPU and LCPU automatically send messages to each other at regular intervals:
When LCPU receives a message, it prints:
rx: hello_from_hcpuWhen HCPU receives a message, it prints:
rx: hello_from_lcpuThe master core can send a string to the other core using the console command
send message, wheremessageis the content to send. If the string contains spaces, it must be enclosed in double quotes. The other core will print the received string.
# Send message in HCPU console
send "Hello LCPU, this is HCPU"
The LCPU console will display:
rx: Hello LCPU, this is HCPU
To demonstrate sleep functionality, HCPU will enter sleep state after executing the send command, and LCPU will also sleep. Both will be woken up by timers or messages.