mirror of
https://github.com/rcore-os/rCore-Tutorial-v3.git
synced 2024-11-22 09:26:26 +04:00
Bump rustsbi to 0.1.1 && make config of qemu/k210 different
This commit is contained in:
parent
07467287da
commit
eb5ef8e956
Binary file not shown.
Binary file not shown.
14
os/Makefile
14
os/Makefile
@ -3,7 +3,6 @@ TARGET := riscv64gc-unknown-none-elf
|
|||||||
MODE := release
|
MODE := release
|
||||||
KERNEL_ELF := target/$(TARGET)/$(MODE)/os
|
KERNEL_ELF := target/$(TARGET)/$(MODE)/os
|
||||||
KERNEL_BIN := $(KERNEL_ELF).bin
|
KERNEL_BIN := $(KERNEL_ELF).bin
|
||||||
KERNEL_ENTRY_PA := 0x80020000
|
|
||||||
DISASM_TMP := target/$(TARGET)/$(MODE)/asm
|
DISASM_TMP := target/$(TARGET)/$(MODE)/asm
|
||||||
FS_IMG := ../user/target/$(TARGET)/$(MODE)/fs.img
|
FS_IMG := ../user/target/$(TARGET)/$(MODE)/fs.img
|
||||||
SDCARD := /dev/sdb
|
SDCARD := /dev/sdb
|
||||||
@ -13,6 +12,14 @@ APPS := ../user/src/bin
|
|||||||
BOARD ?= qemu
|
BOARD ?= qemu
|
||||||
SBI ?= rustsbi
|
SBI ?= rustsbi
|
||||||
BOOTLOADER := ../bootloader/$(SBI)-$(BOARD).bin
|
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
|
# Run K210
|
||||||
K210-SERIALPORT = /dev/ttyUSB0
|
K210-SERIALPORT = /dev/ttyUSB0
|
||||||
@ -48,7 +55,10 @@ $(FS_IMG): $(APPS)
|
|||||||
$(APPS):
|
$(APPS):
|
||||||
|
|
||||||
kernel:
|
kernel:
|
||||||
|
@echo Platform: $(BOARD)
|
||||||
|
@cp src/linker-$(BOARD).ld src/linker.ld
|
||||||
@cargo build --release --features "board_$(BOARD)"
|
@cargo build --release --features "board_$(BOARD)"
|
||||||
|
@rm src/linker.ld
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@cargo clean
|
@cargo clean
|
||||||
@ -74,7 +84,7 @@ ifeq ($(BOARD),qemu)
|
|||||||
-device virtio-blk-device,drive=x0,bus=virtio-mmio-bus.0
|
-device virtio-blk-device,drive=x0,bus=virtio-mmio-bus.0
|
||||||
else
|
else
|
||||||
@cp $(BOOTLOADER) $(BOOTLOADER).copy
|
@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)
|
@mv $(BOOTLOADER).copy $(KERNEL_BIN)
|
||||||
@sudo chmod 777 $(K210-SERIALPORT)
|
@sudo chmod 777 $(K210-SERIALPORT)
|
||||||
python3 $(K210-BURNER) -p $(K210-SERIALPORT) -b 1500000 $(KERNEL_BIN)
|
python3 $(K210-BURNER) -p $(K210-SERIALPORT) -b 1500000 $(KERNEL_BIN)
|
||||||
|
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…
Reference in New Issue
Block a user