Bump rustsbi to 0.1.1 && make config of qemu/k210 different
This commit is contained in:
parent
58897f477e
commit
982b369a51
6 changed files with 68 additions and 2 deletions
Binary file not shown.
Binary file not shown.
14
os/Makefile
14
os/Makefile
|
@ -3,13 +3,20 @@ TARGET := riscv64gc-unknown-none-elf
|
|||
MODE := release
|
||||
KERNEL_ELF := target/$(TARGET)/$(MODE)/os
|
||||
KERNEL_BIN := $(KERNEL_ELF).bin
|
||||
KERNEL_ENTRY_PA := 0x80020000
|
||||
DISASM_TMP := target/$(TARGET)/$(MODE)/asm
|
||||
|
||||
# BOARD
|
||||
BOARD ?= qemu
|
||||
SBI ?= rustsbi
|
||||
BOOTLOADER := ../bootloader/$(SBI)-$(BOARD).bin
|
||||
K210_BOOTLOADER_SIZE := 131072
|
||||
|
||||
# KERNEL ENTRY
|
||||
ifeq ($(BOARD), qemu)
|
||||
KERNEL_ENTRY_PA := 0x80200000
|
||||
else ifeq ($(BOARD), k210)
|
||||
KERNEL_ENTRY_PA := 0x80020000
|
||||
endif
|
||||
|
||||
# Run K210
|
||||
K210-SERIALPORT = /dev/ttyUSB0
|
||||
|
@ -35,7 +42,10 @@ $(KERNEL_BIN): kernel
|
|||
|
||||
kernel:
|
||||
@cd ../user && make build
|
||||
@echo Platform: $(BOARD)
|
||||
@cp src/linker-$(BOARD).ld src/linker.ld
|
||||
@cargo build --release --features "board_$(BOARD)"
|
||||
@rm src/linker.ld
|
||||
|
||||
clean:
|
||||
@cargo clean
|
||||
|
@ -59,7 +69,7 @@ ifeq ($(BOARD),qemu)
|
|||
-device loader,file=$(KERNEL_BIN),addr=$(KERNEL_ENTRY_PA)
|
||||
else
|
||||
@cp $(BOOTLOADER) $(BOOTLOADER).copy
|
||||
@dd if=$(KERNEL_BIN) of=$(BOOTLOADER).copy bs=131072 seek=1
|
||||
@dd if=$(KERNEL_BIN) of=$(BOOTLOADER).copy bs=$(K210_BOOTLOADER_SIZE) seek=1
|
||||
@mv $(BOOTLOADER).copy $(KERNEL_BIN)
|
||||
@sudo chmod 777 $(K210-SERIALPORT)
|
||||
python3 $(K210-BURNER) -p $(K210-SERIALPORT) -b 1500000 $(KERNEL_BIN)
|
||||
|
|
|
@ -1,7 +1,13 @@
|
|||
pub const USER_STACK_SIZE: usize = 4096 * 2;
|
||||
pub const KERNEL_STACK_SIZE: usize = 4096 * 2;
|
||||
pub const KERNEL_HEAP_SIZE: usize = 0x20_0000;
|
||||
|
||||
#[cfg(feature = "board_k210")]
|
||||
pub const MEMORY_END: usize = 0x80600000;
|
||||
|
||||
#[cfg(feature = "board_qemu")]
|
||||
pub const MEMORY_END: usize = 0x80800000;
|
||||
|
||||
pub const PAGE_SIZE: usize = 0x1000;
|
||||
pub const PAGE_SIZE_BITS: usize = 0xc;
|
||||
|
||||
|
|
50
os/src/linker-qemu.ld
Normal file
50
os/src/linker-qemu.ld
Normal file
|
@ -0,0 +1,50 @@
|
|||
OUTPUT_ARCH(riscv)
|
||||
ENTRY(_start)
|
||||
BASE_ADDRESS = 0x80200000;
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
. = BASE_ADDRESS;
|
||||
skernel = .;
|
||||
|
||||
stext = .;
|
||||
.text : {
|
||||
*(.text.entry)
|
||||
. = ALIGN(4K);
|
||||
strampoline = .;
|
||||
*(.text.trampoline);
|
||||
. = ALIGN(4K);
|
||||
*(.text .text.*)
|
||||
}
|
||||
|
||||
. = ALIGN(4K);
|
||||
etext = .;
|
||||
srodata = .;
|
||||
.rodata : {
|
||||
*(.rodata .rodata.*)
|
||||
}
|
||||
|
||||
. = ALIGN(4K);
|
||||
erodata = .;
|
||||
sdata = .;
|
||||
.data : {
|
||||
*(.data .data.*)
|
||||
}
|
||||
|
||||
. = ALIGN(4K);
|
||||
edata = .;
|
||||
sbss_with_stack = .;
|
||||
.bss : {
|
||||
*(.bss.stack)
|
||||
sbss = .;
|
||||
*(.bss .bss.*)
|
||||
}
|
||||
|
||||
. = ALIGN(4K);
|
||||
ebss = .;
|
||||
ekernel = .;
|
||||
|
||||
/DISCARD/ : {
|
||||
*(.eh_frame)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue