Support for JTAGICE3 on avrdude

classic Classic list List threaded Threaded
17 messages Options
Reply | Threaded
Open this post in threaded view
|

Support for JTAGICE3 on avrdude

juergen.harms (Bugzilla)
After a firmware upgrade of my JTAGICE3 (1.25 -> 3.23) my JTAGIC3 had
become totally unusable: avrdude 6.0.1 failed top open the USB port (...
did not find any device "usb"). Some googling showed that this is a
known problem, and which has been fixed on avrdude-6.1.

But, building 6.1 on my Mandriva platform (for a plain install from the
tarball and, evidently also for building an rpm package) failed due to
compiler errors in the modules flip1.c and flip2.c - which use uint32_t
in declarations, but uint32_t is not defined.

Is this a known problem? Intuitively, I added a "typedef int uint32_t",
which made the problem go away (easier to implement than expicitely
changing all instances of the uint32_t declarations) - or is there an
include that should be added?. Result: the programmer works again as it
should.

Note: it appears that the upgrade also changed the USB ID from 03eb:2110
to 03eb:2140 - there is also the need to change the udev rules
correspondingly, possibly also in the rpm package in case that adds the
rule for the JTAGICE3

Question: I do not like to depend on intuition - is this a proper way to
fix the compilation problem in avrdude 6.1?

Juergen

_______________________________________________
AVR-chat mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avr-chat
Reply | Threaded
Open this post in threaded view
|

Re: Support for JTAGICE3 on avrdude

Roderick Mann

On May 31, 2014, at 02:06 , Juergen Harms <[hidden email]> wrote:

> Is this a known problem? Intuitively, I added a "typedef int uint32_t", which made the problem go away (easier to implement than expicitely changing all instances of the uint32_t declarations) - or is there an include that should be added?. Result: the programmer works again as it should.

Don't do that. At the very least, put a #include <stdint.h> at the top of the file.



_______________________________________________
AVR-chat mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avr-chat
Reply | Threaded
Open this post in threaded view
|

Re: Support for JTAGICE3 on avrdude

Martin Stejskal
In reply to this post by juergen.harms (Bugzilla)
Hi,
 Answer: no, but as You can see, it works :) Ideally you should not edit source code. Properly you should have header file inttypes.h (which is usually in /usr/include/ ) in your system and set GCC path to this header file (GCC should be preconfigured to see header files). I think You do not have develop libraries installed on your system, so this may cause this error.
 Anyway after compilation does not matter.

Martin


2014-05-31 11:06 GMT+02:00 Juergen Harms <[hidden email]>:
After a firmware upgrade of my JTAGICE3 (1.25 -> 3.23) my JTAGIC3 had become totally unusable: avrdude 6.0.1 failed top open the USB port (... did not find any device "usb"). Some googling showed that this is a known problem, and which has been fixed on avrdude-6.1.

But, building 6.1 on my Mandriva platform (for a plain install from the tarball and, evidently also for building an rpm package) failed due to compiler errors in the modules flip1.c and flip2.c - which use uint32_t in declarations, but uint32_t is not defined.

Is this a known problem? Intuitively, I added a "typedef int uint32_t", which made the problem go away (easier to implement than expicitely changing all instances of the uint32_t declarations) - or is there an include that should be added?. Result: the programmer works again as it should.

Note: it appears that the upgrade also changed the USB ID from 03eb:2110 to 03eb:2140 - there is also the need to change the udev rules correspondingly, possibly also in the rpm package in case that adds the rule for the JTAGICE3

Question: I do not like to depend on intuition - is this a proper way to fix the compilation problem in avrdude 6.1?

Juergen

_______________________________________________
AVR-chat mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avr-chat


_______________________________________________
AVR-chat mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avr-chat
Reply | Threaded
Open this post in threaded view
|

Re: Support for JTAGICE3 on avrdude

Michael Hennebry
In reply to this post by juergen.harms (Bugzilla)
On Sat, 31 May 2014, Juergen Harms wrote:

