Shared memory between Renode and QEMU for Co-simulation
-
add memory backend file parameters to the QEMU command line
-
set memory size:
-m 2G
-
set memory backend file:
-object memory-backend-file,id=pc.ram,size=2G,mem-path=/dev/shm/qemu-ram,prealloc=on,share=on
-
set memory backend for machine
-machine memory-backend=pc.ram
# example qemu-system-aarch64 \ -M virt,gic-version=3 -m 2G \ -object memory-backend-file,id=pc.ram,size=2G,mem-path=/dev/shm/qemu-ram,prealloc=on,share=on \ -machine memory-backend=pc.ram \ -cpu cortex-a53 -smp 4 \ -serial mon:stdio -nographic \ -kernel /your/linux/kernel/Image \ -append "your bootargs" \ -dtb /your/device/tree/blob.dtb
-
-
start QEMU with memory file backend params and check if the file /dev/shm/qemu-ram has been generated
- replace MappedMemory with SharedMemory in
your_renode_platform.repl
ram: Memory.SharedMemory @ sysbus 0xC0000000 offset: 0x3c100000 size: 0x40000000 filePath: "/dev/shm/qemu-ram"
- include SharedMemory.cs plugin in
your_renode_script.resc
include $ORIGIN/SharedMemory.cs machine LoadPlatformDescription $ORIGIN/your_renode_platform.repl
- start Renode emulation after QEMU has booted and created /dev/shm/qemu-ram file