user79810: Why do I have to burn the code twice to actually burn it on to the Arduino board? I have to execute this command twice - only then is the chip getting programmed.
I'm using this command to burn the program into the Arduino Uno board using a Rasp Pi 3, via SSH from Windows 10.
avr-gcc -mmcu=atmega328 filename.c | avr-objcopy -O ihex -j .text -j .data a.out a.hex | avrdude -C avrdude.conf -v -p atmega328p -c arduino -P /dev/ttyACM* -b 115200 -D -U flash:w:a.hex:i


user7508: On a Unix shell, separating commands with the pipe character (|) means
“run these commands in parallel, feeding the standard output of each one
to the standard input of next one”.
In this context, it makes no sense to use pipes, as both avr-objcopy and
avrdude read their data from files, not from stdin. Furthermore, running
these in parallel means that avrdude will not have access to a.hex
when it starts.
The solution is to run the commands sequentially instead of in
parallel. Type and run one command at a time.
Alternatively, if you really want to have everything in a single line,
separate the commands with a semicolon (;, meaning “run the next
command when the previous one is done”) or, better yet, double ampersand
(&& = “run the next command only if the previous one exits
successfully”).

79810: <p>Why do I have to burn the code twice to actually burn it on to the Arduino board? I have to execute this command twice - only <em>then</em> is the chip getting programmed.</p>
<p>I'm using this command to burn the program into the Arduino Uno board using a Rasp Pi 3, via SSH from Windows 10.</p>
<pre><code>avr-gcc -mmcu=atmega328 filename.c | avr-objcopy -O ihex -j .text -j .data a.out a.hex | avrdude -C avrdude.conf -v -p atmega328p -c arduino -P /dev/ttyACM* -b 115200 -D -U flash:w:a.hex:i
</code></pre>
 7508: <p>On a Unix shell, separating commands with the pipe character (<code>|</code>) means
“run these commands in parallel, feeding the standard output of each one
to the standard input of next one”.</p>
<p>In this context, it makes no sense to use pipes, as both avr-objcopy and
avrdude read their data from files, not from stdin. Furthermore, running
these in parallel means that avrdude will <em>not</em> have access to a.hex
when it starts.</p>
<p>The solution is to run the commands <em>sequentially</em> instead of in
parallel. Type and run one command at a time.</p>
<p>Alternatively, if you really want to have everything in a single line,
separate the commands with a semicolon (<code>;</code>, meaning “run the next
command when the previous one is done”) or, better yet, double ampersand
(<code>&amp;&amp;</code> = “run the next command only if the previous one exits
successfully”).</p>