> Is this a known problem? Intuitively, I added a "typedef int uint32_t", which
> made the problem go away (easier to implement than expicitely changing all
> instances of the uint32_t declarations) - or is there an include that should
> be added?. Result: the programmer works again as it should.

typedef unsigned int uint32_t;

--
Michael   [hidden email]
"SCSI is NOT magic. There are *fundamental technical
reasons* why it is necessary to sacrifice a young
goat to your SCSI chain now and then."   --   John Woods

_______________________________________________
AVR-chat mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avr-chat
Reply | Threaded
Open this post in threaded view
|

Re: Support for JTAGICE3 on avrdude

Stuart Longland (VK4MSL)
On 01/06/14 00:57, Michael Hennebry wrote:

> On Sat, 31 May 2014, Juergen Harms wrote:
>
>> Is this a known problem? Intuitively, I added a "typedef int
>> uint32_t", which made the problem go away (easier to implement than
>> expicitely changing all instances of the uint32_t declarations) - or
>> is there an include that should be added?. Result: the programmer
>> works again as it should.
>
> typedef unsigned int uint32_t;
>

Isn't that typedef in stdint.h?

--
Stuart Longland (aka Redhatter, VK4MSL)

I haven't lost my mind...
  ...it's backed up on a tape somewhere.

_______________________________________________
AVR-chat mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avr-chat
Reply | Threaded
Open this post in threaded view
|

Re: Support for JTAGICE3 on avrdude

Martin Stejskal
Yes, it is part of stdint.h. Anyway, code should be written that user can not do any changes in it.
 Martin


2014-06-01 0:36 GMT+02:00 Stuart Longland (VK4MSL) <[hidden email]>:
On 01/06/14 00:57, Michael Hennebry wrote:
> On Sat, 31 May 2014, Juergen Harms wrote:
>
>> Is this a known problem? Intuitively, I added a "typedef int
>> uint32_t", which made the problem go away (easier to implement than
>> expicitely changing all instances of the uint32_t declarations) - or
>> is there an include that should be added?. Result: the programmer
>> works again as it should.
>
> typedef unsigned int uint32_t;
>

Isn't that typedef in stdint.h?

--
Stuart Longland (aka Redhatter, VK4MSL)

I haven't lost my mind...
  ...it's backed up on a tape somewhere.

_______________________________________________
AVR-chat mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avr-chat


_______________________________________________
AVR-chat mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avr-chat
Reply | Threaded
Open this post in threaded view
|

Re: Support for JTAGICE3 on avrdude

Joerg Wunsch
In reply to this post by juergen.harms (Bugzilla)
Juergen Harms <[hidden email]> wrote:

> But, building 6.1 on my Mandriva platform (for a plain install from the
> tarball and, evidently also for building an rpm package) failed due to
> compiler errors in the modules flip1.c and flip2.c - which use uint32_t
> in declarations, but uint32_t is not defined.

Make sure you've got the header files for all your libraries
available.  Linux distributions tend to install those separately
from the libs itself.  In particular, you surely want to have the
headers for libusb around (since the JTAGICE3 requires it).

The known issue is that the flip*.c files used to be uncompilable in
situations where no libusb was found (which is the case for you).

(This has been fixed in the source tree already, but that wouldn't
help you anyway, because you do want to make it detect your libusb.)
--
cheers, Joerg               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/
Never trust an operating system you don't have sources for. ;-)

_______________________________________________
AVR-chat mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avr-chat
Reply | Threaded
Open this post in threaded view
|

Re: Support for JTAGICE3 on avrdude

juergen.harms (Bugzilla)
On 06/02/2014 11:50 PM, Joerg Wunsch wrote:
> Make sure you've got the header files for all your libraries
> available

That is one advantage of needing to create rpm packages: the "spec file"
contains a list of requirements, which allows for automatic checking (of
what it is told to check) and requires the libusb header file package.

