Forum: Compiler & IDEs AVaRICE version 2.13svn20160229 und ebdb - Absturz


von Gastino G. (gastino)


Lesenswert?

Hallo,

durch Zufall habe ich mitbekommen, dass avarice nun in seiner neuesten 
Version auch "ebdb" und damit Debugging mittels ATMEL ICE kann (sofern 
ich nichts falsch verstanden habe).

Also per

svn checkout svn://svn.code.sf.net/p/avarice/code/trunk avarice-code

heruntergeladen, auf meiner OpenSUSE Leap 42.1 kompiliert und 
installiert. So weit, so gut.

Leider weigert sich avarice beharrlich, schon den Versuch zu 
unternehmen, mit dem Debugger zu reden.

Folgendes

avarice --edbg --debugwire  -Patmega88 usb:4242

führt direkt zu einem Speicherzugriffssfehler.

Also per valgrind mal nachgesehen:
1
==24120== Memcheck, a memory error detector
2
==24120== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
3
==24120== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info
4
==24120== Command: avarice --edbg --debugwire -Patmega88 usb:4242
5
==24120== 
6
AVaRICE version 2.13svn20160229, Jul 17 2016 23:29:11
7
8
==24120== Invalid read of size 4
9
==24120==    at 0x61B1754: wcsstr (in /lib64/libc-2.19.so)
10
==24120==    by 0x40783D: openhid(char const*, unsigned int&) [clone .constprop.0] (jtag2usb.cc:646)
11
==24120==    by 0x407B83: jtag::openUSB(char const*) (jtag2usb.cc:1441)
12
==24120==    by 0x40B4AE: jtag::jtag(char const*, char*, emulator) (jtaggeneric.cc:82)
13
==24120==    by 0x4032A7: jtag3 (jtag3.h:206)
14
==24120==    by 0x4032A7: main (main.cc:602)
15
==24120==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
16
==24120== 
17
==24120== 
18
==24120== Process terminating with default action of signal 11 (SIGSEGV)
19
==24120==  Access not within mapped region at address 0x0
20
==24120==    at 0x61B1754: wcsstr (in /lib64/libc-2.19.so)
21
==24120==    by 0x40783D: openhid(char const*, unsigned int&) [clone .constprop.0] (jtag2usb.cc:646)
22
==24120==    by 0x407B83: jtag::openUSB(char const*) (jtag2usb.cc:1441)
23
==24120==    by 0x40B4AE: jtag::jtag(char const*, char*, emulator) (jtaggeneric.cc:82)
24
==24120==    by 0x4032A7: jtag3 (jtag3.h:206)
25
==24120==    by 0x4032A7: main (main.cc:602)
26
==24120==  If you believe this happened as a result of a stack
27
==24120==  overflow in your program's main thread (unlikely but
28
==24120==  possible), you can try to increase the size of the
29
==24120==  main thread stack using the --main-stacksize= flag.
30
==24120==  The main thread stack size used in this run was 8388608.
31
==24120== 
32
==24120== HEAP SUMMARY:
33
==24120==     in use at exit: 93,429 bytes in 46 blocks
34
==24120==   total heap usage: 1,137 allocs, 1,091 frees, 345,415 bytes allocated
35
==24120== 
36
==24120== LEAK SUMMARY:
37
==24120==    definitely lost: 0 bytes in 0 blocks
38
==24120==    indirectly lost: 0 bytes in 0 blocks
39
==24120==      possibly lost: 13,611 bytes in 36 blocks
40
==24120==    still reachable: 79,818 bytes in 10 blocks
41
==24120==         suppressed: 0 bytes in 0 blocks
42
==24120== Rerun with --leak-check=full to see details of leaked memory
43
==24120== 
44
==24120== For counts of detected and suppressed errors, rerun with: -v
45
==24120== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
46
Getötet

Ach ja, journalctl -f sagt nebenbei Folgendes:
1
Jul 17 23:42:41 Rechnername kernel: usb 2-1: new high-speed USB device number 13 using ehci-pci
2
Jul 17 23:42:41 Rechnername kernel: usb 2-1: New USB device found, idVendor=03eb, idProduct=2141
3
Jul 17 23:42:41 Rechnername kernel: usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
4
Jul 17 23:42:41 Rechnername kernel: usb 2-1: Product: Atmel-ICE CMSIS-DAP
5
Jul 17 23:42:41 Rechnername kernel: usb 2-1: Manufacturer: Atmel Corp.
6
Jul 17 23:42:41 Rechnername kernel: usb 2-1: SerialNumber: J41800036904
7
Jul 17 23:42:41 Rechnername kernel: hid-generic 0003:03EB:2141.000A: hiddev0,hidraw2: USB HID v1.11 Device [Atmel Corp. Atmel-ICE CMSIS-DAP] on usb-0000:00:13.2-1/input0
8
Jul 17 23:42:48 Rechnername kernel: avarice[24111]: segfault at 0 ip 00007fbd7c7e9754 sp 00007ffd6ec77478 error 4 in libc-2.19.so[7fbd7c74e000+19e000]

