Forum: Mikrocontroller und Digitale Elektronik Arm debuggen mit openOCD + Yagart0


von Thorsten F. (thorstenf)


Lesenswert?

Ich versuche derzeit ein MCB2300 mit lpc2388 Board mit Eclipse, der 
Yagarto Toolchain,openOCD sowie einem Olimex arm-usb-ocd zu bearbeiten 
insbesondere zu debuggen.

Was mich verwirrt ist, dass ich an einem Rechner halbwegs zuverlässig 
debuggen kann, am anderen hab ich es noch nie geschafft. Dabei haben 
beide Rechner identische Versionen. Hier mal die von mir verwendete 
Software:

Cygwin
Yagarto Toolchain
openOCD (Freddie Chopin)
Eclipse Galileo mit Zylin CDT

Der Aufruf von OOCD erhält folgende Argumente:
1
-f D:\Programme\openOCD\tcl\interface\olimex-arm-usb-ocd.cfg
2
-f D:\Programme\openOCD\tcl\target\lpc2378.cfg
3
-c

und ergibt folgende Ausgabe:
1
Open On-Chip Debugger 0.2.0 (2009-10-26-15:00) Release
2
$URL: http://svn.berlios.de/svnroot/repos/openocd/tags/openocd-0.2.0/src/openocd.c $
3
For bug reports, read http://svn.berlios.de/svnroot/repos/openocd/trunk/BUGS
4
jtag_nsrst_delay: 200
5
jtag_ntrst_delay: 200
6
500 kHz
7
Info : device: 4
8
Info : deviceID: 364511235
9
Info : SerialNumber: FTSASBRWA
10
Info : Description: Olimex OpenOCD JTAG A
11
Info : JTAG tap: lpc2378.cpu tap/device found: 0x4f1f0f0f (mfg: 0x787, part: 0xf1f0, ver: 0x4)
12
Info : JTAG Tap/device matched
13
Warn : EmbeddedICE version 7 detected, EmbeddedICE handling might be broken
14
target state: halted
15
target halted in ARM state due to breakpoint, current mode: Abort
16
cpsr: 0xa00000d7 pc: 0x00000084

Bei Aufruf des arm-elf-gdb von Yagarto kriegt er folgende "run" 
Argumente mit:
1
target remote localhost:3333
2
monitor sleep 500
3
monitor poll
4
monitor flash probe 0
5
monitor flash erase_sector 0 0 0
6
monitor flash write_image main.bin 0x0
7
monitor reset run
8
monitor sleep 500
9
monitor soft_reset_halt
10
monitor arm7_9 force_hw_bkpts enable
11
symbol-file main.elf
12
info mem
13
thbreak main
14
continue