In consequence, asking for the resource libusb-devel (-devel is the
suffix for packages with header files), I get the
lib64usb1.0-devel-1.0.17-2.mga4 package - which appears to provide the
required header files (judging from the fact that avrdude-6.1 builds
correctly if I solve the uint32_t declaration by my work-around).

However, looking at the file config.log that is produced by configure, I
saw that configure compiles a procedure conftest, which fails on an
"#include <lusb0_usb.h>". Due to this failure and farther downstream, a
series of declarations (among which is HAVE_STDINT_H) are dropped.
Googling reveals that there recently was some renaming of the header
files, maybe that is relevant.

That is where I am presently stuck. I guess I will need to get help from
the Gurus in the Mageia developement team. I would like to fix this
problem in a proper way - avrdude6.1 should be the package provided by
the upcoming Mageia5 release.

Juergen

_______________________________________________
AVR-chat mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avr-chat
Reply | Threaded
Open this post in threaded view
|

Re: Support for JTAGICE3 on avrdude

Martin Stejskal
I've just download avrdude 6.1 and run configure ; make . In config.log there was some complains to lusb0_usb.h file, but everything compiled correctly (without need to define uint32_t). I think you missing another devel library: libgcc-devel or something like that (so that can be reason, why #if .... not work properly for you). I can not tell You what package, because I am using different distro. Just look at config.log and check if HAVE_STDINT_H and HAVE_INTTYPES_H are defined as 1.
 Just for case (maybe I am wrong, but i think there is problem), could you please create test.c file (for example in /tmp/ ) with following code:
#include <stdint.h>
#include <inttypes.h>
int main(void)
{
uint32_t i=-1;
i++;
return i;}

 Then type "gcc -Wall test.c". It should not produce ANY warning. If does, please post it here.





2014-06-03 9:38 GMT+02:00 Juergen Harms <[hidden email]>:
On 06/02/2014 11:50 PM, Joerg Wunsch wrote:
Make sure you've got the header files for all your libraries
available

That is one advantage of needing to create rpm packages: the "spec file" contains a list of requirements, which allows for automatic checking (of what it is told to check) and requires the libusb header file package.

In consequence, asking for the resource libusb-devel (-devel is the suffix for packages with header files), I get the lib64usb1.0-devel-1.0.17-2.mga4 package - which appears to provide the required header files (judging from the fact that avrdude-6.1 builds correctly if I solve the uint32_t declaration by my work-around).

However, looking at the file config.log that is produced by configure, I saw that configure compiles a procedure conftest, which fails on an "#include <lusb0_usb.h>". Due to this failure and farther downstream, a series of declarations (among which is HAVE_STDINT_H) are dropped. Googling reveals that there recently was some renaming of the header files, maybe that is relevant.

That is where I am presently stuck. I guess I will need to get help from the Gurus in the Mageia developement team. I would like to fix this problem in a proper way - avrdude6.1 should be the package provided by the upcoming Mageia5 release.

Juergen


_______________________________________________
AVR-chat mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avr-chat


_______________________________________________
AVR-chat mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avr-chat
Reply | Threaded
Open this post in threaded view
|

Re: Support for JTAGICE3 on avrdude

juergen.harms (Bugzilla)
On 06/03/2014 11:17 AM, Martin Stejskal wrote:
>  ... Then type gcc -Wall test.c

Done, no problem (and, as I said, I have already had a close look at
config.log - I do not have sufficient knowledge for going beyond guesses
on the conclusions to draw). Summing up:

We all agree: there is a build problem while ./configure is run:
certainly some header file missing.

I believe that the missing definition of uint32_t is due to the lacking
declaration of HAVE_STDINT_H (or HAVE_INTTYPES_H) and that, in turn,
this is due to the failure of one of the procedures run by ./configure,
probably failing since some usb header file is - correctly or
incorrectly - not found by the procedures called by ./configure.

I have a tendency to believe that Mageia provides all required usb
library files, but that there is a discrepancy between the names of
files provided by the Mageia platform and the names expected by the
configure procedure.