Angesichts der valgrind-Ausgaben würde ich orakeln, dass an 
hid_enumerate() irgendwas schiefgeht. Hat irgendwer Ideen?

Ahh, nach zwei Bier hatte ich doch noch eine: Den Aufruf von avarice als 
root. Nun geht es. Fast jedenfalls, nun bekomme ich nur noch eine 
timeout exception:
1
initJtagBox() failed: JTAG ICE timeout exception

Ich glaube, das Suchen der timeout-Definitionen wird noch etwas 
dauern... Für Erfahrungen, Tips oder Abhilfen wäre ich dankbar.

von Gastino G. (gastino)


Lesenswert?

Joho, ich bin einen winzigen Schritt weitergekommen. Die jtag.h hat mir 
die timeouts offenbart, die ich gleich um den Faktor 5 angepasst habe:
1
JTAG_RESPONSE_TIMEOUT        = 5000000,
2
JTAG_COMM_TIMEOUT             = 500000,
3
JTAG3_PIPE_TIMEOUT            = 500,

Nun weigert sich openhid():
1
openhid(): device not responding to DAP_Info

Das openhid() hat mich doch oben schon geärgert. Jetzt bin ich wirklich 
mit dem Latein am Ende. :o/

Edit: hid_read_timeout() liefert eine 0 zurück.

: Bearbeitet durch User
von neuer PIC Freund (Gast)


Lesenswert?

Im Leerlauf unter Arch-Linux o.k.
1
[me@pc ~]$ avarice --edbg --debugwire  -Patmega88 usb:4242
2
AVaRICE version 2.13svn20160229, Apr 25 2016 23:18:27
3
                                                                                                                                                                                         
4
JTAG config starting.                                                                                                                                                                                                                         
5
Found a device, serial number: J41800018611
6
initJtagBox() failed: No target power present

Liegt dann wohl an Ubuntu. Bei mir verlinkt mit:
1
[me@pc ~]$ ldd `which avarice`
2
        linux-vdso.so.1 (0x00007ffe9e7ae000)
3
        libhidapi-libusb.so.0 => /usr/lib/libhidapi-libusb.so.0 (0x00007fa3d1ee4000)
4
        libusb-0.1.so.4 => /usr/lib/libusb-0.1.so.4 (0x00007fa3d1cde000)
5
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007fa3d1957000)
6
        libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007fa3d1741000)
7
        libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007fa3d1524000)
8
        libc.so.6 => /usr/lib/libc.so.6 (0x00007fa3d1183000)
9
        librt.so.1 => /usr/lib/librt.so.1 (0x00007fa3d0f7b000)
10
        libusb-1.0.so.0 => /usr/lib/libusb-1.0.so.0 (0x00007fa3d0d62000)
11
        libm.so.6 => /usr/lib/libm.so.6 (0x00007fa3d0a5e000)
12
        /lib64/ld-linux-x86-64.so.2 (0x00007fa3d20ec000)
13
        libudev.so.1 => /usr/lib/libudev.so.1 (0x00007fa3d2299000)
14
        libcap.so.2 => /usr/lib/libcap.so.2 (0x00007fa3d085a000)
15
        libresolv.so.2 => /usr/lib/libresolv.so.2 (0x00007fa3d0643000)

von gauna (Gast)


Lesenswert?

Moin,

Ich bin derzeit am selben Thema dran. Atmel ICE, Opensuse Leap 42.1.

Avarice aus Sourcen gebaut.

Bei mir wurde die hid* Libs beim Bauen nicht erkannt, so dass es zu 
einem Verbindungsproblem kam. Hat sich allerdings anderst geäußert.

Ich kann dich nur ermutigen dran zu bleiben. Es geht definitiv irgendwie 
;-)

Außerdem brauchst du auch den aktuellsten (avr)gdb aus den Sourcen 
gebaut. Dann klappt es auch mit Eclipse. Was noch nicht geht ist das 
Disassembly. Aber breakpoints und resume sowie Speicherzugriff gehen

von Gastino G. (gastino)


Lesenswert?

Bei mir sieht es sehr ähnlich aus:
1
ldd `which avarice`
2
        linux-vdso.so.1 (0x00007ffc98d98000)
3
        libhidapi-libusb.so.0 => /usr/lib64/libhidapi-libusb.so.0 (0x00007f0a1d3a6000)
