Hi again,
I think the error is caused by the way the programmer ID is compared
against "xplainedmini_updi". The attached patch seems to fix the issue.
However, I don't quite understand why a programmer would need a list of
IDs in the first place, so I'd appreciate it if some sceptical eyes
looked over my patch :)
Best regards,
Sven
On 1/30/19 7:28 PM, Sven Schwermer wrote:
> Hi,
>
> I have an Attiny817 Xplained Mini board which I want to use with
> AVRDUDE. I am using the trunk as I realize, I need commit 1417 for the
> Xplained Mini to work at all. I am using Arch Linux which is why I tried
> the avrdude-svn AUR (https://aur.archlinux.org/packages/avrdude-svn) but
> I got the following error message after building and running that:
>
> avrdude: jtag3_edbg_recv(): Inconsistent fragment number; expect 1, got 0
>
> When building straight from source, everything works great. I went ahead
> and verified that the makepkg tool which Arch uses to build these
> packages was in fact checking out the latest trunk. Next, I investigated
> the environment that the package was being built in. I saw the following
> interesting settings:
>
> LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now
> CPPFLAGS=-D_FORTIFY_SOURCE=2
> CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fno-plt
>
> When unsetting all those variables right before the configure call, the
> built binary works as expected with makepkg. When not unsetting any of
> the above variables, the binary emits the aforementioned error. I also
> verified that the problem arises when I build from source without
> makepkg like so:
>
> make distclean
> ./bootstrap
> CPPFLAGS='-D_FORTIFY_SOURCE=2' CFLAGS='-march=x86-64 -mtune=generic -O2
> -pipe -fno-plt'
> LDFLAGS='-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now' ./configure
> --sysconfdir=/etc
> make
> ./avrdude -p t817 -c xplainedmini_updi
>
> Does anyone know how those variables can alter the build process so that
> the software doesn't work properly? I'll try to play with the values of
> the variables a little bit and I'll try attach a debugger. I'm using GCC
> 8.2.1 and GNU libc 2.28.
>
> Best regards,
> Sven
>
>
> _______________________________________________
> avrdude-dev mailing list
> [email protected]
> https://lists.nongnu.org/mailman/listinfo/avrdude-dev
>
Index: jtag3.c
===================================================================
diff --git a/trunk/avrdude/jtag3.c b/trunk/avrdude/jtag3.c
--- a/trunk/avrdude/jtag3.c (revision 1429)
+++ b/trunk/avrdude/jtag3.c (working copy)
@@ -105,6 +105,7 @@
unsigned int addr, unsigned int n_bytes);
static unsigned char jtag3_memtype(PROGRAMMER * pgm, AVRPART * p, unsigned
long addr);
static unsigned int jtag3_memaddr(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
unsigned long addr);
+static int jtag3_is_xplainedmini_updi(PROGRAMMER * pgm);
void jtag3_setup(PROGRAMMER * pgm)
@@ -867,7 +868,7 @@
/* XplainedMini boards do not need this, and early revisions had a
* firmware bug where they complained about it. */
if (pgm->flag & PGM_FL_IS_EDBG) {
- if (strcmp(pgm->id, "xplainedmini_updi") != 0) {
+ if (!jtag3_is_xplainedmini_updi(pgm)) {
if (jtag3_edbg_prepare(pgm) < 0) {
return -1;
}
@@ -1581,7 +1582,7 @@
/* XplainedMini boards do not need this, and early revisions had a
* firmware bug where they complained about it. */
if (pgm->flag & PGM_FL_IS_EDBG) {
- if (strcmp(pgm->id, "xplainedmini_updi") != 0) {
+ if (!jtag3_is_xplainedmini_updi(pgm)) {
jtag3_edbg_signoff(pgm);
}
}
@@ -2497,3 +2498,14 @@
pgm->read_sib = jtag3_read_sib;
}
+static int jtag3_is_xplainedmini_updi(PROGRAMMER * pgm)
+{
+ LNODEID ln;
+ const char * id;
+ for (ln=lfirst(pgm->id); ln; ln=lnext(ln)) {
+ id = ldata(ln);
+ if (strcmp(id, "xplainedmini_updi") == 0)
+ return 1;
+ }
+ return 0;
+}
_______________________________________________
avrdude-dev mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/avrdude-dev