Juergen

_______________________________________________
AVR-chat mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avr-chat
Reply | Threaded
Open this post in threaded view
|

Re: Support for JTAGICE3 on avrdude

Joerg Wunsch
In reply to this post by juergen.harms (Bugzilla)
Juergen Harms <[hidden email]> wrote:

> In consequence, asking for the resource libusb-devel (-devel is the
> suffix for packages with header files), I get the
> lib64usb1.0-devel-1.0.17-2.mga4 package - which appears to provide the
> required header files

What's the value of HAVE_USB_H in ac_cfg.h?

If it's not 1, you've got an issue with the libusb 0.1 (compatibility)
header file.

> However, looking at the file config.log that is produced by configure, I
> saw that configure compiles a procedure conftest, which fails on an
> "#include <lusb0_usb.h>".

No, that's OK.  lusb0_usb.h is the libusb 0.1 API header file as found
in recent versions of LibUSB-Win32.  The Unix versions use <usb.h>,
and configure thus declares HAVE_USB_H.  The implementation files then
try using either of <usb.h>, or <lusb0_usb.h>.

Note that, while the configure stuff tries to detect the libusb 1.0
API as well, most of the AVRDUDE implementation still uses the 0.1
API.  That's why the 0.1 API header file must be present in order to
get USB support.
--
cheers, Joerg               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/
Never trust an operating system you don't have sources for. ;-)

_______________________________________________
AVR-chat mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avr-chat
Reply | Threaded
Open this post in threaded view
|

Re: Support for JTAGICE3 on avrdude

Bob Cochran
I follow this thread with interest. I downloaded avrdude-6.1 and tried
to compile it. ./configure kept failing with errors and references to
cross-compiling. After some what-is-wrong-here dialog (muttering) to
myself for a few days, I just now looked closely at the path that
config.log was reporting. It was pointing at the avr-gcc toolchain and
avr-gcc libraries that I had compiled. I removed these from PATH
temporarily, and configure magically started working. 'make' worked
without errors, too.

 Thanks

Bob Cochran
Greenbelt, Maryland, USA



On Tue, Jun 3, 2014 at 3:28 PM, Joerg Wunsch <[hidden email]> wrote:

>
> Juergen Harms <[hidden email]> wrote:
>
> > In consequence, asking for the resource libusb-devel (-devel is the
> > suffix for packages with header files), I get the
> > lib64usb1.0-devel-1.0.17-2.mga4 package - which appears to provide the
> > required header files
>
> What's the value of HAVE_USB_H in ac_cfg.h?
>
> If it's not 1, you've got an issue with the libusb 0.1 (compatibility)
> header file.
>
> > However, looking at the file config.log that is produced by configure, I
> > saw that configure compiles a procedure conftest, which fails on an
> > "#include <lusb0_usb.h>".
>
> No, that's OK.  lusb0_usb.h is the libusb 0.1 API header file as found
> in recent versions of LibUSB-Win32.  The Unix versions use <usb.h>,
> and configure thus declares HAVE_USB_H.  The implementation files then
> try using either of <usb.h>, or <lusb0_usb.h>.
>
> Note that, while the configure stuff tries to detect the libusb 1.0
> API as well, most of the AVRDUDE implementation still uses the 0.1
> API.  That's why the 0.1 API header file must be present in order to
> get USB support.
> --
> cheers, Joerg               .-.-.   --... ...--   -.. .  DL8DTL
>
> http://www.sax.de/~joerg/
> Never trust an operating system you don't have sources for. ;-)
>
> _______________________________________________
> AVR-chat mailing list
> [hidden email]
> https://lists.nongnu.org/mailman/listinfo/avr-chat

_______________________________________________
AVR-chat mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avr-chat
Reply | Threaded
Open this post in threaded view
|

Re: Support for JTAGICE3 on avrdude