Und ich erhalte folgende Ausgabe:
1
Warning: /cygdrive/D/workspace/merses/LCD/.dep: No such file or directory.
2
Warning: /cygdrive/D/workspace/merses/LCD: No such file or directory.
3
mi_cmd_break_watch: Missing <expression>
4
No registers.
5
target remote localhost:3333
6
0x00000400 in lcd_print (string=0x8 "xG\300F\355") at LCD.c:293
7
293    while (*string)  {
8
monitor sleep 500
9
monitor poll
10
background polling: on
11
TAP: lpc2378.cpu (enabled)
12
target state: halted
13
target halted in ARM state due to breakpoint, current mode: Supervisor
14
cpsr: 0x200000d3 pc: 0x00000400
15
monitor flash probe 0
16
flash 'lpc2000' found at 0x00000000
17
monitor flash erase_sector 0 0 0
18
erased sectors 0 through 0 on flash bank 0 in 0.546875s
19
monitor flash write_image main.bin 0x0
20
Verification will fail since checksum in image(0xea0000e4) written to flash was different from calculated vector checksum(0x26fedf8f).
21
To remove this warning modify build tools on developer PC to inject correct LPC vector checksum.
22
wrote 1216 byte from file main.bin in 0.453125s (2.620690 kb/s)
23
monitor reset run
24
JTAG tap: lpc2378.cpu tap/device found: 0x4f1f0f0f (mfg: 0x787, part: 0xf1f0, ver: 0x4)
25
JTAG Tap/device matched
26
monitor sleep 500
27
monitor soft_reset_halt
28
requesting target halt and executing a soft reset
29
target state: halted
30
target halted in ARM state due to debug-request, current mode: Supervisor
31
cpsr: 0x200000d3 pc: 0x00000000
32
monitor arm7_9 force_hw_bkpts enable
33
Unknown command: arm7_9 force_hw_bkpts enable
34
called at file "command.c", line 469
35
symbol-file main.elf
36
Using memory regions provided by the target.
37
Num Enb Low Addr   High Addr  Attrs 
38
0   y    0x00000000 0x0007d000 flash blocksize 0x1000 nocache 
39
1   y    0x0007d000 0x100000000 rw nocache 
40
info mem
41
thbreak main
42
Hardware assisted breakpoint 1 at 0x412: file main.c, line 6.
43
continue

Bei Erreichen von continue friert das ganze ein. (bleibt bei 27% stehen 
laut eclipse) Auf einem anderen PC funktioniert das Debuggen mit 
identischer Software und Konfiguration "meistens".

Ich hoffe ihr könnt mir ein paar Tips geben was die Ursache sein könnte, 
beziehungsweise wie man das debuggen allgemein stabil hinkriegt. Bisher 
konnte mir leider kein Tutorial wirklich weiterhelfen.

Vielen Dank im Vorraus

von KeinPlan (Gast)


Lesenswert?

Ein paar Anmerkungen zur Software:

>Cygwin
überflüssig
>Yagarto Toolchain
>openOCD (Freddie Chopin)
ok, bei mir hat das dem libusb Treibern nie richtig funktioniert, hab es 
dann selbst mit libftd2xx erstellt. Vielleicht ist das auch das Problem 
bei dir?
>Eclipse Galileo mit Zylin CDT
überflüssig, kann CDT auch.
Install new software: 
http://download.eclipse.org/tools/cdt/releases/galileo
"Eclipse C/C++ GDB Hardware Debugging"

von Thorsten F. (thorstenf)


Lesenswert?

Vielen dank schonmal für die Tips.

Ich hatte schonmal ein neueres OpenOCD gemäß 
http://piconomic.berlios.de/build_openocd.html#OPENOCD_DOWNLOAD 
erstellt, bin jedoch wieder zurück zu Freddie Choppins Version nachdem 
ich keinen Unterschied feststellen konnte.
Ich bin mir allerdings auch nicht sicher ob es sich um die neueste 
Version handelte, da ich es nicht geschafft habe auf den svn zu 
connecten.

Evtl lief auch beim FTDI Treiber irgendwas schief, als Windows mich nach 
Treibern gefragt hat, wollte er trotzdem die CD von olimex :/

Ich glaube mich zu erinnern dass die binary im "gcc for dummies" auch 
direkt openocd-ftd22xx.exe  hieß? hätte das bei meiner Binary auch der 
Fall sein müssen wenn alles richtig läuft?

edit: Wie bringe ich das mit dem Hardware Debugging Plugin zum laufen? 
Hatte gehofft ich könnte die runcommands einfach übernehmen. Klappt 
allerdings nicht.

von KeinPlan (Gast)


Lesenswert?

Im Prinzip solltest du das einfach übernehmen können. Was genau klappt 
nicht?

Du musst unter Debugger:
arm-elf-gdb
Remote Target: JTAG Generic.
Hostname: localhost Port: 3333


Startup: (ohne gewähr)

Inizialisation:
x Reset and Delay 3s
x Halt

monitor sleep 500
monitor poll
monitor flash probe 0
monitor flash erase_sector 0 0 0
monitor flash write_image main.bin 0x0
monitor reset run
monitor sleep 500
monitor soft_reset_halt
monitor arm7_9 force_hw_bkpts enable
symbol-file main.elf
info mem


x Set breakpoint at: main
x Resume

von KeinPlan (Gast)


Lesenswert?

zu Openocd:
Beim selbst erstellen machst du nur die openocd.exe. Du kannst dann die 
openocd.exe von dem Freddie Chopin löschen und deine erstellte 
verwenden.
Die Treiber musst du dann trotzdem von Olimex bzw. direkt von FTDI 
installieren.
Ich habe es übrigends nach der Anleitung erstellt:
http://piconomic.berlios.de/build_openocd.html
Dazu brauchst du cygwin. Für eclipse benötigst du es aber nicht.

von Thorsten F. (thorstenf)


Lesenswert?

Ok musste noch das commandset umstellen, mit dem Windows commandset 
erkannte er wohl irgendwie "monitor" nicht.

jetzt erhalte ich folgenden Konsolenouput:
1
No symbol "new" in current context.
2
target remote localhost:3333
3
0x00000000 in __lcd_print_from_thumb ()
4
5
mi_cmd_break_watch: Missing <expression>
6
monitor sleep 500
7
monitor poll
8
monitor flash probe 0
9
monitor flash erase_sector 0 0 0
10
monitor flash write_image main.bin 0x0
11
monitor reset run
12
monitor sleep 500
13
monitor soft_reset_halt
14
monitor arm7_9 force_hw_bkpts enable
15
symbol-file main.elf
16
main.elf: No such file or directory.
17
info mem
18
Using memory regions provided by the target.
19
Num Enb Low Addr   High Addr  Attrs 
20
0   y    0x00000000 0x0007d000 flash blocksize 0x1000 nocache 
21
1   y    0x0007d000 0x100000000 rw nocache
sowie
1
background polling: on
2
TAP: lpc2378.cpu (enabled)
3
target state: halted
4
target halted in ARM state due to debug-request, current mode: Supervisor
5
cpsr: 0xa00000d3 pc: 0x00000000
6
flash 'lpc2000' found at 0x00000000
7
erased sectors 0 through 0 on flash bank 0 in 0.265625s
8
Verification will fail since checksum in image(0xea0000e4) written to flash was different from calculated vector checksum(0x26fedf8f).
9
To remove this warning modify build tools on developer PC to inject correct LPC vector checksum.
10
wrote 1216 byte from file main.bin in 0.453125s (2.620690 kb/s)
11
JTAG tap: lpc2378.cpu tap/device found: 0x4f1f0f0f (mfg: 0x787, part: 0xf1f0, ver: 0x4)
12
JTAG Tap/device matched
13
requesting target halt and executing a soft reset
14
target state: halted
15
target halted in ARM state due to debug-request, current mode: Supervisor
16
cpsr: 0xa00000d3 pc: 0x00000000
17
Unknown command: arm7_9 force_hw_bkpts enable
18
called at file "command.c", line 469

Danach hängt das ganze wieder, naja hatte ja nich direkt was mit dem 
eigentlichen Problem zu tun. Ich versuche jetzt erstmal wie das mit 
OpenOCD 0.3.0 aussieht.

Hat evtl jemand eine Erklärung warum er immer noch die Olimex CD für die 
Treiber will obwohl sie eigentlich in cygwin/tmp/ftd2xx vorliegen?

von Thorsten F. (thorstenf)


Lesenswert?

Ich musste inzwischen feststellen dass auch ein neueres OOCD 0.3.0 mir 
nicht geholfen hat, jetzt sieht es eben so aus:

OOCD anwerfen:
1
Open On-Chip Debugger 0.3.0 (2009-11-09-14:35)
2
$URL$
3
For bug reports, read
4
  http://openocd.berlios.de/doc/doxygen/bugs.html
5
User : 5 0 command.c:400 command_print(): debug_level: 3
6
C:\cygwin\tmp\openocd-0.3.0\src\openocd.exe: option requires an argument -- c
7
Debug: 6 0 configuration.c:83 find_file(): found C:\cygwin\tmp\openocd-0.3.0\tcl\interface\olimex-arm-usb-ocd.cfg
8
Debug: 8 0 command.c:68 script_debug(): command - interface
9
Debug: 9 0 command.c:77 script_debug(): interface - argv[0]=ocd_interface
10
Debug: 10 0 command.c:77 script_debug(): interface - argv[1]=ft2232
11
Debug: 12 32 command.c:68 script_debug(): command - ft2232_device_desc
12
Debug: 13 32 command.c:77 script_debug(): ft2232_device_desc - argv[0]=ocd_ft2232_device_desc
13
Debug: 14 32 command.c:77 script_debug(): ft2232_device_desc - argv[1]=Olimex OpenOCD JTAG
14
Debug: 16 32 command.c:68 script_debug(): command - ft2232_layout
15
Debug: 17 32 command.c:77 script_debug(): ft2232_layout - argv[0]=ocd_ft2232_layout
16
Debug: 18 32 command.c:77 script_debug(): ft2232_layout - argv[1]=olimex-jtag
17
Debug: 20 32 command.c:68 script_debug(): command - ft2232_vid_pid
18
Debug: 21 32 command.c:77 script_debug(): ft2232_vid_pid - argv[0]=ocd_ft2232_vid_pid
19
Debug: 22 32 command.c:77 script_debug(): ft2232_vid_pid - argv[1]=0x15ba
20
Debug: 23 32 command.c:77 script_debug(): ft2232_vid_pid - argv[2]=0x0003
21
Debug: 24 32 configuration.c:83 find_file(): found C:\cygwin\tmp\openocd-0.3.0\tcl\target\lpc2378.cfg
22
Debug: 26 32 command.c:68 script_debug(): command - jtag_nsrst_delay
23
Debug: 27 32 command.c:77 script_debug(): jtag_nsrst_delay - argv[0]=ocd_jtag_nsrst_delay
24
Debug: 28 32 command.c:77 script_debug(): jtag_nsrst_delay - argv[1]=200
25
User : 29 32 command.c:400 command_print(): jtag_nsrst_delay: 200
26
Debug: 31 32 command.c:68 script_debug(): command - jtag_ntrst_delay
27
Debug: 32 32 command.c:77 script_debug(): jtag_ntrst_delay - argv[0]=ocd_jtag_ntrst_delay
28
Debug: 33 32 command.c:77 script_debug(): jtag_ntrst_delay - argv[1]=200
29
User : 34 32 command.c:400 command_print(): jtag_ntrst_delay: 200
30
Debug: 36 32 command.c:68 script_debug(): command - reset_config
31
Debug: 37 32 command.c:77 script_debug(): reset_config - argv[0]=ocd_reset_config
32
Debug: 38 32 command.c:77 script_debug(): reset_config - argv[1]=trst_and_srst
33
Debug: 39 32 command.c:77 script_debug(): reset_config - argv[2]=srst_pulls_trst
34
User : 40 32 command.c:400 command_print(): trst_and_srst srst_pulls_trst srst_gates_jtag trst_push_pull srst_open_drain
35
Debug: 41 32 tcl.c:245 jim_newtap_cmd(): Creating New Tap, Chip: lpc2378, Tap: cpu, Dotted: lpc2378.cpu, 8 params
36
Debug: 42 32 tcl.c:262 jim_newtap_cmd(): Processing option: -irlen
37
Debug: 43 32 tcl.c:262 jim_newtap_cmd(): Processing option: -ircapture
38
Debug: 44 32 tcl.c:262 jim_newtap_cmd(): Processing option: -irmask
39
Debug: 45 32 tcl.c:262 jim_newtap_cmd(): Processing option: -expected-id
40
Debug: 46 79 core.c:1314 jtag_tap_init(): Created Tap: lpc2378.cpu @ abs position 0, irlen 4, capture: 0x1 mask: 0xf
41
Debug: 47 79 target.c:4514 jim_target(): Target command params:
42
Debug: 48 79 target.c:4515 jim_target(): target create lpc2378.cpu arm7tdmi -endian little -chain-position lpc2378.cpu -variant arm7tdmi-s_r4 
43
Debug: 50 141 command.c:68 script_debug(): command - bank
44
Debug: 51 141 command.c:77 script_debug(): bank - argv[0]=ocd_flash_bank
45
Debug: 52 141 command.c:77 script_debug(): bank - argv[1]=lpc2000
46
Debug: 53 141 command.c:77 script_debug(): bank - argv[2]=0x0
47
Debug: 54 141 command.c:77 script_debug(): bank - argv[3]=0x0007D000
48
Debug: 55 141 command.c:77 script_debug(): bank - argv[4]=0
49
Debug: 56 141 command.c:77 script_debug(): bank - argv[5]=0
50
Debug: 57 141 command.c:77 script_debug(): bank - argv[6]=lpc2378.cpu
51
Debug: 58 141 command.c:77 script_debug(): bank - argv[7]=lpc2000_v2
52
Debug: 59 141 command.c:77 script_debug(): bank - argv[8]=4000
53
Debug: 60 141 command.c:77 script_debug(): bank - argv[9]=calc_checksum
54
Debug: 62 282 command.c:68 script_debug(): command - jtag_khz
55
Debug: 63 282 command.c:77 script_debug(): jtag_khz - argv[0]=ocd_jtag_khz
56
Debug: 64 282 command.c:77 script_debug(): jtag_khz - argv[1]=500
57
Debug: 65 282 core.c:1581 jtag_config_khz(): handle jtag khz
58
Debug: 66 282 core.c:1537 jtag_khz_to_speed(): convert khz to interface specific speed value
59
User : 67 282 command.c:400 command_print(): 500 kHz
60
Debug: 69 282 command.c:68 script_debug(): command - init
61
Debug: 70 282 command.c:77 script_debug(): init - argv[0]=ocd_init
62
Debug: 71 407 openocd.c:129 handle_init_command(): target init complete
63
Debug: 72 407 ft2232.c:2109 ft2232_init(): ft2232 interface using shortest path jtag state transitions
64
Debug: 73 407 ft2232.c:1855 ft2232_init_ftd2xx(): 'ft2232' interface using FTD2XX with 'olimex-jtag' layout (15ba:0003)
65
Debug: 74 594 ft2232.c:1966 ft2232_init_ftd2xx(): current latency timer: 2
66
Info : 75 610 ft2232.c:1993 ft2232_init_ftd2xx(): device: 4 "2232C"
67
Info : 76 610 ft2232.c:1994 ft2232_init_ftd2xx(): deviceID: 364511235
68
Info : 77 610 ft2232.c:1995 ft2232_init_ftd2xx(): SerialNumber: FTSASBRWA
69
Info : 78 610 ft2232.c:1996 ft2232_init_ftd2xx(): Description: Olimex OpenOCD JTAG A
70
Debug: 79 610 ft2232.c:2447 olimex_jtag_init(): 80 08 1b
71
Debug: 80 610 ft2232.c:2491 olimex_jtag_init(): 82 09 0f
72
Debug: 81 610 core.c:1537 jtag_khz_to_speed(): convert khz to interface specific speed value
73
Debug: 82 610 core.c:1541 jtag_khz_to_speed(): have interface set up
74
Debug: 83 610 ft2232.c:520 ft2232_speed(): 86 0b 00
75
Debug: 84 625 core.c:1537 jtag_khz_to_speed(): convert khz to interface specific speed value
76
Debug: 85 625 core.c:1541 jtag_khz_to_speed(): have interface set up
77
Info : 86 625 core.c:1364 jtag_interface_init(): clock speed 500 kHz
78
Debug: 87 625 openocd.c:136 handle_init_command(): jtag interface init complete
79
Debug: 88 625 ft2232.c:1373 olimex_jtag_reset(): trst: 0, srst: 0, high_output: 0x01, high_direction: 0x0f
80
Debug: 89 625 core.c:702 jtag_add_reset(): SRST line released
81
Debug: 91 625 core.c:727 jtag_add_reset(): TRST line released
82
Debug: 92 625 core.c:327 jtag_call_event_callbacks(): jtag event: TAP reset
83
Debug: 93 1063 core.c:1378 jtag_init_inner(): Init JTAG chain
84
Debug: 94 1063 core.c:327 jtag_call_event_callbacks(): jtag event: TAP reset
85
Debug: 95 1063 core.c:1039 jtag_examine_chain(): DR scan interrogation for IDCODE/BYPASS
86
Debug: 96 1063 core.c:327 jtag_call_event_callbacks(): jtag event: TAP reset
87
Info : 97 1079 core.c:948 jtag_examine_chain_display(): JTAG tap: lpc2378.cpu tap/device found: 0x4f1f0f0f (mfg: 0x787, part: 0xf1f0, ver: 0x4)
88
Debug: 98 1079 core.c:1204 jtag_validate_ircapture(): IR capture validation scan
89
Debug: 99 1079 core.c:1257 jtag_validate_ircapture(): lpc2378.cpu: IR capture 0x01
90
Debug: 100 1079 openocd.c:142 handle_init_command(): jtag init complete
91
Info : 101 1079 embeddedice.c:206 embeddedice_build_reg_cache(): Embedded ICE version 7
92
Error: 102 1079 embeddedice.c:256 embeddedice_build_reg_cache(): EmbeddedICE v7 handling might be broken
93
Debug: 103 1079 embeddedice.c:452 embeddedice_write_reg(): 0: 0x00000000
94
Debug: 104 1079 arm7_9_common.c:61 arm7_9_clear_watchpoints(): -
95
Debug: 105 1079 embeddedice.c:452 embeddedice_write_reg(): 12: 0x00000000
96
Debug: 106 1079 embeddedice.c:452 embeddedice_write_reg(): 20: 0x00000000
97
Debug: 107 1079 openocd.c:145 handle_init_command(): jtag examine complete
98
Debug: 108 1079 openocd.c:151 handle_init_command(): flash init complete
99
Debug: 109 1079 openocd.c:155 handle_init_command(): mflash init complete
100
Debug: 110 1079 openocd.c:159 handle_init_command(): NAND init complete
101
Debug: 111 1079 openocd.c:163 handle_init_command(): pld init complete
102
Debug: 112 1157 gdb_server.c:2243 gdb_init(): gdb service for target arm7tdmi at TCP port 3333

Der Output im Debugger:
1
Warning: /cygdrive/D/workspace/merses/LCD/.dep: No such file or directory.
2
Warning: /cygdrive/D/workspace/merses/LCD: No such file or directory.
3
mi_cmd_break_watch: Missing <expression>
4
No registers.
5
target remote localhost:3333
6
0x00000000 in __lcd_print_from_thumb ()
7
monitor sleep 500
8
monitor poll
9
background polling: on
10
TAP: lpc2378.cpu (enabled)
11
target state: running
12
monitor flash probe 0
13
flash 'lpc2000' found at 0x00000000
14
monitor flash erase_sector 0 0 0
15
Target not halted
16
failed erasing sectors 0 to 0 (-304)
17
monitor flash write_image main.bin 0x0
18
Target not halted
19
error writing to flash at address 0x00000000 at offset 0x00000000 (-304)
20
21
called at file "command.c", line 473
22
called at file "embedded:startup.tcl", line 89
23
called at file "embedded:startup.tcl", line 91
24
called at file "embedded:startup.tcl", line 93
25
monitor reset run
26
JTAG tap: lpc2378.cpu tap/device found: 0x4f1f0f0f (mfg: 0x787, part: 0xf1f0, ver: 0x4)
27
monitor sleep 500
28
monitor soft_reset_halt
29
requesting target halt and executing a soft reset
30
target state: halted
31
target halted in ARM state due to debug-request, current mode: Supervisor
32
cpsr: 0x000000d3 pc: 0x00000000
33
monitor arm7_9 force_hw_bkpts enable
34
Unknown command: arm7_9 force_hw_bkpts enable
35
called at file "command.c", line 473
36
symbol-file main.elf
37
Using memory regions provided by the target.
38
Num Enb Low Addr   High Addr  Attrs 
39
0   y    0x00000000 0x0007d000 flash blocksize 0x1000 nocache 
40
1   y    0x0007d000 0x100000000 rw nocache 
41
info mem
42
thbreak main
43
Hardware assisted breakpoint 1 at 0x412: file main.c, line 6.
44
continue

Ich glaube dass es bei OOCD 0.3.0 derzeit allgemein noch Probleme gibt, 
unter anderem auch deshalb weil es mir vorher wenigstens möglich war 
erfolgreich den Flash zu löschen/füllen, aber trotz neuinstallation der 
FTDI Treiber funktioniert es nach wie vor auch nicht mit OOCD 0.2.0

Wie kann ich den verifizieren ob ich die richtigen Treiber habe?
Oder hat sonst noch jemand Theorien woran es liegen könnte?

Vielen Dank im Vorraus!

von Martin T. (mthomas) (Moderator) Benutzerseite


Lesenswert?

Das Ganze sieht doch nicht so schlecht aus. Denke nicht, dass 
herumprobieren mit verschiedenen FTDI-Treiberversionen etwas bringt.

Da flash erase_sector und flash write_image mit "Target not haltet" 
quittiert wird, scheint ein monitor soft_reset_halt vor Verwendung 
dieser Anweisungen angebracht. Weiter unten in der gezeigten Ausgabe 
erkannt man, dass soft_reset_halt offensichtlich funktioniert und das 
Target in den halt-mode bringt (nur zu spät für erase u. write).

arm7_9 force_hw_bkpts enable sollte inzwischen überflüssig sein und wird 
auch nicht "verstanden" - Fehlermeldung deutet darauf hin. In der 
Standardeinstellung kann gdb inzwischen von OpenOCD erfragen, in welchem 
Speicherbereich HW-Breakpoints erforderlich sind und setzt automatisch 
HW-Breakpoints falls erforderlich (und sofern seitens Controller noch 
welche verfügbar).

von Anselm 6. (anselm68)


Lesenswert?

Also meinen Arm würd ich, wenn schon, von einem Orthopäden "debuggen" 
lassen ggg

von Thorsten F. (thorstenf)


Lesenswert?

Vielen Dank für die Tipps, auch wenn sie mich bisher leider noch nicht 
zum erwünschten Erfolg geführt haben.

Nach einfügen eines soft_reset_halt sieht mein Output mittlerweile 
folgendermaßen aus:
1
Warning: /cygdrive/D/workspace/merses/LCD/.dep: No such file or directory.
2
Warning: /cygdrive/D/workspace/merses/LCD: No such file or directory.
3
mi_cmd_break_watch: Missing <expression>
4
No registers.
5
target remote localhost:3333
6
0x7fffe152 in ?? ()
7
monitor sleep 500
8
monitor poll
9
background polling: on
10
TAP: lpc2378.cpu (enabled)
11
target state: halted
12
target halted in Thumb state due to debug-request, current mode: Supervisor
13
cpsr: 0xa00000f3 pc: 0x7fffe152
14
monitor flash probe 0
15
flash 'lpc2000' found at 0x00000000
16
monitor soft_reset_halt
17
requesting target halt and executing a soft reset
18
target state: halted
19
target halted in ARM state due to debug-request, current mode: Supervisor
20
cpsr: 0xa00000d3 pc: 0x00000000
21
monitor flash erase_sector 0 0 0
22
erased sectors 0 through 0 on flash bank 0 in 0.296875s
23
monitor flash write_image main.bin 0x0
24
Verification will fail since checksum in image(0xea0000e4) written to flash was different from calculated vector checksum(0x26fedf8f).
25
To remove this warning modify build tools on developer PC to inject correct LPC vector checksum.
26
wrote 1216 byte from file main.bin in 0.500000s (2.375000 kb/s)
27
monitor reset run
28
JTAG tap: lpc2378.cpu tap/device found: 0x4f1f0f0f (mfg: 0x787, part: 0xf1f0, ver: 0x4)
29
JTAG Tap/device matched
30
monitor sleep 500
31
monitor soft_reset_halt
32
requesting target halt and executing a soft reset
33
target state: halted
34
target halted in ARM state due to debug-request, current mode: Supervisor
35
cpsr: 0xa00000d3 pc: 0x00000000
36
symbol-file main.elf
37
info mem
38
Using memory regions provided by the target.
39
Num Enb Low Addr   High Addr  Attrs 
40
0   y    0x00000000 0x0007d000 flash blocksize 0x1000 nocache 
41
1   y    0x0007d000 0x100000000 rw nocache 
42
thbreak main
43
Hardware assisted breakpoint 1 at 0x412: file main.c, line 6.
44
continue

So sieht es aber irgendwie nur beim jeweils ersten Versuch aus, 
ansonsten hängt das ganze etwas:
1
Warning: /cygdrive/D/workspace/merses/LCD/.dep: No such file or directory.
2
Warning: /cygdrive/D/workspace/merses/LCD: No such file or directory.
3
mi_cmd_break_watch: Missing <expression>
4
No registers.
5
target remote localhost:3333
6
0x00000004 in __lcd_print_from_thumb ()
7
monitor sleep 500
8
monitor poll
9
background polling: on
10
TAP: lpc2378.cpu (enabled)
11
target state: halted
12
target halted in ARM state due to debug-request, current mode: Undefined
13
cpsr: 0xa00000db pc: 0x00000004
14
monitor flash probe 0
15
flash 'lpc2000' found at 0x00000000
16
monitor soft_reset_halt
17
requesting target halt and executing a soft reset
18
target state: halted
19
target halted in ARM state due to debug-request, current mode: Supervisor
20
cpsr: 0xa00000d3 pc: 0x00000000
21
monitor flash erase_sector 0 0 0
22
timed out while waiting for target halted
23
lpc2000 prepare sectors returned 11681144
24
failed erasing sectors 0 to 0 (-902)
25
monitor flash write_image main.bin 0x0
26
Target not halted
27
error writing to flash at address 0x00000000 at offset 0x00000000 (-304)
28
29
called at file "command.c", line 469
30
called at file "embedded:startup.tcl", line 89
31
called at file "embedded:startup.tcl", line 91
32
called at file "embedded:startup.tcl", line 93
33
monitor reset run
34
JTAG tap: lpc2378.cpu tap/device found: 0x4f1f0f0f (mfg: 0x787, part: 0xf1f0, ver: 0x4)
35
JTAG Tap/device matched
36
monitor sleep 500
37
monitor soft_reset_halt
38
requesting target halt and executing a soft reset
39
target state: halted
40
target halted in ARM state due to debug-request, current mode: Supervisor
41
cpsr: 0xa00000d3 pc: 0x00000000
42
symbol-file main.elf
43
info mem
44
Using memory regions provided by the target.
45
Num Enb Low Addr   High Addr  Attrs 
46
0   y    0x00000000 0x0007d000 flash blocksize 0x1000 nocache 
47
1   y    0x0007d000 0x100000000 rw nocache 
48
thbreak main
49
Hardware assisted breakpoint 1 at 0x412: file main.c, line 6.
50
continue

Scheinbar hängt das ganze Board dann irgendwie. Ohne Neustart bzw hard 
reset erhalte ich dann immer diesen Block:
1
monitor flash erase_sector 0 0 0
2
timed out while waiting for target halted
3
lpc2000 prepare sectors returned 11681144
4
failed erasing sectors 0 to 0 (-902)
5
monitor flash write_image main.bin 0x0
6
Target not halted
7
error writing to flash at address 0x00000000 at offset 0x00000000 (-304)

edit: Wird ja immer lustiger hab noch ne neue Fehlermeldung bekommen 
ohne (bewusst?) etwas verändert zu haben:
1
memory write caused data abort (address: 0x40000008, size: 0x4, count: 0x6)
2
lpc2000 prepare sectors returned 11721968
3
failed erasing sectors 0 to 0 (-902)

von Thorsten F. (thorstenf)


Lesenswert?

Sry für Doppelpost, leider fehlt der Button zum editieren.

Inzwischen habe ich immer diese Fehlermeldung im ouput:
1
Warning: /cygdrive/D/workspace/merses/LCD/.dep: No such file or directory.
2
Warning: /cygdrive/D/workspace/merses/LCD: No such file or directory.
3
mi_cmd_break_watch: Missing <expression>
4
No registers.
5
target remote localhost:3333
6
lcd_print (string=0x20000000 "0@-\351") at LCD.c:292
7
292  {
8
monitor sleep 500
9
monitor poll
10
background polling: on
11
TAP: lpc2378.cpu (enabled)
12
target state: halted
13
target halted in ARM state due to debug-request, current mode: Abort
14
cpsr: 0x400000d7 pc: 0x000003e8
15
monitor flash probe 0
16
flash 'lpc2000' found at 0x00000000
17
monitor soft_reset_halt
18
requesting target halt and executing a soft reset
19
target state: halted
20
target halted in ARM state due to debug-request, current mode: Supervisor
21
cpsr: 0x400000d3 pc: 0x00000000
22
monitor flash erase_sector 0 0 0
23
memory write caused data abort (address: 0x40000000, size: 0x4, count: 0x2)
24
lpc2000 prepare sectors returned -307
25
failed erasing sectors 0 to 0 (-902)
26
monitor flash write_image main.bin 0x0
27
Verification will fail since checksum in image(0xea0000e4) written to flash was different from calculated vector checksum(0x26fedf8f).
28
To remove this warning modify build tools on developer PC to inject correct LPC vector checksum.
29
wrote 1216 byte from file main.bin in 0.453125s (2.620690 kb/s)
30
monitor reset run
31
JTAG tap: lpc2378.cpu tap/device found: 0x4f1f0f0f (mfg: 0x787, part: 0xf1f0, ver: 0x4)
32
JTAG Tap/device matched
33
monitor sleep 500
34
monitor soft_reset_halt
35
requesting target halt and executing a soft reset
36
target state: halted
37
target halted in ARM state due to debug-request, current mode: Supervisor
38
cpsr: 0x400000d3 pc: 0x00000000
39
symbol-file main.elf
40
Using memory regions provided by the target.
41
Num Enb Low Addr   High Addr  Attrs 
42
info mem
43
0   y    0x00000000 0x0007d000 flash blocksize 0x1000 nocache 
44
1   y    0x0007d000 0x100000000 rw nocache 
45
Hardware assisted breakpoint 1 at 0x412: file main.c, line 6.
46
thbreak main
47
continue

Also gibt es wohl trotz halt noch Probleme mit dem Flashzugriff :/

von Thorsten F. (thorstenf)


Lesenswert?

Erstmal entschuldigung wenn ich diesen Thread wieder aus der Versenkung 
hole, aber ich bin leider immer noch nicht schlauer geworden.

Vor allem verwirrt mich, ich habe das ganze jetzt auf 4 verschiedenen 
Rechnern eingerichtet, jeweils nach der exakt selben vorgehensweise:

cygwin installiert (wegen make)
eclipse cdt
yagarto
gnuarm eclipse plugin + zylin plugin
openOCD 0.2.0 SR1 von Freddie Choppins seite
Lib-USB w32
Originaltreiber von Olimex für den Arm-usb-ocd

Allerdings funktioniert es auf einem Rechner sehr stabil, auf einem 
anderen halbwegs. Auf zwei weiteren erhalte ich entweder die 
Fehlermeldungen

lpc2000 prepare sectors returned -307
failed erasing sectors 0 to 0 (-902)

oder es hängt einfach bei continue. Ich habe alle Versionen 
untereinander verglichen und sie sind identisch. Hat jemand eine Idee 
woran es noch liegen könnte?

vielen dank im vorraus!

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.