diff --git a/.gitignore b/.gitignore index 770aba77..87872242 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ os/src/link_app.S os/src/linker.ld os/last-* os/Cargo.lock +os/.gdb_history user/build user/target/* user/.idea/* diff --git a/easy-fs/Cargo.toml b/easy-fs/Cargo.toml index 6e7cd925..c9690776 100644 --- a/easy-fs/Cargo.toml +++ b/easy-fs/Cargo.toml @@ -8,4 +8,7 @@ edition = "2018" [dependencies] spin = "0.7.0" -lazy_static = { version = "1.4.0", features = ["spin_no_std"] } \ No newline at end of file +lazy_static = { version = "1.4.0", features = ["spin_no_std"] } + +[profile.release] +debug = true diff --git a/os/Cargo.toml b/os/Cargo.toml index b07fa034..8b81163b 100644 --- a/os/Cargo.toml +++ b/os/Cargo.toml @@ -20,4 +20,7 @@ easy-fs = { path = "../easy-fs" } [features] board_qemu = [] -board_k210 = [] \ No newline at end of file +board_k210 = [] + +[profile.release] +debug = true diff --git a/os/Makefile b/os/Makefile index 0c1fb7c7..91ae60bf 100644 --- a/os/Makefile +++ b/os/Makefile @@ -14,6 +14,11 @@ SBI ?= rustsbi BOOTLOADER := ../bootloader/$(SBI)-$(BOARD).bin K210_BOOTLOADER_SIZE := 131072 +# Building mode argument +ifeq ($(MODE), release) + MODE_ARG := --release +endif + # KERNEL ENTRY ifeq ($(BOARD), qemu) KERNEL_ENTRY_PA := 0x80200000 @@ -106,4 +111,11 @@ 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 switch-check fs-img + +gdbserver: build + @qemu-system-riscv64 -machine virt -nographic -bios $(BOOTLOADER) -device loader,file=$(KERNEL_BIN),addr=$(KERNEL_ENTRY_PA) -s -S + +gdbclient: + @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 diff --git a/rust-toolchain b/rust-toolchain index 925656db..abcacd9b 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -nightly-2022-01-19 +nightly-2022-04-11 diff --git a/user/Cargo.toml b/user/Cargo.toml index d50a0ba0..5609044f 100644 --- a/user/Cargo.toml +++ b/user/Cargo.toml @@ -8,4 +8,7 @@ edition = "2018" [dependencies] buddy_system_allocator = "0.6" -bitflags = "1.2.1" \ No newline at end of file +bitflags = "1.2.1" + +[profile.release] +debug = true