juergen.harms (Bugzilla)
In reply to this post by Joerg Wunsch
Thanks for pointing me to ac_cfg.h!

ac_cfg.h contains
   #define HAVE_USB_H 1

I tried - in the un-tared directory - to see where HAVE_STDINT_H is
defined and used: it is only used, nowhere defined.

grep -r HAVE_STDINT_H *
ac_cfg.h.in:#undef HAVE_STDINT_H
configure:#ifdef HAVE_STDINT_H
flip1.c:#if HAVE_STDINT_H
flip2.c:#if HAVE_STDINT_H
pindefs.h:#ifdef HAVE_STDINT_H

and, after running ./configure in addition

config.log:| #ifdef HAVE_STDINT_H
config.log:| #ifdef HAVE_STDINT_H

This made me suspicious about the "configure" procedure simply
forgetting a check for stdint.h.

ChangeLog mentions bug #41402 on a missing stdint.h in dfu.c - could
this be a related problem?

Just for playing with "what-ifs": before running ./configure, I tried to
patch the "configure" procedure, appending to he list of header files to
be checked (line #5654) also stdint.h. That makes the problem go away,
HAVE_STDINT_H is now defined as 1, and the build now terminates
successfully. But: why is such a fix necessary on my platform and not
elsewhere?

I then checked
   - the other variables commented as "undef" in ac_cfg.h
   - against existing header files in my /usr/include
Here is list of header files that exist, but where HAVE_xxx is not defined:

inttypes.h, stdint.h, memory.h strings.h sys/stat.h sys_time.h
sys_types.h termios.h

Juergen

_______________________________________________
AVR-chat mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avr-chat
Reply | Threaded
Open this post in threaded view
|

Re: Support for JTAGICE3 on avrdude

juergen.harms (Bugzilla)
The attachment is a patch file that adapts the "configure" script file
of the avrdude-6.1 tarball to correctly detect the availablity of all
required header files (according to what I described in my last email -
06/04/2014 10:03 AM - sorry for the zig-zag in arriving there).

I have used this patch file for (a) installing the package from the
tarball and (b) building an rpm package for Mageia and testing these
packages. The problem of the missing definition of type uint32_t is
solved, and the thus installed avrdude works without flaw; it correctly
supports my JTAGICE3 (with the updated firmware as provided by
AtmelStudio 6.2).

The patch also makes the "configure" script recognize some other header
files which the unpatched script had considered as missing in spite of
the files being available in the system. Even if avrdude works without
an explicit include of these files, I consider it correct to use the
header files as they are provided by the system.

Jürgen

_______________________________________________
AVR-chat mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avr-chat

avrdude-6.1_includes.patch (586 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Support for JTAGICE3 on avrdude

Joerg Wunsch
Juergen Harms <[hidden email]> wrote:

> The attachment is a patch file that adapts the "configure" script file
> of the avrdude-6.1 tarball to correctly detect the availablity of all
> required header files (according to what I described in my last email -
> 06/04/2014 10:03 AM - sorry for the zig-zag in arriving there).

Please file this as a patch tracker under:

https://savannah.nongnu.org/patch/?group=avrdude

(including a short description about the original problem it fixes).

Thanks!
--
cheers, Joerg               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/
Never trust an operating system you don't have sources for. ;-)

_______________________________________________
AVR-chat mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avr-chat
Reply | Threaded
Open this post in threaded view
|

Re: Support for JTAGICE3 on avrdude

juergen.harms (Bugzilla)
Filed bug #42517 with the patch file as an attachment

Juergen

_______________________________________________
AVR-chat mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avr-chat
Reply | Threaded
Open this post in threaded view
|

Re: Support for JTAGICE3 on avrdude

Joerg Wunsch
Juergen Harms <[hidden email]> wrote:

> Filed bug #42517 with the patch file as an attachment

Danke sehr!
--
cheers, Joerg               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/
Never trust an operating system you don't have sources for. ;-)

_______________________________________________
AVR-chat mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/avr-chat