From 1205a81f352b6ddc91038408518384daab4d8fc9 Mon Sep 17 00:00:00 2001 From: Yifan Wu Date: Sat, 16 Apr 2022 15:46:29 -0700 Subject: [PATCH] Bump Rust to nightly-2022-04-11 && support dubugging in release mode --- .gitignore | 1 + os/Cargo.toml | 5 ++++- os/Makefile | 13 ++++++++++++- rust-toolchain | 2 +- user/Cargo.toml | 5 ++++- 5 files changed, 22 insertions(+), 4 deletions(-) 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/os/Cargo.toml b/os/Cargo.toml index f8cbacdc..c690db67 100644 --- a/os/Cargo.toml +++ b/os/Cargo.toml @@ -15,4 +15,7 @@ xmas-elf = "0.7.0" [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 505d37ec..b972600b 100644 --- a/os/Makefile +++ b/os/Makefile @@ -11,6 +11,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 @@ -92,4 +97,10 @@ 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 +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 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 aa6e20fe..2b492c78 100644 --- a/user/Cargo.toml +++ b/user/Cargo.toml @@ -7,4 +7,7 @@ edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -buddy_system_allocator = "0.6" \ No newline at end of file +buddy_system_allocator = "0.6" + +[profile.release] +debug = true