4
        libusb-0.1.so.4 => /usr/lib64/libusb-0.1.so.4 (0x00007f0a1d19f000)
5
        libz.so.1 => /lib64/libz.so.1 (0x00007f0a1cf89000)
6
        libdl.so.2 => /lib64/libdl.so.2 (0x00007f0a1cd85000)
7
        libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00007f0a1ca01000)
8
        libm.so.6 => /lib64/libm.so.6 (0x00007f0a1c6ff000)
9
        libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f0a1c4e8000)
10
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f0a1c2cb000)
11
        libc.so.6 => /lib64/libc.so.6 (0x00007f0a1bf22000)
12
        librt.so.1 => /lib64/librt.so.1 (0x00007f0a1bd1a000)
13
        libusb-1.0.so.0 => /usr/lib64/libusb-1.0.so.0 (0x00007f0a1bb02000)
14
        /lib64/ld-linux-x86-64.so.2 (0x0000563646ab8000)
15
        libudev.so.1 => /usr/lib64/libudev.so.1 (0x00007f0a1b8ef000)

Beim ./configure bekomme ich folgende Meldungen, deren Bedeutung ich 
aber leider nicht wirklich einordnen kann:
1
checking for library containing hid_init... -lhidapi-libusb
2
checking hidapi/hidapi.h usability... yes
3
checking hidapi/hidapi.h presence... no
4
configure: WARNING: hidapi/hidapi.h: accepted by the compiler, rejected by the preprocessor!
5
configure: WARNING: hidapi/hidapi.h: proceeding with the compiler's result
6
checking for hidapi/hidapi.h... yes
7
checking for ANSI C header files... no
8
checking arpa/inet.h usability... yes
9
checking arpa/inet.h presence... no
10
configure: WARNING: arpa/inet.h: accepted by the compiler, rejected by the preprocessor!
11
configure: WARNING: arpa/inet.h: proceeding with the compiler's result
12
checking for arpa/inet.h... yes
13
checking fcntl.h usability... yes
14
checking fcntl.h presence... no
15
configure: WARNING: fcntl.h: accepted by the compiler, rejected by the preprocessor!
16
configure: WARNING: fcntl.h: proceeding with the compiler's result
17
checking for fcntl.h... yes
18
checking netdb.h usability... yes
19
checking netdb.h presence... no
20
configure: WARNING: netdb.h: accepted by the compiler, rejected by the preprocessor!
21
configure: WARNING: netdb.h: proceeding with the compiler's result
22
checking for netdb.h... yes
23
checking netinet/in.h usability... yes
24
checking netinet/in.h presence... no
25
configure: WARNING: netinet/in.h: accepted by the compiler, rejected by the preprocessor!
26
configure: WARNING: netinet/in.h: proceeding with the compiler's result
27
checking for netinet/in.h... yes
28
checking stdlib.h usability... yes
29
checking stdlib.h presence... no
30
configure: WARNING: stdlib.h: accepted by the compiler, rejected by the preprocessor!
31
configure: WARNING: stdlib.h: proceeding with the compiler's result
32
checking for stdlib.h... yes
33
checking string.h usability... yes
34
checking string.h presence... no
35
configure: WARNING: string.h: accepted by the compiler, rejected by the preprocessor!
36
configure: WARNING: string.h: proceeding with the compiler's result
37
checking for string.h... yes
38
checking sys/socket.h usability... yes
39
checking sys/socket.h presence... no
40
configure: WARNING: sys/socket.h: accepted by the compiler, rejected by the preprocessor!
41
configure: WARNING: sys/socket.h: proceeding with the compiler's result
42
checking for sys/socket.h... yes
43
checking sys/time.h usability... yes
44
checking sys/time.h presence... no
45
configure: WARNING: sys/time.h: accepted by the compiler, rejected by the preprocessor!
46
configure: WARNING: sys/time.h: proceeding with the compiler's result
47
checking for sys/time.h... yes
48
checking termios.h usability... yes
49
checking termios.h presence... no
50
configure: WARNING: termios.h: accepted by the compiler, rejected by the preprocessor!
51
configure: WARNING: termios.h: proceeding with the compiler's result
52
checking for termios.h... yes
53
checking unistd.h usability... yes
54
checking unistd.h presence... no
55
configure: WARNING: unistd.h: accepted by the compiler, rejected by the preprocessor!
56
configure: WARNING: unistd.h: proceeding with the compiler's result
57
checking for unistd.h... yes
58
checking bfd.h usability... yes
59
checking bfd.h presence... no
60
configure: WARNING: bfd.h: accepted by the compiler, rejected by the preprocessor!
61
configure: WARNING: bfd.h: proceeding with the compiler's result

: Bearbeitet durch User
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.