NOEL-ARTYA7-EX-QSG
December 2020, Version 1.2
11
www.cobhamaes.com/gaisler
grmon3> forward enable uart0
I/O forwarding to uart0 enabled
grmon3> dtb board.dtb
DTB will be loaded to the stack
grmon3> run
hello, world
CPU 0: Forced into debug mode
0x4001607c: 00100073 ebreak <_CPU_Fat36>
CPU 1: Interrupted!
0x40011018: 10500073 wfi <_CPU_Thread_Id0>
The line
hello, world
is the program output which is forwarded to the GRMON terminal.
4.9. Debugging with GDB
It possible to connect the GDB debugger to GRMON to be able to debug programs at source level. Either start
GRMON with the
-gdb
flag or enter the
gdb
command in GRMON.
grmon3> gdb
Started GDB service on port 2222.
GDB is included with the RTEMS toolchain as
riscv-rtems5-gdb
:
user@workstation:~$ riscv-rtems5-gdb
GNU gdb (GDB) 8.3
Copyright (C) 2019 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 "--host=x86_64-pc-linux-gnu --target=riscv-rtems5".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://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".
(gdb)
Specify the filename of the image to debug using the
file
command:
(gdb) file /home/user/riscv/demo/hello/hello.exe
Reading symbols from /home/user/riscv/demo/hello/hello.exe...
Connect to GRMON using
target extended-remote
:
(gdb) target extended-remote :2222
Remote debugging using :2222
0x0000000000000000 in ?? ()
The image can be loaded onto the target using the
load
command. This needs to be done before starting or
restarting the program.
(gdb) load
Loading section .start, size 0x4c lma 0x40000000
Loading section .text, size 0x132e8 lma 0x4000004c
Loading section .rodata, size 0x120a0 lma 0x40013338
Loading section .sdata2, size 0x30 lma 0x400253d8
Loading section .eh_frame, size 0x4 lma 0x40025408
Loading section .init_array, size 0x8 lma 0x40025410
Loading section .fini_array, size 0x8 lma 0x40025418
Loading section .rtemsroset, size 0x68 lma 0x40025420