avrdude exit code

Go To Last Post
12 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

How reliable is the exit code of AVRDude? I have never seen it return 0 if it fails but is it possible? I'm using a shell that calls AVRDude And need to know if that exit code would be a 100% indicator of pass or fail of the programming process.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The source is open, why not just look yourself?

http://svn.savannah.nongnu.org/v...

See the use of "exitrc" in that.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The reason I'm asking is because the shell program I'm using is for production programming at a manufacturing site out of the country. It presents a simple interface with one button and options are set through a configuration file. The button turns green if programming succeeds and red if it fails. Rather than parsing the text it occurred to me to just use the return value from AVRDude. Yesterday we got 3 devices that failed production testing and when I checked the flash I found that they were only partially programmed. In that case they should have failed verify and AVRDude should have returned a non zero exit code. I'd like to be able to state that the chance that AVRDude will not return a failure code in that situation is 0%. That would narrow the possibilities to my software mishandling the exit code or the people doing the programming ignoring the fault indication.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

As I say read the source. If it doesn't work the way you want change it and rebuild it. The joy of open source ;-)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Somehow, I doubt that avrdude would return the wrong status.

Just test it yourself. e.g. try 'wrong' MCU or 'wrong' HEX file to verify.

See the result in ERRORLEVEL for Windoze.

Likewise in $status for sh or csh.

AFIK, the Atmel tools are not so good for error reporting. But surely this is only within the spirit of Windoze programming.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

My program looks at the return value when AVRDude exits. I have done quite a bit of testing and in my experience it's been very reliable. I too doubt that it would return incorrectly. I'm just trying to get a broader sample since there are a huge number of people here who use AVRDude regularly. My question is if anyone has seen that happen. I believe the problem is that the people doing the programming are ignoring the fault indication

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

since there are a huge number of people here who use AVRDude regularly

But surely the majority are either programming from the command line or a Makefile where the return code is simply ignored?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

I believe the problem is that the people doing the programming are ignoring the fault indication

Then let the programming equipment collect some statistics. Present them openly for the operators, and save them in a reasonably tamper-safe format.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Make doesn't ignore return codes, it stops "making" with an error message if a command returns an error. But usually nothing comes after the avrdude command...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You can ignore the error code in a makefile however by prefixing the command with a minus sign:

-mkdir ExistingDirectory/

Which can come in handy for creating setup rules that should not fail the build if the environment is already set up correctly for example.

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

JohanEkdahl wrote:

Then let the programming equipment collect some statistics. Present them openly for the operators, and save them in a reasonably tamper-safe format.

That is actually what we came up with and I am adding logging to my app. Currently error messages are displayed but not logged.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

> I have never seen it return 0 if it fails but is it possible?

Sure, never say never, but I'd say for any failure, it will exit non-zero,
for sure. There are gotchas in the code where it exits prematurely from
within a library function (rather than returning a failure status to the
upper layers, and leave it to main() to finish the application), but I
couldn't think of a situation where a detected failure would not
change the exit code.

Sure, if you e.g. turn off the verification pass, you won't get
verification errors. ;-)

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.