Hi,
I try to debug a C code but I always run into a pitfall. Please somebody help me! Here
are the details:
My target is a remote target, the AT91SAM7S256 microcontoller. It has ARM7TDMI core. The
architecture of it is armv4t.
I use the openOCD created by Dominic Rath. Thank you Dominic!
I didnt try this on Linux only on window$ yet. I can use the yagarto (native) or the
sourcery g++ toolchain (native, but it can use the cygwin as well)âŚthe problem is the
same in either case.
The code which I like to debug is this:
/test.c/
main () { /This is just a test code, meaningless./
int a;
int b;
while (1) {
a=2;
b=3;
a+=b;
}
}
COMPILE
==========
I compile with these parameters:
CC -march=armv4t -mcpu=arm7tdmi -LE -g -gdwarf-2 -o test.elf test.c
where CC is arm-none-eabi-gcc (sourcery g++) or arm-elf-gcc (yagarto).
After that I create a .bin file.
OB -O binary test.elf test.bin
Where OB is arm-none-eabi-objcopy (sourcery g++) or arm-elf-objcopy (yagarto)
I can compile without any error or warning message.
I load the test.bin in the flash using JTAG wiggler interface and the
openOCD.
OPENOCD
==========
My openOCD config file contain these lines:
#Deamon configuration
gdb_port 3333
telnet_port 4444
deamon_startup attach
#JTAG interface configuration
interface parport
jtag_speed 0
reset_config srst_only
jtag_device 4 0x1 0xf 0xe
#jtag_nsrst_delay
#jtag_ntrst_delay
#Parport options
parport_port 0x378
parport_cable wiggler
#target configuration
target arm7tdmi little reset_halt 0 arm7tdmi
#run_and_halt_time
#working_area
#Flash configuration
flash bank at91sam7 0 0 0 0 0
After the start I have got 2 info:
info: openocd.c:82 main(): Open On-Chip Debbuger (2006-09-28 20:00 CEST)
info: configuration.c:50 configuration_output_handler(): Command
deamon_startup not found
I dont know what is mean the second one, but there is no problem in during
the flash write. I load the test.bin in the flash using telnet.
LOAD the test.bin
===================
Start the telnet:
telnet localhost 4444
I get a prompt like this:
Open On-Chip Debugger
The sequence is:
soft reset
flash erase 0 0 15
flash write 0 test.bin 0
soft reset
arm7_9 sw_bkpts enable
This works well.
Debug
=====================
I use the arm-elf or the arm-none-eabi gdbâŚI will sign this just gdb.
start:
gdb test.elf
then it write some line information about himself. I think maybe this would be
important:
This GDB was configured as ââhost=i686-pc-mingw32 --target=arm-elfâ âŚ
(yagarto)
âtarget=arm-none-eabi"
âŚ(sourcery g++)
I have a celeron 800MHz.
Then I connect to the remote target (the prompt is (gdb) now )
(gdb)target remote localhost:3333
Remote debugging using localhost:3333
0x000048a0 in ?? ()
(gdb)
Now if I try to execute a âstepâ or ânextâ I see:
(gdb)next
Cannot find bounds of current function
(gdb)step
Cannot find bounds of current function
Daniel Jacobowitz wrote me I am not in the main().I have to make a
breakpoint at the entry of the main and execute the continue
command. Thank You Daniel! If I do this then:
(gdb)break main
Breakpoint 1 at 0x821c: file test.c, line 6.
(gdb)continue
Continuing.
Thats allâŚI dont get back the (gdb) promptâŚ
openOCD deamon write an error message:
error: arm7_9_common.c:1771 arm7_9_read_memory():memory read caused data abort
What is this? I dont understand. Please!
Where is the mistake? What I can do? Please somebody help me!
The list command is alright and I can debug assembly code without
any trouble.
Thank You!
David