Quanton Debug Problem

thomaskausm

Neuer Benutzer
#1
Hallo zusammen,

ich versuche gerade die Tau Software auf einem Qunaton Board via Eclipse zu debuggen. Leider klappt es nicht so wie gewünscht ....

Der Open OCD Daemon startet wie erwartet mit

Open On-Chip Debugger 0.7.0-dev-00128-gcf1418e-dirty (2013-11-18-18:22)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.sourceforge.net/doc/doxygen/bugs.html
adapter speed: 1000 kHz
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Info : clock speed 1000 kHz
Info : STLINK v2 JTAG v17 API v2 SWIM v0 VID 0x0483 PID 0x3748
Info : Target voltage: 2.883951
Info : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpoints​

Starte ich aber nun Debugger wird vom OCD

Info : accepting 'gdb' connection from 3333
Info : device id = 0x10016413
Info : flash size = 1024kbytes
Warn : acknowledgment received, but no packet pending
undefined debug reason 6 - target needs reset
Error: timed out while waiting for target halted
TARGET: stm32f4x.cpu - Not halted

in procedure 'reset'
Error: Target not halted
Error: failed erasing sectors 5 to 6
Error: flash_erase returned -304​

gemeldet. Ich debugge (oder besser versuche :) ) das Quanton Board via dem ST-Link Module eines Discovery Boards zu debuggen.

Via dem "Program" Menupunkt lässt sich die Software sauber auf das Quantonboard flashen .... somit sollte die Verbindung OCD <-> STMF4 funktionieren.

Kann mir jemand sagen was ich hier falsch mache bzw. wie es richtig geht :)

Vielen Dank
Thomas
 
#2
In der Debug Konfiguration beim Tab "Startup" alle Haken entfernen, dann bei "Initialization Commands" folgende Sequenz eintragen:
Code:
monitor reset halt
file build/fw_quanton/fw_quanton.elf
load
monitor reset halt
Grüße
Vinz
 

thomaskausm

Neuer Benutzer
#3
In der Debug Konfiguration beim Tab "Startup" alle Haken entfernen, dann bei "Initialization Commands" folgende Sequenz eintragen:
Code:
monitor reset halt
file build/fw_quanton/fw_quanton.elf
load
monitor reset halt
Grüße
Vinz
Hallo Vinz,

leider geht es immer noch nicht. Habe alle Haken entfernt und

Code:
monitor reset halt
file /home/thomas/git/Tau/build/fw_quanton/fw_quanton.elf
load
monitor reset halt
eingefügt (habe absoluten Pfad benutzen müssen da sonst das Elf File nicht gefunden wird.) Jetzt bekomme ich auf der OCD Konsole

Warn : acknowledgment received, but no packet pending
undefined debug reason 6 - target needs reset
Error: timed out while waiting for target halted
TARGET: stm32f4x.cpu - Not halted

in procedure 'reset'
Auto-detected RTOS: FreeRTOS
Error: Target not halted
Error: failed erasing sectors 5 to 6
Error: flash_erase returned -304
Error: timed out while waiting for target halted
TARGET: stm32f4x.cpu - Not halted

in procedure 'reset'
und der Debugger "sagt"

Code:
Error erasing flash with vFlashErase packet

Hoppla was ist denn jetzt ... jetzt bekomme ich die Threadliste d.h. Rtos wird erkannt allerdings ist ein Steppen nicht möglich ... die Ausführung wird sofort wieder angehalten als wenn man auf einen Breakpoint laufen würde ... da ist aber keiner.
Jetzt bekomme ich im OCD Fenster

Code:
undefined debug reason 6 - target needs reset
Error: timed out while waiting for target halted
TARGET: stm32f4x.cpu - Not halted

in procedure 'reset'
Auto-detected RTOS: FreeRTOS
Error: Target not halted
Error: failed erasing sectors 5 to 6
Error: flash_erase returned -304
Error: timed out while waiting for target halted
TARGET: stm32f4x.cpu - Not halted

in procedure 'reset'
Warn : The target is not in the halted nor running stated, stepi/continue ignored.
Warn : The target is not in the halted nor running stated, stepi/continue ignored.
Warn : The target is not in the halted nor running stated, stepi/continue ignored.
Warn : The target is not in the halted nor running stated, stepi/continue ignored.
Error: jtag status contains invalid mode value - communication failure
Polling target failed, GDB will be halted. Polling again in 100ms
Error: jtag status contains invalid mode value - communication failure
Polling target failed, GDB will be halted. Polling again in 300ms
Error: jtag status contains invalid mode value - communication failure
Polling target failed, GDB will be halted. Polling again in 700ms
Error: jtag status contains invalid mode value - communication failure
Polling target failed, GDB will be halted. Polling again in 1500ms
Error: jtag status contains invalid mode value - communication failure
Polling target failed, GDB will be halted. Polling again in 3100ms
Error: jtag status contains invalid mode value - communication failure
Polling target failed, GDB will be halted. Polling again in 6300ms
Error: jtag status contains invalid mode value - communication failure
Polling target failed, GDB will be halted. Polling again in 6300ms

