[bug #52687] avrdude eeprom uploader always uploads 0xff if line terminator is LF not CRLF

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

[bug #52687] avrdude eeprom uploader always uploads 0xff if line terminator is LF not CRLF

Joerg Wunsch-6
URL:
  <http://savannah.nongnu.org/bugs/?52687>

                 Summary: avrdude eeprom uploader always uploads 0xff if line
terminator is LF not CRLF
                 Project: AVR Downloader/UploaDEr
            Submitted by: None
            Submitted on: Mon 18 Dec 2017 10:22:42 AM UTC
                Category: None
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
         Originator Name: James Collier
        Originator Email: [hidden email]
             Open/Closed: Open
                 Release: 6.0.1
         Discussion Lock: Any
     Programmer hardware: USBTiny
             Device type: atmaga328p

    _______________________________________________________

Details:

It is useful to create eeprom .hex files from a program rather than from
avr-gcc, for instance in a production environment to set calibration constants
or a unique ID.

Uploading the resulting .hex file - in the correct form - using
>avrdude -p atmega328p -c -usbtiny -U eprom:w:myfile.hex
works fine: Writing and Reading  get the progress lines of # characters, then
the message
avrdude: verifying...
avrdude: 80 bytes of eeprom verified
etc.

BUT it loads every byte as 0xff if the .hex file has  \n line terminators. If
the hex file has \r\n terminators avrdude loads the correct data. There is no
difference in the messages from avrdude in either case.

I consider this a bug as (a) it's poor practice to make parsers unnessarily
strict, and (b) apparent success should not be reported when the operation
has, in fact, failed.






    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?52687>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/


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

[bug #52687] avrdude eeprom uploader always uploads 0xff if line terminator is LF not CRLF

Joerg Wunsch-6
Follow-up Comment #1, bug #52687 (project avrdude):

I'd have replied that Intel Hex files are by definition to be
terminated with CR-LF, but it seems Intel indeed never
specified this.

The behaviour you are mentioning does by no means to be
intended by the way the code is written.  Curious, are you
working on Windows?  The code uses fgets() to read the file
line by line, but on Windows, that probably requires CR-LF
line termination.  (On Unix-like systems, it just needs LF,
and any possible CR is later ignored.)  Replacing fgets()
is, unfortunately, quite cumbersome as it is very likely that
any manual reimplementation is going to be slower than the
library-provided fgets().

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?52687>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/


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

[bug #52687] avrdude eeprom uploader always uploads 0xff if line terminator is LF not CRLF

Joerg Wunsch-6
Follow-up Comment #2, bug #52687 (project avrdude):

Windows and line termination characters may or may not be the problem, but
removal of white space from the end of a line is not likely to have any
noticeable impact on performance.

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?52687>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/


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

[bug #52687] avrdude eeprom uploader always uploads 0xff if line terminator is LF not CRLF

Joerg Wunsch-6
Follow-up Comment #3, bug #52687 (project avrdude):

The question is not about removing whitespace but reimplementing
fgets() rather than using the system/library version.

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?52687>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/


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