I am confused about the COM port number. In the ArduinoIDE, with the Arduboy attached I see “COM8 (Arduino Leonardo)”. But when I look at the avrdude command line the IDE uses it says -PCOM9. Also avrdude reports “Using Port: COM9”. What am I missing?
The Arduboy presents two different USB IDs. One when the sketch is running and another when in the bootloader. Windows assigns separate COM ports for each of these.
To add to what @MLXXXp said…
Usually the lower number is the one used while the AVR chip is running its loaded program,
and the higher number is used by the bootloader.
The upload process actually involves performing a kind of handshake on one port and then transferring control to the one used by the bootloader so the bootloader can handle the actual upload.