Kann es sein dass das Debuggen via dem Discoveryboard bzw. dessen STLink Schnittstelle ein bisschen instabil ist ?

lilvinz was benutzt Du um das Quanton Board zu debuggen ?

Vielen Dank für Deine Hilfe
Thomas
 
#4
Dein Problem beginnt hiert:

Code:
TARGET: stm32f4x.cpu - Not halted
Das musst du als erstes lösen.
Normalerweise wird die CPU durch den Befehl
Code:
monitor reset halt
angehalten, was aber in deinem Fall nicht zu klappen scheint.

Das mit dem relativen Pfad könnte daran liegen, dass du nicht das DSF Framework benutzt.

Versuch es doch mal nackig mit openocd, dann mit openocd + gdb und erst wenn das klappt, mit eclipse.
Checke auch mal, ob du nicht irgendwo eine .gdbinit herum liegen hast, die einfach so ausgeführt wird.

Grüße

Vinz
 

thomaskausm

Neuer Benutzer
#5
Hallo Vinz,

Dein Vorschlag klingt logisch ... also OCD händisch gestartet:

Code:
thomas@papaskiste:~/git/Tau/tools/openocd/share/openocd$ /home/thomas/git/Tau/tools/openocd/bin/openocd -f scripts/board/stm32f4discovery.cfg
Open On-Chip Debugger 0.7.0-dev-00128-gcf1418e-dirty (2013-11-18-18:22)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.sourceforge.net/doc/doxygen/bugs.html
adapter speed: 1000 kHz
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Info : clock speed 1000 kHz
Info : STLINK v2 JTAG v17 API v2 SWIM v0 VID 0x0483 PID 0x3748
Info : Target voltage: 2.847907
Info : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpoints
und den gdb dran gehängt .. aber schon " monitor reset halt"

Code:
thomas@papaskiste:~/git/Tau$ ./tools/gcc-arm-none-eabi-4_7-2013q1/bin/arm-none-eabi-gdb
GNU gdb (GNU Tools for ARM Embedded Processors) 7.4.1.20130312-cvs
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i686-linux-gnu --target=arm-none-eabi".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
(gdb) target extended localhost:3333
Remote debugging using localhost:3333
0x00000000 in ?? ()
(gdb) monitor reset halt
timed out while waiting for target halted
TARGET: stm32f4x.cpu - Not halted

in procedure 'reset'
(gdb)
führt nicht zum erwarteten Ergebniss. "monitor halt" und "monitor reset" geht durch

Code:
in procedure 'reset'
(gdb) monitor halt
target state: halted
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x08001388 msp: 0x200003c0
(gdb) monitor reset
(gdb)
aber das Laden geht schief ..

Code:
(gdb) file /home/thomas/git/Tau/build/fw_quanton/fw_quanton.elf
A program is being debugged already.
Are you sure you want to change the file? (y or n) y
Reading symbols from /home/thomas/git/Tau/build/fw_quanton/fw_quanton.elf...done.
(gdb) load
Error erasing flash with vFlashErase packet
(gdb)

in der OCD Console sind mittlerweile folgende Info aufgelaufen:

Code:
thomas@papaskiste:~/git/Tau/tools/openocd/share/openocd$ /home/thomas/git/Tau/tools/openocd/bin/openocd -f scripts/board/stm32f4discovery.cfg
Open On-Chip Debugger 0.7.0-dev-00128-gcf1418e-dirty (2013-11-18-18:22)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.sourceforge.net/doc/doxygen/bugs.html
adapter speed: 1000 kHz
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Info : clock speed 1000 kHz
Info : STLINK v2 JTAG v17 API v2 SWIM v0 VID 0x0483 PID 0x3748
Info : Target voltage: 2.847907
Info : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : accepting 'gdb' connection from 3333
Info : device id = 0x10016413
Info : flash size = 1024kbytes
Warn : acknowledgment received, but no packet pending
undefined debug reason 6 - target needs reset
Error: timed out while waiting for target halted
TARGET: stm32f4x.cpu - Not halted

