Debug using gdb on qemu.
This commit is contained in:
parent
5b69a312ba
commit
c0b5643c85
1 changed files with 8 additions and 1 deletions
|
@ -3,6 +3,7 @@ TARGET := riscv64gc-unknown-none-elf
|
||||||
MODE := release
|
MODE := release
|
||||||
KERNEL_ELF := target/$(TARGET)/$(MODE)/os
|
KERNEL_ELF := target/$(TARGET)/$(MODE)/os
|
||||||
KERNEL_BIN := $(KERNEL_ELF).bin
|
KERNEL_BIN := $(KERNEL_ELF).bin
|
||||||
|
KERNEL_ENTRY_PA := 0x80020000
|
||||||
DISASM_TMP := target/$(TARGET)/$(MODE)/asm
|
DISASM_TMP := target/$(TARGET)/$(MODE)/asm
|
||||||
|
|
||||||
# BOARD
|
# BOARD
|
||||||
|
@ -48,7 +49,7 @@ ifeq ($(BOARD),qemu)
|
||||||
-machine virt \
|
-machine virt \
|
||||||
-nographic \
|
-nographic \
|
||||||
-bios $(BOOTLOADER) \
|
-bios $(BOOTLOADER) \
|
||||||
-device loader,file=$(KERNEL_BIN),addr=0x80020000
|
-device loader,file=$(KERNEL_BIN),addr=$(KERNEL_ENTRY_PA)
|
||||||
else
|
else
|
||||||
@cp $(BOOTLOADER) $(BOOTLOADER).copy
|
@cp $(BOOTLOADER) $(BOOTLOADER).copy
|
||||||
@dd if=$(KERNEL_BIN) of=$(BOOTLOADER).copy bs=128K seek=1
|
@dd if=$(KERNEL_BIN) of=$(BOOTLOADER).copy bs=128K seek=1
|
||||||
|
@ -58,4 +59,10 @@ else
|
||||||
miniterm --eol LF --dtr 0 --rts 0 --filter direct $(K210-SERIALPORT) 115200
|
miniterm --eol LF --dtr 0 --rts 0 --filter direct $(K210-SERIALPORT) 115200
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
debug: build
|
||||||
|
@tmux new-session -d \
|
||||||
|
"qemu-system-riscv64 -machine virt -nographic -bios $(BOOTLOADER) -device loader,file=$(KERNEL_BIN),addr=$(KERNEL_ENTRY_PA) -s -S" && \
|
||||||
|
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 kernel clean disasm disasm-vim run-inner
|
.PHONY: build kernel clean disasm disasm-vim run-inner
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue