Thanks for your kind replies, ShapeShifter and JosAH.
I am trying to use the first way (Using USB) to update the firmware. I got a problem.
I found where the HEX code is located and the avrdude command to program the flash. Please see the message in the code section below.
However, before the avrdude command, there is an extra step "Forcing reset using 1200bps open/close on port COM11". I know that my board connects to PC at COM11 (when my software runs, I open port 11 and I can see the message in the terminal window). However, it seems that COM12 is used when avrdude programs the flash.
If I use the same avrdude command (with COM12), it doesn't work (error message: avrdude: ser_open(): can't open device COM12).
Do you know how to get around this issue?
Another question:
Instead of installing the whole/big package of Arduino IDE to program flash with avrdude, I would like just copy avrdude.exe and avrdude.conf, my firmware and a batch file (the avrdude command) into a package. Then I send this package to my customer and he just runs the batch file. Will it work?
Thank you very much,
Nick
... ...
Sketch uses 15,534 bytes (54%) of program storage space. Maximum is 28,672 bytes.
Global variables use 547 bytes (21%) of dynamic memory, leaving 2,013 bytes for local variables. Maximum is 2,560 bytes.
Forcing reset using 1200bps open/close on port COM11
PORTS {COM11, } / {COM11, } => {}
PORTS {COM11, } / {COM11, } => {}
PORTS {COM11, } / {COM11, } => {}
PORTS {COM11, } / {COM11, } => {}
PORTS {COM11, } / {COM11, } => {}
PORTS {COM11, } / {COM11, } => {}
PORTS {COM11, } / {COM11, } => {}
PORTS {COM11, } / {COM11, } => {}
PORTS {COM11, } / {COM11, } => {}
PORTS {COM11, } / {} => {}
PORTS {} / {COM12, } => {COM12, }
Found upload port: COM12
C:\Program Files (x86)\Arduino/hardware/tools/avr/bin/avrdude -CC:\Program Files (x86)\Arduino/hardware/tools/avr/etc/avrdude.conf -v -patmega32u4 -cavr109 -PCOM12 -b57600 -D -Uflash:w:C:\Users\Nick\AppData\Local\Temp\build1794757003189142693.tmp/FanControl.cpp.hex:i
... ...