avrdude-dev
[Top][All Lists]
Advanced

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

[patch #9573] patch to add atmelice avr32 programming support to avrdude


From: Joerg Wunsch
Subject: [patch #9573] patch to add atmelice avr32 programming support to avrdude
Date: Sun, 20 Sep 2020 16:43:22 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:69.0) Gecko/20100101 Firefox/69.0

Update of patch #9573 (project avrdude):

                  Status:                    None => Postponed              
             Assigned to:                    None => joerg_wunsch           

    _______________________________________________________

Follow-up Comment #2:

Thanks for submitting the patch!

First thing that springs to mind after applying it:


gmake[2]: Entering directory '/home/joerg/src/avrdude'
  CC       libavrdude_a-jtag3.o
jtag3.c:1031:12: warning: 'jtag3_edbg_recv_frame' defined but not used
[-Wunused-function]
 static int jtag3_edbg_recv_frame(PROGRAMMER * pgm, unsigned char **msg) {
            ^~~~~~~~~~~~~~~~~~~~~


So why is this function no longer going to be used?

After some closer inspection, I have a number of stylistic issues with the
patch before I'd like to apply it.


 programmer
+  id    = "atmelice_avr32";
+  desc  = "Atmel-ICE (ARM/AVR) in ISP mode";


Really in ISP mode?


+        if (data[0]==SCOPE_AVR32)
+        {
+            char *str=0;
...
+              case AVR32_FAILURE_RECEIVE_LENGTH: str="Incorrect packet
length"; break;
...
+  if (len > (((USBDEV_MAX_XFER_3-4)*16)-4))


I would appreciate if the patch keeps the existing style rule of having white
space around operators (=, == etc.).


-         avrdude_message(MSG_INFO, "\\%03o", data[i]);
+          //avrdude_message(MSG_INFO, "\\%03o", data[i]);
+          avrdude_message(MSG_INFO, "\\%02x", data[i]);
...
+#if 0
   /* 4 bytes overhead for CMD, fragment #, and length info */
   int max_xfer = pgm->fd.usb.max_xfer;
   int nfragments = (len + max_xfer - 1) / max_xfer;
@@ -507,6 +647,7 @@
         }
       data += this_len;
       len -= this_len;
+#endif
     }


Source code comments and conditional compilation is not the way to keep track
of history. This is what SVN (or whatever VCS is used) is for.

Also, as you can see in the first snippet, make sure to not artificially alter
the indentation style. Unfortunately, AVRDUDE's code base was never very
consistent on whether to use TAB or spaces, but if you change a single
existing line, do not convert a TAB to spaces or vice versa.


+  //if ((buf = malloc(USBDEV_MAX_XFER_3)) == NULL) {
+  //  avrdude_message(MSG_INFO, "%s: jtag3_edbg_recv(): out of memory\n",
+       //    progname);
+  //  return -1;
+  //}


See above. If some piece of code isn't needed anymore, remove it, rather than
commenting it out.


     if ((c == RSP3_FAILED) && ((*resp)[3] == RSP3_FAIL_OCD_LOCKED)) {
       avrdude_message(MSG_INFO,
-                     "%s: Device is locked! Chip erase required to
unlock.\n",
-                     progname);
+          "%s: Device is locked! Chip erase required to unlock.\n",
+          progname);
     } else {
       avrdude_message(MSG_INFO, "%s: bad response to %s command: 0x%02x\n",
-                     progname, descr, c);
+          progname, descr, c);


Again, random indentation changes, please avoid this. Tell you editor to not
touch anything else but what you're actually editing.

 
-  free(resp);
+  if (resp) free(resp);


Unneeded. The C standard guarantees free(0) does nothing.

The entire patch looks quite intrusive to the existing jtag3.c file. Thus, it
imposes quite a bit of risk of breaking things that are unrelated to the AVR32
addition (see the first warning about a now unused function).

For that reason, I'd like to defer inclusion of the patch until after the next
AVRDUDE release. Sorry, I don't have the time and energy of maintaining a
separate -stable branch.

However, even though I'm setting it to "postponed" now, please feel encouraged
to re-submit the patch with the above things fixed.

    _______________________________________________________

Reply to this item at:

  <https://savannah.nongnu.org/patch/?9573>

_______________________________________________
  Message sent via Savannah
  https://savannah.nongnu.org/




reply via email to

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