in procedure 'reset'
target state: halted
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x08001388 msp: 0x200003c0
Error: Target not halted
Error: failed erasing sectors 5 to 6
Error: flash_erase returned -304
Error: Target not halted
Error: failed erasing sectors 5 to 6
Error: flash_erase returned -304
Am Ende geht das Flashen schief .... Welchen Programmer benutzt denn Du ?

Ich habe mal die ganze Platte nach .gdbinit durchsucht und umbenannt .... das Problem ist dadurch aber leider nicht gelöst ....

Hast Du noch ne Idee ?

Mfg
Thomas
 
#6
Das hier sieht problematisch aus und kann diese Art Probleme verursachen:
Code:
Info : Target voltage: 2.847907
Wie ist denn das Board mit Spannung versorgt? Evtl. Ist noch etwas angeschlossen, das sich parasitär beim Quanton bedient?
Bei Flash Operationen zieht die CPU viel Strom.
Wenn dann die Spannung einbricht passieren undefinierte Dinge.
Ich benutze selbst stlink und openocd ohne Probleme.
 
Zuletzt bearbeitet:

thomaskausm

Neuer Benutzer
#7
Es hängt momentan am USB Bus ....

Ich hänge mal einen Akku dran bzw. BEC ... aber es wird immer noch

Code:
thomas@papaskiste:~/git/Tau/tools/openocd/share/openocd$ /home/thomas/git/Tau/tools/openocd/bin/openocd -f scripts/board/stm32f4discovery.cfg
Open On-Chip Debugger 0.7.0-dev-00128-gcf1418e-dirty (2013-11-18-18:22)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.sourceforge.net/doc/doxygen/bugs.html
adapter speed: 1000 kHz
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Info : clock speed 1000 kHz
Info : STLINK v2 JTAG v17 API v2 SWIM v0 VID 0x0483 PID 0x3748
Info : Target voltage: 2.854016
Info : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpoints

gemeldet ..
 
#8
Ok, ich hab das hier grad mal nachgestellt und es sieht bei mir exakt so aus wie bei dir:
Code:
Open On-Chip Debugger 0.7.0-gc0b20f8 (2013-09-17-19:05)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.sourceforge.net/doc/doxygen/bugs.html
adapter speed: 1000 kHz
Info : This adapter doesn't support configurable speed
Info : STLINK v2 JTAG v15 API v2 SWIM v0 VID 0x0483 PID 0x3748
Info : Target voltage: 2.884520
Info : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpoints
Jetzt dazu gdb:
Code:
$ ./tools/gcc-arm-none-eabi-4_7-2013q1/bin/arm-none-eabi-gdb
(gdb) target remote localhost:3333
Remote debugging using localhost:3333
0x00000000 in ?? ()
(gdb) monitor reset halt
target state: halted
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x08003f8c msp: 0x20000400
(gdb) file ./build/fw_quanton/fw_quanton.elf 
A program is being debugged already.
Are you sure you want to change the file? (y or n) y
Reading symbols from /home/vke/development/quadrocopter/TauLabs/build/fw_quanton/fw_quanton.elf...done.
(gdb) load
Loading section .text, size 0x2cf60 lma 0x8020000
Loading section _exti, size 0x58 lma 0x804cf60
Loading section .initcallmodule.init, size 0xc0 lma 0x804cfb8
Loading section .data, size 0x678 lma 0x804d078
Start address 0x8020000, load size 186096
Transfer rate: 22 KB/sec, 12406 bytes/write.
und openocd
Code:
Info : accepting 'gdb' connection from 3333
Info : device id = 0x10016413
Info : flash size = 1024kbytes
Warn : acknowledgment received, but no packet pending
undefined debug reason 6 - target needs reset
target state: halted
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x08003f8c msp: 0x20000400
Info : Auto-detected RTOS: FreeRTOS
Ah, einen hab ich noch:
Wenn du quanton an einem USB Hub hast und ihn darüber mit Spannung versorgst, muss dieser eine eigene Spannungsversorgung haben.
 

thomaskausm

Neuer Benutzer
#9
Hallo Vinz,

der Hub über den das Board angeschlossen war ist auch mit Spannung bzw. Strom versorgt. Habe das Board auch mal über die Batterie versorgt und den ST-Link direkt an USB Port des Rechners angeschlossen aber immer das gleiche Ergebniss bekommen ... geht nicht ...

Was mir bei der Rumprobiererei aber aufgefallen ist, ist dass ich immer mal wieder Falschmeldung von OCD bezüglich der watchpoints bekomme.

