diff --git a/.gitignore b/.gitignore index 1e5f8c09..d3676974 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ os/target/* os/.idea/* os/src/link_app.S os/Cargo.lock +os/last-* tools/ diff --git a/os/Makefile b/os/Makefile index 71320d1c..a5e6a151 100644 --- a/os/Makefile +++ b/os/Makefile @@ -29,7 +29,14 @@ OBJCOPY := rust-objcopy --binary-architecture=riscv64 # Disassembly DISASM ?= -x -build: env $(KERNEL_BIN) +build: env switch-check $(KERNEL_BIN) + +switch-check: +ifeq ($(BOARD), qemu) + (which last-qemu) || (rm last-k210 -f && touch last-qemu && make clean) +else ifeq ($(BOARD), k210) + (which last-k210) || (rm last-qemu -f && touch last-k210 && make clean) +endif env: (rustup target list | grep "riscv64gc-unknown-none-elf (installed)") || rustup target add $(TARGET) @@ -84,4 +91,4 @@ debug: build tmux split-window -h "riscv64-unknown-elf-gdb -ex 'file $(KERNEL_ELF)' -ex 'set arch riscv:rv64' -ex 'target remote localhost:1234'" && \ tmux -2 attach-session -d -.PHONY: build env kernel clean disasm disasm-vim run-inner +.PHONY: build env kernel clean disasm disasm-vim run-inner switch-check diff --git a/rust-toolchain b/rust-toolchain index a08f00d1..a14eedce 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -nightly-2021-01-30 +nightly-2021-07-01