[Fwd: Avrdude 5.0 beta problems and patches]

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

[Fwd: Avrdude 5.0 beta problems and patches]

Bernard Fouché
Hi.

I just posted the eeprom patch for atmega64/128 about 20 days ago, and
nobody reacted at this time. I wrote to Brian today and he told me to
send this on the list again because he is very busy at the moment.

Here is the mail I sent to him, with the patches:

----
Hello Brian.

I just had a look a the CVS depot, and I do not see the patch (or a
correction for the corresponding bug) that makes stk500v2.c able to
write the atmega64/128 eeprom. I've posted the patch to the avrdev-list
but not on the savannah web site since it requires some explanations:
the patch requires that avrdude.conf must be also modified and have, for
eeprom fields, "read" replaced by "read_lo" and "write" replaced by
"write_lo" for the patch to work. Now, I dunno if this is a good choice,
or if other tokens must be taken into account by stk500v2.c. Note that
without this problem fixed, one can not write to an atmega64/128 eeprom!

I've also a patch to have device locking management on Linux. This patch
with be activated if 'HAS_LOCKDEV' is provided after configure(1). Now I
never used autoconf of such tools, so I don't know where to perform
modifications to have this constant set to 1 if the 'lockdev' package is
available on the computer. Also the configure script must set the
correct value for the path of the binary file "lockdev". One must use
that program to perform file locking operations, or have the process
needing file locking to be setuid root, which is of course a bad idea.

BTW if I download the version 5.0 beta from the CVS on a Linux FC3, what
program should I launch to have the 'configure' file built? I tried
'autoconf' with no luck...

At last there is a problem that, IMHO, stops the release of version 5.0:
one can note write/verify a bootloader with the current version: if the
hex file written to the target does not start at 0x0000, then the verify
routine fails.

I've not noticed other problems after a few days of use and many
reflashings on atmega64 and atmega128.

So here are the two incomplete patches...

Regards,

   Bernard

------------------------------------------------------------------------

*** stk500v2.c 2005-07-11 10:34:15.000000000 +0200
--- ../avrdude-5.0-BETA/stk500v2.c 2005-05-11 19:09:22.000000000 +0200
***************
*** 543,551 ****
        return -1;
      }
      avr_set_bits(m->op[AVR_OP_WRITE_LO], cmds);
!     //    commandbuf[6] = cmds[0];
!     commandbuf[5] = cmds[0];
!     commandbuf[6] = 0;
    }
 
    // the read command is common to both methods
--- 543,549 ----
        return -1;
      }
      avr_set_bits(m->op[AVR_OP_WRITE_LO], cmds);
!     commandbuf[6] = cmds[0];
    }
 
    // the read command is common to both methods
***************
*** 626,632 ****
 
    // the read command is common to both methods
    if (m->op[AVR_OP_READ_LO] == NULL) {
!     fprintf(stderr, "%s: stk500v2_paged_load: read instruction not defined for part \"%s\"\n",
              progname, p->desc);
      return -1;
    }
--- 624,630 ----
 
    // the read command is common to both methods
    if (m->op[AVR_OP_READ_LO] == NULL) {
!     fprintf(stderr, "%s: stk500v2_paged_write: read instruction not defined for part \"%s\"\n",
              progname, p->desc);
      return -1;
    }
***************
*** 651,657 ****
 
      result = stk500v2_command(pgm,buf,4,sizeof(buf));
      if (buf[1] != STATUS_CMD_OK) {
!       fprintf(stderr,"%s: stk500v2_paged_load: read command failed with %d\n",
                progname,buf[1]);
        return -1;
      }
--- 649,655 ----
 
      result = stk500v2_command(pgm,buf,4,sizeof(buf));
      if (buf[1] != STATUS_CMD_OK) {
!       fprintf(stderr,"%s: stk500v2_paged_write: read command failed with %d\n",
                progname,buf[1]);
        return -1;
      }

------------------------------------------------------------------------

*** ser_posix.c 2005-07-19 10:48:46.000000000 +0200
--- ../avrdude-5.0-BETA/ser_posix.c 2005-05-14 16:27:24.000000000 +0200
***************
*** 22,27 ****
--- 22,28 ----
  /*
   * Posix serial interface for avrdude.
   */
+
  #if !defined(WIN32NATIVE)
 
 
***************
*** 47,57 ****
    speed_t speed;
  };
 
- #ifdef HAS_LOCKDEV
- #define LOCKDEV_LOCATION "/usr/sbin/lockdev"
- char *serial_port_name;
- #endif
-
  /* There are a lot more baud rates we could handle, but what's the point? */
 
  static struct baud_mapping baud_lookup_table [] = {
--- 48,53 ----
***************
*** 130,185 ****
    return 0;
  }
 
- #ifdef HAS_LOCKDEV
- /*
-  * Build and return a pointer to a string like:
-  * /usr/sbin/lockdev -{query} {port}
-  *
-  * Query is 'l' (lock) or 'u' (unlock).
-  *
-  */
- int make_lock_dev_query(char * query, char * port)
- {
-   char *p;
-   int l;
-   int r;
-
-   l=strlen(LOCKDEV_LOCATION)+
-     2+ /* 1 char for space + 1 char for '-'*/
-     strlen(query)+
-     1+  /* 1 char for space */
-     strlen(port)+
-     1; /* Ending \0 */
-
-   p=malloc(l);
-   sprintf(p,"%s -%s %s",
-  LOCKDEV_LOCATION,
-  query,
-  port);
-
-   r=system(p);
-   free(p);
-
-   return r;
- }
- #endif
 
  int serial_open(char * port, int baud)
  {
    int rc;
    int fd;
 
- #ifdef HAS_LOCKDEV
-   /*
-    * Lock the device
-    */
-   serial_port_name=strdup(port); // To be able to unlock it by name later
-   if(make_lock_dev_query("l",serial_port_name)){
-     fprintf(stderr, "%s: serial_open(): device \"%s\" is already in use.\n",
-             progname, port);
-     exit(1);
-   }
- #endif
    /*
     * open the serial port
     */
--- 126,137 ----
***************
*** 209,224 ****
  {
    /* FIXME: Should really restore the terminal to original state here. */
 
- #ifdef HAS_LOCKDEV
-   /*
-    * Unlock device
-    */
-   if(make_lock_dev_query("u",serial_port_name)){
-     fprintf(stderr, "%s: serial_open(): can't unlock device \"%s\" ?!.\n",
-             progname, serial_port_name);
-   }
-   free(serial_port_name);
- #endif
    close(fd);
  }
 
--- 161,166 ----


----


_______________________________________________
avrdude-dev mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/avrdude-dev
Reply | Threaded
Open this post in threaded view
|

Re: [Fwd: Avrdude 5.0 beta problems and patches]

Joerg Wunsch
As Bernard Fouché wrote:

> I just posted the eeprom patch for atmega64/128 about 20 days ago,
> and nobody reacted at this time. I wrote to Brian today and he told
> me to send this on the list again because he is very busy at the
> moment.

I was just going to mark the bug/patch as highest priority, but
savannah.nongnu.org currently responds that it is undergoing an
upgrade. :(

I agree this should really be fixed before the release.

--
cheers, J"org               .-.-.   --... ...--   -.. .  DL8DTL

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


_______________________________________________
avrdude-dev mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/avrdude-dev