From: Heinrich Schuchardt Date: Fri, 28 May 2021 16:22:14 +0000 (+0200) Subject: docs: debugging OpenSBI X-Git-Tag: v1.3~526 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d9ba6536d307f05a838e7c96cd20b0b7e43ec886;p=platform%2Fkernel%2Fopensbi-spacemit.git docs: debugging OpenSBI Describe how to debug OpenSBI on QEMU with GDB. Signed-off-by: Heinrich Schuchardt Reviewed-by: Atish Patra --- diff --git a/docs/platform/qemu_virt.md b/docs/platform/qemu_virt.md index 2777148..0783be4 100644 --- a/docs/platform/qemu_virt.md +++ b/docs/platform/qemu_virt.md @@ -147,3 +147,27 @@ qemu-system-riscv32 -M virt -m 256M -nographic \ -device virtio-blk-device,drive=hd0 \ -append "root=/dev/vda rw console=ttyS0" ``` + +Debugging with GDB +------------------ + +In a first console start OpenSBI with QEMU: + +``` +qemu-system-riscv64 -M virt -m 256M -nographic \ + -bios build/platform/generic/firmware/fw_payload.bin \ + -gdb tcp::1234 \ + -S + +``` + +Parameter *-gdb tcp::1234* specifies 1234 as the debug port. +Parameter *-S* lets QEMU wait at the first instruction. + +In a second console start GDB: + +``` +gdb build/platform/generic/firmware/fw_payload.elf \ + -ex 'target remote localhost:1234' + +```