MEMORY {
/* Virtual address mapped memory area */
DRAM : ORIGIN = 0xffffffff80000000, LENGTH = 128M
}
/* Use virtual address is okay if you have an initial boot page */
PROVIDE(_stext = 0xffffffff80200000);
/* Modify this to provide bigger stack for each hart */
PROVIDE(_hart_stack_size = 128K);
/* Modify this to set max hart number */
PROVIDE(_max_hart_id = 1);
/* Modify this to add frame section size */
PROVIDE(_frame_size = 16384 * 4K);
/* Map the runtime regions into memory areas */
REGION_ALIAS("REGION_TEXT", DRAM);
REGION_ALIAS("REGION_RODATA", DRAM);
REGION_ALIAS("REGION_DATA", DRAM);
REGION_ALIAS("REGION_BSS", DRAM);
REGION_ALIAS("REGION_STACK", DRAM);
REGION_ALIAS("REGION_FRAME", DRAM);
The addresses of memory areas are defined together with boot page macro.
For example if there’s a DRAM with the physical base address 0x80000000,
and there is a boot page mapper for 0xffffffff_80000000 => 0x00000000_80000000,
then the virtual base address of DRAM is 0xffffffff80000000.
关于
A mininal runtime / startup for Supervisor Binary Interface (SBI) on RISC-V.
riscv-sbi-rt
A mininal runtime / startup for Supervisor Binary Interface (SBI) on RISC-V.
Features
todo:
Example
Write four lines to build a minimum operating system kernel:
Another four lines for a trap handler:
Add serveral additional lines to build with an Sv39 initial boot page:
Customize memory areas in your linker script:
The addresses of memory areas are defined together with boot page macro. For example if there’s a
DRAM
with the physical base address0x80000000
, and there is a boot page mapper for0xffffffff_80000000 => 0x00000000_80000000
, then the virtual base address ofDRAM
is0xffffffff80000000
.