Ok, thanks a lot!
Now to the debugging, which initial debug commands will I have to use?
I used this one here in eclipse:
target remote localhost:3333
monitor reset
monitor sleep 500
monitor poll
monitor soft_reset_halt
monitor arm7_9 sw_bkpts enable
monitor mww 0xA0000050 0x01c2
monitor mdw 0xA0000050
break main
load
continue
But this does not work for codeblocks. Starting the debugger with the "Debug/Continue" button gives me this result:
Debugger name and version: GNU gdb 6.5.50.20060612-cvs
In ?? () ()
Continuing...
And thats all, the debugger stops not at the breakpoint and I'm also not able to step through the code.
Good morning!
Well with eclipse I was using the same arm-elf-gdb executable.
I also experimented with the commando-interface, this is the output:
GNU gdb 6.5.50.20060612-cvs
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "--host=i686-pc-mingw32 --target=arm-elf"...
(gdb) target remote localhost:3333
Remote debugging using localhost:3333
0x000d2664 in ?? ()
(gdb) monitor reset
(gdb) monitor sleep 500
(gdb) monitor poll
target state: halted
target halted in ARM state due to debug request, current mode: Undefined
cpsr: 0xf00000db pc: 0x000d26d0
(gdb) monitor soft_reset_halt
requesting target halt and executing a soft reset
(gdb) monitor arm7_9 sw_bkpts enable
software breakpoints enabled
(gdb) monitor mww 0xA0000050 0x01c2
(gdb) monitor mdw 0xA0000050
0xa0000050: 000001c2
(gdb) break main
Breakpoint 1 at 0x20000158: file main.c, line 6.
(gdb) list
1
2
3 int main(void)
4 {
5
6 int a = 0, b =5;
7 a = a + b;
8
9 while(1)
10 {
(gdb) run
Starting program: C:\ARMProjects\ARMTestII/main.elf
Don't know how to run. Try "help target".
(gdb)
So this is the output for the run command. Evertime I type "run" the OpenOCD closes with this error:
Error: gdb_server.c:101 gdb_get_char(): read: 10054
Ok, now I got a working script for the arm-elf-gdb commando interface:
starting gdb like this: arm-elf-gdb main.elf
set complaints 1
set output-radix 16
set input-radix 16
target remote localhost:3333
monitor reset
monitor sleep 500
monitor halt
set remote memory-write-packet-size 1024
set remote memory-write-packet-size fixed
set remote memory-read-packet-size 1024
set remote memory-read-packet-size fixed
set remote hardware-watchpoint-limit 2
set remote hardware-breakpoint-limit 2
load
break main
monitor arm7_9 sw_bkpts enable
monitor mww 0xA0000050 0x01c2
monitor mdw 0xA0000050
Continue
This results in total debuging paradise!
Pasting this script in codeblocks gives me this output:
Command-line: C:\Programme\yagarto\bin\arm-elf-gdb.exe -nx -fullname -quiet -args main.elf
Working dir : C:\ARMProjects\ARMTestII\
> set prompt >>>>>>cb_gdb:
(gdb) >>>>>>cb_gdb:
> show version
GNU gdb 6.5.50.20060612-cvs
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "--host=i686-pc-mingw32 --target=arm-elf".
>>>>>>cb_gdb:
> set confirm off
>>>>>>cb_gdb:
> set width 0
>>>>>>cb_gdb:
> set height 0
>>>>>>cb_gdb:
> set breakpoint pending on
>>>>>>cb_gdb:
> set print asm-demangle on
>>>>>>cb_gdb:
> set unwindonsignal on
>>>>>>cb_gdb:
> set debugevents on
No symbol "debugevents" in current context.
>>>>>>cb_gdb:
> set new-console on
No symbol "new" in current context.
>>>>>>cb_gdb:
> set disassembly-flavor att
No symbol "disassembly" in current context.
>>>>>>cb_gdb:
> set complaints 1
set output-radix 16
set input-radix 16
file main.elf
target remote localhost:3333
monitor reset
monitor sleep 500
monitor halt
set remote memory-write-packet-size 1024
set remote memory-write-packet-size fixed
set remote memory-read-packet-size 1024
set remote memory-read-packet-size fixed
set remote hardware-watchpoint-limit 2
set remote hardware-breakpoint-limit 2
load
break main
monitor arm7_9 sw_bkpts enable
monitor mww 0xA0000050 0x01c2
monitor mdw 0xA0000050
Continue
>>>>>>cb_gdb:>>>>>>cb_gdb:>>>>>>cb_gdb:>>>>>>cb_gdb:>>>>>>cb_gdb:
> directory C:/ARMProjects/ARMTestII/
0x200002e8 in __bss_start ()
>>>>>>cb_gdb:
>>>>>>cb_gdb:
requesting target halt...
>>>>>>cb_gdb:>>>>>>cb_gdb:>>>>>>cb_gdb:>>>>>>cb_gdb:>>>>>>cb_gdb:>>>>>>cb_gdb:>>>>>>cb_gdb:>>>>>>cb_gdb:Loading section .text, size 0x194 lma 0x20000000
Remote communication error: Bad file descriptor.
>>>>>>cb_gdb:Breakpoint 1 at 0x20000158: file main.c, line 6.
putpkt: write failed: No error.
>>>>>>cb_gdb:>>>>>>cb_gdb:>>>>>>cb_gdb:>>>>>>cb_gdb:>>>>>>cb_gdb:>>>>>>cb_gdb:
putpkt: write failed: No error.
putpkt: write failed: No error.
putpkt: write failed: No error.
And this is not working because the load command failes with:
Loading section .text, size 0x194 lma 0x20000000
Remote communication error: Bad file descriptor.