Remove K210 support.
This commit is contained in:
parent
afe83aa7f7
commit
66a93a40a7
5 changed files with 6 additions and 44 deletions
Binary file not shown.
42
os/Makefile
42
os/Makefile
|
@ -5,14 +5,12 @@ KERNEL_ELF := target/$(TARGET)/$(MODE)/os
|
||||||
KERNEL_BIN := $(KERNEL_ELF).bin
|
KERNEL_BIN := $(KERNEL_ELF).bin
|
||||||
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
|
|
||||||
APPS := ../user/src/bin/*
|
APPS := ../user/src/bin/*
|
||||||
|
|
||||||
# BOARD
|
# BOARD
|
||||||
BOARD ?= qemu
|
BOARD := qemu
|
||||||
SBI ?= rustsbi
|
SBI ?= rustsbi
|
||||||
BOOTLOADER := ../bootloader/$(SBI)-$(BOARD).bin
|
BOOTLOADER := ../bootloader/$(SBI)-$(BOARD).bin
|
||||||
K210_BOOTLOADER_SIZE := 131072
|
|
||||||
|
|
||||||
# Building mode argument
|
# Building mode argument
|
||||||
ifeq ($(MODE), release)
|
ifeq ($(MODE), release)
|
||||||
|
@ -20,15 +18,7 @@ ifeq ($(MODE), release)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# KERNEL ENTRY
|
# KERNEL ENTRY
|
||||||
ifeq ($(BOARD), qemu)
|
KERNEL_ENTRY_PA := 0x80200000
|
||||||
KERNEL_ENTRY_PA := 0x80200000
|
|
||||||
else ifeq ($(BOARD), k210)
|
|
||||||
KERNEL_ENTRY_PA := 0x80020000
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Run K210
|
|
||||||
K210-SERIALPORT = /dev/ttyUSB0
|
|
||||||
K210-BURNER = ../tools/kflash.py
|
|
||||||
|
|
||||||
# Binutils
|
# Binutils
|
||||||
OBJDUMP := rust-objdump --arch-name=riscv64
|
OBJDUMP := rust-objdump --arch-name=riscv64
|
||||||
|
@ -40,14 +30,7 @@ DISASM ?= -x
|
||||||
# Run usertests or usershell
|
# Run usertests or usershell
|
||||||
TEST ?=
|
TEST ?=
|
||||||
|
|
||||||
build: env switch-check $(KERNEL_BIN) fs-img
|
build: env $(KERNEL_BIN) fs-img
|
||||||
|
|
||||||
switch-check:
|
|
||||||
ifeq ($(BOARD), qemu)
|
|
||||||
(which last-qemu) || (rm -f last-k210 && touch last-qemu && make clean)
|
|
||||||
else ifeq ($(BOARD), k210)
|
|
||||||
(which last-k210) || (rm -f last-qemu && touch last-k210 && make clean)
|
|
||||||
endif
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
(rustup target list | grep "riscv64gc-unknown-none-elf (installed)") || rustup target add $(TARGET)
|
(rustup target list | grep "riscv64gc-unknown-none-elf (installed)") || rustup target add $(TARGET)
|
||||||
|
@ -55,11 +38,6 @@ env:
|
||||||
rustup component add rust-src
|
rustup component add rust-src
|
||||||
rustup component add llvm-tools-preview
|
rustup component add llvm-tools-preview
|
||||||
|
|
||||||
sdcard: fs-img
|
|
||||||
@echo "Are you sure write to $(SDCARD) ? [y/N] " && read ans && [ $${ans:-N} = y ]
|
|
||||||
@sudo dd if=/dev/zero of=$(SDCARD) bs=1048576 count=32
|
|
||||||
@sudo dd if=$(FS_IMG) of=$(SDCARD)
|
|
||||||
|
|
||||||
$(KERNEL_BIN): kernel
|
$(KERNEL_BIN): kernel
|
||||||
@$(OBJCOPY) $(KERNEL_ELF) --strip-all -O binary $@
|
@$(OBJCOPY) $(KERNEL_ELF) --strip-all -O binary $@
|
||||||
|
|
||||||
|
@ -73,7 +51,7 @@ $(APPS):
|
||||||
kernel:
|
kernel:
|
||||||
@echo Platform: $(BOARD)
|
@echo Platform: $(BOARD)
|
||||||
@cp src/linker-$(BOARD).ld src/linker.ld
|
@cp src/linker-$(BOARD).ld src/linker.ld
|
||||||
@cargo build --release --features "board_$(BOARD)"
|
@cargo build --release
|
||||||
@rm src/linker.ld
|
@rm src/linker.ld
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
@ -90,7 +68,6 @@ disasm-vim: kernel
|
||||||
run: run-inner
|
run: run-inner
|
||||||
|
|
||||||
run-inner: build
|
run-inner: build
|
||||||
ifeq ($(BOARD),qemu)
|
|
||||||
@qemu-system-riscv64 \
|
@qemu-system-riscv64 \
|
||||||
-machine virt \
|
-machine virt \
|
||||||
-nographic \
|
-nographic \
|
||||||
|
@ -98,15 +75,6 @@ ifeq ($(BOARD),qemu)
|
||||||
-device loader,file=$(KERNEL_BIN),addr=$(KERNEL_ENTRY_PA) \
|
-device loader,file=$(KERNEL_BIN),addr=$(KERNEL_ENTRY_PA) \
|
||||||
-drive file=$(FS_IMG),if=none,format=raw,id=x0 \
|
-drive file=$(FS_IMG),if=none,format=raw,id=x0 \
|
||||||
-device virtio-blk-device,drive=x0,bus=virtio-mmio-bus.0
|
-device virtio-blk-device,drive=x0,bus=virtio-mmio-bus.0
|
||||||
else
|
|
||||||
(which $(K210-BURNER)) || (cd .. && git clone https://github.com/sipeed/kflash.py.git && mv kflash.py tools)
|
|
||||||
@cp $(BOOTLOADER) $(BOOTLOADER).copy
|
|
||||||
@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)
|
|
||||||
python3 -m serial.tools.miniterm --eol LF --dtr 0 --rts 0 --filter direct $(K210-SERIALPORT) 115200
|
|
||||||
endif
|
|
||||||
|
|
||||||
debug: build
|
debug: build
|
||||||
@tmux new-session -d \
|
@tmux new-session -d \
|
||||||
|
@ -121,4 +89,4 @@ gdbserver: build
|
||||||
gdbclient:
|
gdbclient:
|
||||||
@riscv64-unknown-elf-gdb -ex 'file $(KERNEL_ELF)' -ex 'set arch riscv:rv64' -ex 'target remote localhost:1234'
|
@riscv64-unknown-elf-gdb -ex 'file $(KERNEL_ELF)' -ex 'set arch riscv:rv64' -ex 'target remote localhost:1234'
|
||||||
|
|
||||||
.PHONY: build env kernel clean disasm disasm-vim run-inner switch-check fs-img gdbserver gdbclient
|
.PHONY: build env kernel clean disasm disasm-vim run-inner fs-img gdbserver gdbclient
|
||||||
|
|
|
@ -31,10 +31,6 @@ extern crate alloc;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate bitflags;
|
extern crate bitflags;
|
||||||
|
|
||||||
#[cfg(feature = "board_k210")]
|
|
||||||
#[path = "boards/k210.rs"]
|
|
||||||
mod board;
|
|
||||||
#[cfg(not(any(feature = "board_k210")))]
|
|
||||||
#[path = "boards/qemu.rs"]
|
#[path = "boards/qemu.rs"]
|
||||||
mod board;
|
mod board;
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ const SBI_REMOTE_FENCE_I: usize = 5;
|
||||||
const SBI_REMOTE_SFENCE_VMA: usize = 6;
|
const SBI_REMOTE_SFENCE_VMA: usize = 6;
|
||||||
const SBI_REMOTE_SFENCE_VMA_ASID: usize = 7;
|
const SBI_REMOTE_SFENCE_VMA_ASID: usize = 7;
|
||||||
const SBI_SHUTDOWN: usize = 8;
|
const SBI_SHUTDOWN: usize = 8;
|
||||||
|
|
||||||
/// general sbi call
|
/// general sbi call
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn sbi_call(which: usize, arg0: usize, arg1: usize, arg2: usize) -> usize {
|
fn sbi_call(which: usize, arg0: usize, arg1: usize, arg2: usize) -> usize {
|
||||||
|
|
|
@ -59,7 +59,6 @@ pub fn suspend_current_and_run_next() {
|
||||||
/// pid of usertests app in make run TEST=1
|
/// pid of usertests app in make run TEST=1
|
||||||
pub const IDLE_PID: usize = 0;
|
pub const IDLE_PID: usize = 0;
|
||||||
|
|
||||||
#[cfg(feature = "board_qemu")]
|
|
||||||
use crate::board::QEMUExit;
|
use crate::board::QEMUExit;
|
||||||
|
|
||||||
/// Exit the current 'Running' task and run the next task in task list.
|
/// Exit the current 'Running' task and run the next task in task list.
|
||||||
|
@ -67,9 +66,7 @@ pub fn exit_current_and_run_next(exit_code: i32) {
|
||||||
// take from Processor
|
// take from Processor
|
||||||
let task = take_current_task().unwrap();
|
let task = take_current_task().unwrap();
|
||||||
|
|
||||||
#[cfg(feature = "board_qemu")]
|
|
||||||
let pid = task.getpid();
|
let pid = task.getpid();
|
||||||
#[cfg(feature = "board_qemu")]
|
|
||||||
if pid == IDLE_PID {
|
if pid == IDLE_PID {
|
||||||
println!(
|
println!(
|
||||||
"[kernel] Idle process exit with exit_code {} ...",
|
"[kernel] Idle process exit with exit_code {} ...",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue