avrdude-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avrdude-dev] cvs back again and butterfly cleanup


From: Michael Mayer
Subject: [avrdude-dev] cvs back again and butterfly cleanup
Date: Thu, 11 Dec 2003 12:36:18 +0100
User-agent: Mutt/1.5.4i

The cvs is back again (see http://savannah.gnu.org/statement.html)

Today I checked out the new sources: compiles fine and works flawlessly with
my butterfly.

Last week the removal of no_show_func_info() from avr910.c was discussed. I
did this today for butterfly.c, here is my patch. The baudrate-patch from
Jan-Hinnerk is included, too. Different speed settings aren't supported by
the butterfly, but it can be useful if someone uses a slightly modified
version of the atmel bootloader. But even for 19200 baud the blockmode is
quite fast: 10.2 sec for a full 16kB read or write.

For the butterfly device, it is redundand to give a device type at the
command line as this device uses always a m169 - it is specified as a small
evaluation board for this processor type. So I would like to introduce a
default device type info. If no device type is set, it gets initialized to
"m169". If, for some reason, the user should feel the need to use a
different device type this default could be easily overridden using the -p
switch. I suggest to add a new member to struct programmer_t called
"default_part". It will be initialized to NULL giving the actual behavior
for avr910 and stk500, but can be changed to "m169" in butterfly_initpgm.

Any comments?

  Michael




diff -r -u avrdude-cvs20031202/ChangeLog avrdude/ChangeLog
--- avrdude-cvs20031202/ChangeLog       2003-12-02 19:25:15.000000000 +0100
+++ avrdude/ChangeLog   2003-12-11 12:08:39.000000000 +0100
@@ -1,3 +1,9 @@
+2003-12-10  Michael Mayer  <address@hidden>
+
+       * butterfly.c: Removed all references to no_show_func_info()
+       * butterfly.c: enable the use of baurates != 19200 (but the current
+       version of the butterfly doesn't support this)
+
 2003-12-01  Eric B. Weddington  <address@hidden>
 
        * doc/avrdude.texi: Update devices and programmers supported.
diff -r -u avrdude-cvs20031202/butterfly.c avrdude/butterfly.c
--- avrdude-cvs20031202/butterfly.c     2003-11-30 16:16:48.000000000 +0100
+++ avrdude/butterfly.c 2003-12-11 11:23:11.000000000 +0100
@@ -46,36 +46,20 @@
 static char has_auto_incr_addr;
 static unsigned buffersize = 0;
 
-/* These two defines are only for debugging. Will remove them once it starts
-   working. */
-
-#define show_func_info() \
-  fprintf(stderr, "%s: line %d: called %s()\n", \
-          __FILE__, __LINE__, __FUNCTION__)
-
-#define no_show_func_info()
-
-
 static int butterfly_send(PROGRAMMER * pgm, char * buf, size_t len)
 {
-  no_show_func_info();
-
   return serial_send(pgm->fd, buf, len);
 }
 
 
 static int butterfly_recv(PROGRAMMER * pgm, char * buf, size_t len)
 {
-  no_show_func_info();
-
   return serial_recv(pgm->fd, buf, len);
 }
 
 
 static int butterfly_drain(PROGRAMMER * pgm, int display)
 {
-  no_show_func_info();
-
   return serial_drain(pgm->fd, display);
 }
 
@@ -95,8 +79,6 @@
 
 static int butterfly_rdy_led(PROGRAMMER * pgm, int value)
 {
-  no_show_func_info();
-
   /* Do nothing. */
 
   return 0;
@@ -105,8 +87,6 @@
 
 static int butterfly_err_led(PROGRAMMER * pgm, int value)
 {
-  no_show_func_info();
-
   /* Do nothing. */
 
   return 0;
@@ -115,8 +95,6 @@
 
 static int butterfly_pgm_led(PROGRAMMER * pgm, int value)
 {
-  no_show_func_info();
-
   /* Do nothing. */
 
   return 0;
@@ -125,8 +103,6 @@
 
 static int butterfly_vfy_led(PROGRAMMER * pgm, int value)
 {
-  no_show_func_info();
-
   /* Do nothing. */
 
   return 0;
@@ -138,8 +114,6 @@
  */
 static int butterfly_chip_erase(PROGRAMMER * pgm, AVRPART * p)
 {
-  no_show_func_info();
-
   butterfly_send(pgm, "e", 1);
   butterfly_vfy_cmd_sent(pgm, "chip erase");
 
@@ -166,8 +140,6 @@
  */
 static int butterfly_program_enable(PROGRAMMER * pgm, AVRPART * p)
 {
-  no_show_func_info();
-
   return -1;
 }
 
@@ -177,8 +149,6 @@
  */
 static void butterfly_powerup(PROGRAMMER * pgm)
 {
-  no_show_func_info();
-
   /* Do nothing. */
 
   return;
@@ -190,8 +160,6 @@
  */
 static void butterfly_powerdown(PROGRAMMER * pgm)
 {
-  no_show_func_info();
-
   /* Do nothing. */
 
   return;
@@ -211,8 +179,6 @@
   unsigned char c;
   int dev_supported = 0;
 
-  no_show_func_info();
-
   /* send some ESC to activate butterfly bootloader */
   butterfly_send(pgm, "\033\033\033\033", 4);
   butterfly_drain(pgm, 0);
@@ -248,12 +214,16 @@
     fprintf(stderr, "Hardware Version = %c.%c\n", hw[0], hw[1]);
   };
 
-  /* See if programmer supports autoincrement of address. */
+  /* Check support for autoincrement of address, abort if not available. */
 
   butterfly_send(pgm, "a", 1);
   butterfly_recv(pgm, &has_auto_incr_addr, 1);
-  if (has_auto_incr_addr == 'Y')
-      fprintf(stderr, "Programmer supports auto addr increment.\n");
+  if (has_auto_incr_addr != 'Y')
+    fprintf(stderr,
+            "%s: error: auto addr increment not supported. Maybe it isn't\n"\
+            "a butterfly but a AVR910 device?\n", progname);
+    exit(1);
+  };
 
   /* Check support for buffered memory access, abort if not available */
 
@@ -313,8 +283,6 @@
 
 static int butterfly_save(PROGRAMMER * pgm)
 {
-  no_show_func_info();
-
   /* Do nothing. */
 
   return 0;
@@ -323,8 +291,6 @@
 
 static void butterfly_restore(PROGRAMMER * pgm)
 {
-  no_show_func_info();
-
   /* Do nothing. */
 
   return;
@@ -333,8 +299,6 @@
 
 static void butterfly_disable(PROGRAMMER * pgm)
 {
-  no_show_func_info();
-
   /* Do nothing. */
 
   return;
@@ -343,8 +307,6 @@
 
 static void butterfly_enable(PROGRAMMER * pgm)
 {
-  no_show_func_info();
-
   /* Do nothing. */
 
   return;
@@ -353,10 +315,12 @@
 
 static void butterfly_open(PROGRAMMER * pgm, char * port)
 {
-  no_show_func_info();
+  if(pgm->baudrate == 0) {
+    pgm->baudrate = 19200;
+  }
 
   strcpy(pgm->port, port);
-  pgm->fd = serial_open(port, 19200);
+  pgm->fd = serial_open(port, pgm->baudrate);
 
   /*
    * drain any extraneous input
@@ -367,8 +331,6 @@
 
 static void butterfly_close(PROGRAMMER * pgm)
 {
-  no_show_func_info();
-
   butterfly_leave_prog_mode(pgm);
 
   serial_close(pgm->fd);
@@ -378,8 +340,6 @@
 
 static void butterfly_display(PROGRAMMER * pgm, char * p)
 {
-  no_show_func_info();
-
   return;
 }
 
@@ -404,8 +364,6 @@
   unsigned char cmd[6];
   int size;
 
-  no_show_func_info();
-
   if ((strcmp(m->desc, "flash") != 0) && (strcmp(m->desc, "eeprom") != 0))
     return -1;
 
@@ -480,8 +438,6 @@
 static int butterfly_read_byte(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m,
                             unsigned long addr, unsigned char * value)
 {
-  no_show_func_info();
-
   if (strcmp(m->desc, "flash") == 0) {
     return butterfly_read_byte_flash(pgm, p, m, addr, value);
   }
@@ -586,8 +542,6 @@
 /* Signature byte reads are always 3 bytes. */
 static int butterfly_read_sig_bytes(PROGRAMMER * pgm, AVRPART * p, AVRMEM * m)
 {
-  no_show_func_info();
-
   if (m->size < 3) {
     fprintf(stderr, "%s: memsize too small for sig byte read", progname);
     return -1;
@@ -602,8 +556,6 @@
 
 void butterfly_initpgm(PROGRAMMER * pgm)
 {
-  no_show_func_info();
-
   strcpy(pgm->type, "avr910");
 
   /*




reply via email to

[Prev in Thread] Current Thread [Next in Thread]