Hi, I am trying to use gdb to debug linux application program on hifive unleashed. With openocd cfg file and gdb in the freedom-u-sdk, I can attach to hifive unleashed, and I can see 5 thread. But how do I debug some application program?
For example, I built a simple application program, hello.c, compile it with -g, then I start openocd and gdb, below is my operation in gdb:
(gdb) target remote :3333
Remote debugging using :3333
warning: Target-supplied registers are not supported by the current architecture
warning: No executable has been specified and target does not support
determining executable automatically. Try using the “file” command.
0x0000000080000314 in ?? ()
(gdb) info threads
Id Target Id Frame
- 1 Thread 1 (Name: Hart 0, RV64) 0x0000000080000314 in ?? ()
2 Thread 2 (Name: Hart 1, RV64) 0x000000e00094adfc in ?? ()
3 Thread 3 (Name: Hart 2, RV64) 0x00000000800028ae in ?? ()
4 Thread 4 (Name: Hart 3, RV64) 0x000000e00096a61c in ?? ()
5 Thread 5 (Name: Hart 4, RV64) 0x000000e000971294 in ?? ()
(gdb) thread 2
[Switching to thread 2 (Thread 2)]
#0 0x000000e00094adfc in ?? ()
(gdb) info threads
Id Target Id Frame
1 Thread 1 (Name: Hart 0, RV64) 0x0000000080000314 in ?? () - 2 Thread 2 (Name: Hart 1, RV64) 0x000000e00094adfc in ?? ()
3 Thread 3 (Name: Hart 2, RV64) 0x00000000800028ae in ?? ()
4 Thread 4 (Name: Hart 3, RV64) 0x000000e00096a61c in ?? ()
5 Thread 5 (Name: Hart 4, RV64) 0x000000e000971294 in ?? ()
(gdb) file ~/tmp/test_hello/hello_hifive_u
A program is being debugged already.
Are you sure you want to change the file? (y or n) y
Reading symbols from ~/tmp/test_hello/hello_hifive_u…done.
(gdb) thread 2 apply load
[Switching to thread 2 (Thread 2)]
#0 0x000000e00094adfc in ?? ()
(gdb) l
1 #include <stdio.h>
2
3 void main() {
4 printf(“hello from hifive unleashed\n”);
5 }
(gdb) thread 2 apply continue
[Switching to thread 2 (Thread 2)]
#0 0x000000e00094adfc in ?? ()
but I cannot see any output in the serial port, so can anybody show me how could I debug app with gdb on hifive unleashed?