Skip to content

Commit f231896

Browse files
committed
Remove K210 support.
1 parent e270920 commit f231896

File tree

17 files changed

+10
-994
lines changed

17 files changed

+10
-994
lines changed

bootloader/rustsbi-k210.bin

-92.7 KB
Binary file not shown.

os/Cargo.toml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,10 @@ bitflags = "1.2.1"
1414
xmas-elf = "0.7.0"
1515
volatile = "0.3"
1616
virtio-drivers = { git = "https://github.com/rcore-os/virtio-drivers", rev = "4ee80e5" }
17-
k210-pac = { git = "https://github.com/wyfcyx/k210-pac" }
18-
k210-hal = { git = "https://github.com/wyfcyx/k210-hal" }
19-
k210-soc = { git = "https://github.com/wyfcyx/k210-soc" }
2017
easy-fs = { path = "../easy-fs" }
2118
virtio-input-decoder = "0.1.4"
2219
embedded-graphics = "0.7.1"
2320
tinybmp = "0.3.1"
2421

25-
[features]
26-
board_qemu = []
27-
board_k210 = []
28-
2922
[profile.release]
3023
debug = true

os/Makefile

Lines changed: 5 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,20 @@ KERNEL_ELF := target/$(TARGET)/$(MODE)/os
55
KERNEL_BIN := $(KERNEL_ELF).bin
66
DISASM_TMP := target/$(TARGET)/$(MODE)/asm
77
FS_IMG := ../user/target/$(TARGET)/$(MODE)/fs.img
8-
SDCARD := /dev/sdb
98
APPS := ../user/src/bin/*
109

1110
# BOARD
12-
BOARD ?= qemu
11+
BOARD := qemu
1312
SBI ?= rustsbi
1413
BOOTLOADER := ../bootloader/$(SBI)-$(BOARD).bin
15-
K210_BOOTLOADER_SIZE := 131072
1614

1715
# Building mode argument
1816
ifeq ($(MODE), release)
1917
MODE_ARG := --release
2018
endif
2119

2220
# KERNEL ENTRY
23-
ifeq ($(BOARD), qemu)
24-
KERNEL_ENTRY_PA := 0x80200000
25-
else ifeq ($(BOARD), k210)
26-
KERNEL_ENTRY_PA := 0x80020000
27-
endif
28-
29-
# Run K210
30-
K210-SERIALPORT = /dev/ttyUSB0
31-
K210-BURNER = ../tools/kflash.py
21+
KERNEL_ENTRY_PA := 0x80200000
3222

3323
# Binutils
3424
OBJDUMP := rust-objdump --arch-name=riscv64
@@ -40,26 +30,14 @@ DISASM ?= -x
4030
# Run usertests or usershell
4131
TEST ?=
4232

43-
build: env switch-check $(KERNEL_BIN) fs-img
44-
45-
switch-check:
46-
ifeq ($(BOARD), qemu)
47-
(which last-qemu) || (rm -f last-k210 && touch last-qemu && make clean)
48-
else ifeq ($(BOARD), k210)
49-
(which last-k210) || (rm -f last-qemu && touch last-k210 && make clean)
50-
endif
33+
build: env $(KERNEL_BIN) fs-img
5134

5235
env:
5336
(rustup target list | grep "riscv64gc-unknown-none-elf (installed)") || rustup target add $(TARGET)
5437
cargo install cargo-binutils
5538
rustup component add rust-src
5639
rustup component add llvm-tools-preview
5740

58-
sdcard: fs-img
59-
@echo "Are you sure write to $(SDCARD) ? [y/N] " && read ans && [ $${ans:-N} = y ]
60-
@sudo dd if=/dev/zero of=$(SDCARD) bs=1048576 count=32
61-
@sudo dd if=$(FS_IMG) of=$(SDCARD)
62-
6341
$(KERNEL_BIN): kernel
6442
@$(OBJCOPY) $(KERNEL_ELF) --strip-all -O binary $@
6543

@@ -73,7 +51,7 @@ $(APPS):
7351
kernel:
7452
@echo Platform: $(BOARD)
7553
@cp src/linker-$(BOARD).ld src/linker.ld
76-
@cargo build --release --features "board_$(BOARD)"
54+
@cargo build --release
7755
@rm src/linker.ld
7856

7957
clean:
@@ -105,7 +83,6 @@ ifeq ($(BOARD),qemu)
10583
endif
10684

10785
run-inner: build
108-
ifeq ($(BOARD),qemu)
10986
@qemu-system-riscv64 \
11087
-M 128m \
11188
-machine virt \
@@ -118,15 +95,6 @@ ifeq ($(BOARD),qemu)
11895
-device virtio-keyboard-device \
11996
-device virtio-mouse-device \
12097
-serial stdio
121-
else
122-
(which $(K210-BURNER)) || (cd .. && git clone https://github.com/sipeed/kflash.py.git && mv kflash.py tools)
123-
@cp $(BOOTLOADER) $(BOOTLOADER).copy
124-
@dd if=$(KERNEL_BIN) of=$(BOOTLOADER).copy bs=$(K210_BOOTLOADER_SIZE) seek=1
125-
@mv $(BOOTLOADER).copy $(KERNEL_BIN)
126-
@sudo chmod 777 $(K210-SERIALPORT)
127-
python3 $(K210-BURNER) -p $(K210-SERIALPORT) -b 1500000 $(KERNEL_BIN)
128-
python3 -m serial.tools.miniterm --eol LF --dtr 0 --rts 0 --filter direct $(K210-SERIALPORT) 115200
129-
endif
13098

13199
debug: build
132100
@tmux new-session -d \
@@ -141,4 +109,4 @@ gdbserver: build
141109
gdbclient:
142110
@riscv64-unknown-elf-gdb -ex 'file $(KERNEL_ELF)' -ex 'set arch riscv:rv64' -ex 'target remote localhost:1234'
143111

144-
.PHONY: build env kernel clean disasm disasm-vim run-inner switch-check fs-img gdbserver gdbclient
112+
.PHONY: build env kernel clean disasm disasm-vim run-inner fs-img gdbserver gdbclient

os/src/boards/k210.rs

Lines changed: 0 additions & 30 deletions
This file was deleted.

os/src/console.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,13 @@
11
use crate::drivers::chardev::CharDevice;
2-
#[cfg(feature = "board_qemu")]
32
use crate::drivers::chardev::UART;
4-
#[cfg(feature = "board_k210")]
5-
use crate::sbi::console_putchar;
63
use core::fmt::{self, Write};
74

85
struct Stdout;
96

107
impl Write for Stdout {
118
fn write_str(&mut self, s: &str) -> fmt::Result {
129
for c in s.chars() {
13-
#[cfg(feature = "board_qemu")]
1410
UART.write(c as u8);
15-
#[cfg(feature = "board_k210")]
16-
console_putchar(c as usize);
1711
}
1812
Ok(())
1913
}

os/src/drivers/block/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
mod sdcard;
21
mod virtio_blk;
32

4-
pub use sdcard::SDCardWrapper;
53
pub use virtio_blk::VirtIOBlock;
64

75
use crate::board::BlockDeviceImpl;

0 commit comments

Comments
 (0)