Code:
Open On-Chip Debugger 0.7.0-dev-00128-gcf1418e-dirty (2013-11-18-18:22)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.sourceforge.net/doc/doxygen/bugs.html
adapter speed: 1000 kHz
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Info : clock speed 1000 kHz
Info : STLINK v2 JTAG v17 API v2 SWIM v0 VID 0x0483 PID 0x3748
Info : Target voltage: 2.851748
Info : stm32f4x.cpu: hardware has 6 breakpoints, 7 watchpoints
bzw.

Code:
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.sourceforge.net/doc/doxygen/bugs.html
adapter speed: 1000 kHz
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Info : clock speed 1000 kHz
Info : STLINK v2 JTAG v17 API v2 SWIM v0 VID 0x0483 PID 0x3748
Info : Target voltage: 2.853147
Info : stm32f4x.cpu: hardware has 6 breakpoints, 14 watchpoints

erwartet wird doch aber diese Meldung

Code:
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.sourceforge.net/doc/doxygen/bugs.html
adapter speed: 1000 kHz
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Info : clock speed 1000 kHz
Info : STLINK v2 JTAG v17 API v2 SWIM v0 VID 0x0483 PID 0x3748
Info : Target voltage: 2.851748
Info : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpoints
Hast Du das auch schon mal beobachtet ?
Nochmal zum Anschluss der SWD Schnittstelle des Quanton Boards zur SWD Schnittstelle des Discoveryboards.
Ich benutzte im Moment nur die beiden Signalleitungen und die Masseleitung; das sollte doch ausreichen oder ?

Ich habe auch gleich mal den Gegentest gemacht also auch VCC vom Quanton auf Pin 1 der ST-Link V2 verbunden aber auch das führt nicht zum Erfolg... ich kann mich mit OCD verbinden aber ein "monitor halt ..." führt zu

Code:
 Warn : acknowledgment received, but no packet pending
undefined debug reason 6 - target needs reset
Error: timed out while waiting for target halted
TARGET: stm32f4x.cpu - Not halted

in procedure 'reset'
Debugst Du auch über ein Discoveryboard oder über einen Porgramm Adapter also sowas wie
STMICROELECTRONICS - ST-LINK/V2 ?

Mfg
Thomas
 
#10
Hi Thomas,

ich benutze ein Discovery Board und verbinde alle 4 pins.
Wie startest du OpenOCD?
Code:
./tools/openocd/bin/openocd -f flight/Project/OpenOCD/stlink-v2-norst.cfg -f flight/Project/OpenOCD/stm32f4xx.stlink.cfg
Auch wäre noch mal sicher zu stellen, dass deine SWD Leitungen alle ok sind und auch nicht zu lang.

Grüße

Vinz
 
#11
Hallo Vinz,

das war der entscheidende Hinweis..... Die Startparameter habe/hatte ich vom "OpenOCD Deamon":

Code:
 /home/thomas/git/Tau/tools/openocd/bin/openocd -f Project/OpenOCD/stlink-v2.cfg -f Project/OpenOCD/stm32f4xx.stlink.cfg -c init
Damit ist das Board ansprechbar aber wohl nur zum Teil. Nachdem ich auf Deine Einstellungen gewechselt bin, hat bzw. funkioniert alles sauber und einwandfrei. Das Leitungslängenproblem hatte ich auch schon beobachet. Mit einer Leitungslänge von 20 cm (Flachband oder gedrillt) lief es nicht, 10 cm Flachband funktioniert.

Fürs Protokoll fasse ich (die Infos von Vinz) nochmal zusammen:

OCD Start Parameter:

Code:
./tools/openocd/bin/openocd -f flight/Project/OpenOCD/stlink-v2-norst.cfg -f flight/Project/OpenOCD/stm32f4xx.stlink.cfg

In der Debug Konfiguration beim Tab "Startup" alle Haken entfernen, dann bei "Initialization Commands" folgende Sequenz eintragen:
Code:

Code:
monitor reset halt
file build/fw_quanton/fw_quanton.elf
load
monitor reset halt

Anmerkung: Falls fw_quanton.elf nicht geladen bzw. gefunden werden kann, einfach den Absolutpfad angeben (z.B. "file /home/thomas/git/Tau/build/fw_quanton/fw_quanton.elf" ).


Mit diesen Einstellung hat das Debuggen dann auch sauber via Eclipse funktioniert.

Nochmal vielen Dank Vinz und noch ein schönens Restwochenende

Thomas
 
FPV1

Banggood

Oben Unten