boards/arm/qemu/qemu-armv7a: add demo for gdbstub

Gdbstub support
===========
  The Qemu version must be above 9.2 to support two serial ports.

  One window:
  ./tools/configure.sh qemu-armv7a:gdbstub; make -j25
  qemu-system-arm -cpu cortex-a7 -nographic -machine virt,virtualization=off,gic-version=2 -net none -kernel ./nuttx  -serial mon:stdio -serial pty
  char device redirected to /dev/pts/26 (label serial1)
  nx_start: Entry
  uart_register: Registering /dev/console
  uart_register: Registering /dev/ttyS0

  Another window:
  gdb-multiarch nuttx -ex "target remot /dev/pts/26"
  GNU gdb (Ubuntu 15.0.50.20240403-0ubuntu1) 15.0.50.20240403-git
  Copyright (C) 2024 Free Software Foundation, Inc.
  License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
  This is free software: you are free to change and redistribute it.
  There is NO WARRANTY, to the extent permitted by law.
  Type "show copying" and "show warranty" for details.
  This GDB was configured as "x86_64-linux-gnu".
  Type "show configuration" for configuration details.
  For bug reporting instructions, please see:
  <https://www.gnu.org/software/gdb/bugs/>.
  Find the GDB manual and other documentation resources online at:
  <http://www.gnu.org/software/gdb/documentation/>.

  For help, type "help".
  Type "apropos word" to search for commands related to "word"...
  Reading symbols from nuttx...
  Remote debugging using /dev/pts/26
  gdb_get_registers (state=0x402052f8) at gdbstub/lib_gdbstub.c:1020
  1020              reg = state->running_regs;
  (gdb) c

Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
hujun5
2025-01-26 19:12:39 +08:00
committed by Xiang Xiao
parent d94cb53d6c
commit 857fdad220
2 changed files with 114 additions and 0 deletions

View File

@@ -211,3 +211,41 @@ The command that starts QEMU and enables the QEMU EDU device looks like this::
-machine virt,highmem=off,virtualization=off,gic-version=2 \
-chardev stdio,id=con,mux=on -serial chardev:con -mon chardev=con,mode=readline \
-kernel nuttx -device edu
Gdbstub support
===============
The Qemu version must be above 9.2 to support two serial ports.
One window::
$ ./tools/configure.sh qemu-armv7a:gdbstub; make -j25
qemu-system-arm -cpu cortex-a7 -nographic -machine virt,virtualization=off,gic-version=2 -net none -kernel ./nuttx -serial mon:stdio -serial pty
char device redirected to /dev/pts/26 (label serial1)
nx_start: Entry
uart_register: Registering /dev/console
uart_register: Registering /dev/ttyS0
Another window::
$ gdb-multiarch nuttx -ex "target remote /dev/pts/26"
GNU gdb (Ubuntu 15.0.50.20240403-0ubuntu1) 15.0.50.20240403-git
Copyright (C) 2024 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from nuttx...
Remote debugging using /dev/pts/26
gdb_get_registers (state=0x402052f8) at gdbstub/lib_gdbstub.c:1020
1020 reg = state->running_regs;
(gdb) c

View File

@@ -0,0 +1,76 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
CONFIG_ALARM_ARCH=y
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="qemu-armv7a"
CONFIG_ARCH_BOARD_QEMU_ARMV7A=y
CONFIG_ARCH_CHIP="qemu"
CONFIG_ARCH_CHIP_QEMU_ARM=y
CONFIG_ARCH_CHIP_QEMU_CORTEXA7=y
CONFIG_ARCH_INTERRUPTSTACK=2048
CONFIG_ARCH_LOWVECTORS=y
CONFIG_BOARD_MEMORY_RANGE="{0x40200000,0x48000000,0x6}"
CONFIG_BUILTIN=y
CONFIG_DEBUG_ASSERTIONS=y
CONFIG_DEBUG_FEATURES=y
CONFIG_DEBUG_FULLOPT=y
CONFIG_DEBUG_SCHED=y
CONFIG_DEBUG_SCHED_ERROR=y
CONFIG_DEBUG_SCHED_INFO=y
CONFIG_DEBUG_SCHED_WARN=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_DEFAULT_TASK_STACKSIZE=4096
CONFIG_EXAMPLES_HELLO=y
CONFIG_EXPERIMENTAL=y
CONFIG_FLASH_SIZE=127926272
CONFIG_FLASH_START=0x00600000
CONFIG_FLASH_VSTART=0x00600000
CONFIG_FS_PROCFS=y
CONFIG_FS_ROMFS=y
CONFIG_HAVE_CXX=y
CONFIG_HAVE_CXXINITIALIZE=y
CONFIG_IDLETHREAD_STACKSIZE=4096
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_INTELHEX_BINARY=y
CONFIG_LIBC_EXECFUNCS=y
CONFIG_LIB_GDBSTUB=y
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILEIOSIZE=512
CONFIG_NSH_READLINE=y
CONFIG_ONESHOT=y
CONFIG_PREALLOC_TIMERS=4
CONFIG_RAMLOG=y
CONFIG_RAM_SIZE=132120576
CONFIG_RAM_START=0x40200000
CONFIG_RAM_VSTART=0x40200000
CONFIG_RAW_BINARY=y
CONFIG_READLINE_CMD_HISTORY=y
CONFIG_RR_INTERVAL=200
CONFIG_SCHED_HPWORK=y
CONFIG_SCHED_HPWORKPRIORITY=192
CONFIG_SERIAL_GDBSTUB=y
CONFIG_SERIAL_GDBSTUB_AUTO_ATTACH=y
CONFIG_STACK_COLORATION=y
CONFIG_START_DAY=25
CONFIG_START_MONTH=4
CONFIG_START_YEAR=2023
CONFIG_SYMTAB_ORDEREDBYNAME=y
CONFIG_SYSTEM_NSH=y
CONFIG_SYSTEM_SYSTEM=y
CONFIG_TESTING_GETPRIME=y
CONFIG_TESTING_OSTEST=y
CONFIG_UART0_BASE=0x9000000
CONFIG_UART0_IRQ=33
CONFIG_UART0_PL011=y
CONFIG_UART0_SERIAL_CONSOLE=y
CONFIG_UART1_BASE=0x9040000
CONFIG_UART1_IRQ=40
CONFIG_UART1_PL011=y
CONFIG_UART_PL011=y
CONFIG_USEC_PER_TICK=1000