Hello members,
Earlier I had setup openocd-0.9.0 with jlink jtag and cross gdb 7.9.1 on Atmel
9260 (arm9) board. With this setup I had been able to put breakpoints in the linux
kernel (2.6.32.67) and single step the code.
Now I will be developing an application on RPi B+ which will interface with
devices through user space drivers and kernel modules. In this context,
I have a basic doubt: Is it possible to use host-gdb/openocd setup to debug
an user application on RPI ?
If we are loading the application through host-gdb, with which userid does
the application start ? parent process ? Also typically there would be a
"mon halt" preceding, in such a case how does loading work at all ?
If we are alreadying starting the application (and keep it in a wait state),
then through gdb we would attach to it. However, in openocd I could
not find any command for this. I am missing something big here.
----------------------------------------------
For what's it worth, I tried to load a to load and step through a simple
'helloworld' program on the target board. After starting the openocd server,
used the following gdb commands .
1. start cross gdb with 'helloworld' elf file
2. set solib-absolute-prefix /mnt/builds/rootfs
3. target remote :3333
4. load helloworld
But loading fails in gdb and at that moment
there is an "Address translation failure" message in openocd logs.
GDB
=====================================================================================
$ arm-poky-linux-gnueabi-gdb helloworld
GNU gdb (GDB) 7.9.1
...
Reading symbols from helloworld...done.
(gdb) set solib-absolute-prefix /mnt/builds/rootfs
(gdb) target remote :3333
Remote debugging using :3333
Reading symbols from /mnt/builds/rootfs/lib/ld-linux.so.3...(no debugging symbols found)...done.
0x00000000 in ?? ()
(gdb) mon halt
target state: halted
target halted in ARM state due to debug-request, current mode: Supervisor
cpsr: 0x600000d3 pc: 0xc002cc24
MMU: enabled, D-Cache: enabled, I-Cache: disabled
(gdb) load helloworld
Loading section .interp, size 0x13 lma 0x10134
Loading section .note.ABI-tag, size 0x20 lma 0x10148
Loading section .note.gnu.build-id, size 0x24 lma 0x10168
Loading section .gnu.hash, size 0x2c lma 0x1018c
Loading section .dynsym, size 0x50 lma 0x101b8
Loading section .dynstr, size 0x43 lma 0x10208
Loading section .gnu.version, size 0xa lma 0x1024c
Loading section .gnu.version_r, size 0x20 lma 0x10258
Loading section .rel.dyn, size 0x8 lma 0x10278
Loading section .rel.plt, size 0x20 lma 0x10280
Loading section .init, size 0xc lma 0x102a0
Loading section .plt, size 0x44 lma 0x102ac
Loading section .text, size 0x1fc lma 0x102f0
Loading section .fini, size 0x8 lma 0x104ec
Loading section .rodata, size 0x20 lma 0x104f4
Loading section .ARM.exidx, size 0x8 lma 0x10514
Loading section .eh_frame, size 0x4 lma 0x1051c
Loading section .init_array, size 0x4 lma 0x20520
Loading section .fini_array, size 0x4 lma 0x20524
Load failed <========================================
(gdb) break main
Breakpoint 1 at 0x10420: file helloworld.c, line 6.
(gdb) c
Continuing.
Warning:
Cannot insert breakpoint -1.
Cannot access memory at address 0xffe4
(gdb)
---------------------------------------------
OPENOCD:
...
Open On-Chip Debugger 0.10.0-dev-00068-g3fb77e5 (2015-11-07-14:43)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
adapter speed: 3 kHz
jtag
trst_and_srst separate srst_gates_jtag trst_push_pull srst_open_drain connect_deassert_srst
adapter_nsrst_delay: 300
jtag_ntrst_delay: 200
adapter speed: 3 kHz
srst_only separate srst_gates_jtag srst_open_drain connect_deassert_srst
Info : clock speed 3 kHz
Info : JTAG tap: at91sam9260.cpu tap/device found: 0x0792603f (mfg: 0x01f, part: 0x7926, ver: 0x0)
Info : Embedded ICE version 6
Info : at91sam9260.cpu: hardware has 2 breakpoint/watchpoint units
Info : accepting 'gdb' connection on tcp/3333
undefined debug reason 7 - target needs reset
Error: Target not halted
...
Warn : target not halted
target state: halted
target halted in ARM state due to debug-request, current mode: Supervisor
cpsr: 0x600000d3 pc: 0xc002cc24
MMU: enabled, D-Cache: enabled, I-Cache: disabled
Warn : negative acknowledgment, but no packet pending
Warn : negative acknowledgment, but no packet pending
Warn : negative acknowledgment, but no packet pending
Warn : negative acknowledgment, but no packet pending
Warn : negative acknowledgment, but no packet pending
Warn : negative acknowledgment, but no packet pending
Warn : negative acknowledgment, but no packet pending
Error: Address translation failure
Warn : negative acknowledgment, but no packet pending
Error: Address translation failure <================================
Warn : negative acknowledgment, but no packet pending
Warn : keep_alive() was not invoked in the 1000ms timelimit. GDB alive packet not sent! (1180).
Workaround: increase "set remotetimeout" in GDB
Warn : memory read caused data abort (address: 0x0000ffe4, size: 0x4, count: 0x1)
Error: can't add breakpoint: unknown reason
Warn : negative acknowledgment, but no packet pending
Warn : negative acknowledgment, but no packet pending
Warn : keep_alive() was not invoked in the 1000ms timelimit. GDB alive packet not sent! (1001).
Workaround: increase "set remotetimeout" in GDB