qemu/boards/VIRT_RV64: Add ROMFS support.

This commit reserves a memory area to mount ROMFS partitions into, and
lets the port Makefile know the memory area details.

A 4 MiB segment is allocated at 0x8062_0000, which is inside the
emulated machine's DRAM segment.  The virt board requires the image
loaded in its DRAM segment to be contiguous, so the ROMFS segment is
placed right after the stack area.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit is contained in:
Alessandro Gatti
2026-04-08 19:56:42 +02:00
committed by Damien George
parent acaba3f469
commit f3e79c8b56
2 changed files with 11 additions and 3 deletions
@@ -6,6 +6,12 @@ CFLAGS += -DMICROPY_HW_MCU_NAME='"$(RV64_ARCH)"'
LDSCRIPT = mcu/rv64/virt.ld
# If the ROMFS partition size is not enough, remember to change
# ports/qemu/mcu/rv64/virt.ld to resize the ROMFS section as well.
MICROPY_HW_ROMFS_PART0_START = 0x80620000
MICROPY_HW_ROMFS_PART0_SIZE = 0x00400000
SRC_BOARD_O += shared/runtime/gchelper_native.o shared/runtime/gchelper_rv64i.o
MPY_CROSS_FLAGS += -march=rv64imc
+5 -3
View File
@@ -38,12 +38,14 @@ OUTPUT_FORMAT("elf64-littleriscv", "elf64-littleriscv", "elf64-littleriscv");
* 0x0000_0000_8060_0000: .stack
* 0x0000_0000_8060_0000: _sstack
* 0x0000_0000_8061_FFFF: _estack
* 0x0000_0000_8062_0000: .romfs
*/
MEMORY
{
ROM (xr) : ORIGIN = 0x0000000080000000, LENGTH = 4M
RAM (xrw) : ORIGIN = ORIGIN(ROM) + LENGTH(ROM), LENGTH = 2M
STACK (rw) : ORIGIN = ORIGIN(RAM) + LENGTH(RAM), LENGTH = 128K
ROM (xr) : ORIGIN = 0x0000000080000000, LENGTH = 4M
RAM (xrw) : ORIGIN = ORIGIN(ROM) + LENGTH(ROM), LENGTH = 2M
STACK (rw) : ORIGIN = ORIGIN(RAM) + LENGTH(RAM), LENGTH = 128K
ROMFS (xr) : ORIGIN = ORIGIN(STACK) + LENGTH(STACK), LENGTH = 4M
}
SECTIONS