bdiGDB
for GNU Debugger, BDI2000 (ARM11/Cortex-A8) User Manual 40
© Copyright 1997-2007 by ABATRON AG Switzerland V 1.04
3.3 Debugging with GDB
Because the target agent runs within BDI, no debug support has to be linked to your application.
There is also no need for any BDI specific changes in the application sources. Your application must
be fully linked because no dynamic loading is supported.
3.3.1 Target setup
Target initialization may be done at two places. First with the BDI configuration file, second within the
application. The setup in the configuration file must at least enable access to the target memory
where the application will be loaded. Disable the watchdog and setting the CPU clock rate should
also be done with the BDI configuration file. Application specific initializations like setting the timer
rate are best located in the application startup sequence.
3.3.2 Connecting to the target
As soon as the target comes out of reset, BDI initializes it and loads your application code. If RUN is
selected, the application is immediately started, otherwise only the target PC is set. BDI now waits
for GDB request from the debugger running on the host.
After starting the debugger, it must be connected to the remote target. This can be done with the fol-
lowing command at the GDB prompt:
(gdb)target remote bdi2000:2001
bdi2000 This stands for an IP address. The HOST file must have an appropriate
entry. You may also use an IP address in the form xxx.xxx.xxx.xxx
2001 This is the TCP port used to communicate with the BDI
If not already suspended, this stops the execution of application code and the target CPU changes
to background debug mode.
Remember, every time the application is suspended, the target CPU is freezed. During this time no
hardware interrupts will be processed.
Note: For convenience, the GDB detach command triggers a target reset sequence in the BDI.
(gdb)...
(gdb)detach
... Wait until BDI has resetet the target and reloaded the image
(gdb)target remote bdi2000:2001
Note:
GDB sometimes fails to connect to the target after a reset because it tries to read an invalid stack
frame. With the following init list entries you can work around this GDB startup problem:
WGPR 11 0x00000020 ;set frame pointer to free RAM
WM32 0x00000020 0x00000028 ;dummy stack frame