Upload hex file using bootloader

Hi,

I have a leonardo board and I'm trying to upload a hex file when it boots using Serial1 (pins 0 and 1) not the usb serial. For this I run this command: avrdude -C avrdude.conf -p atmega32u4 -P /dev/ttyATH0 -c avr109 -
b 57600 -D -U flash:w:firmware.hex:i

And I get this error: .avrdude: butterfly_recv(): programmer is not responding
The serial ttyATH0 works fine because I tested it.

When I use the command above for the USB serial port (/dev/ttyACM0) all works fine and the hex file is uploaded.

The bootloader only checks the USB serial? How can I make it to check the other serial too?

Thanks

Post once, have a little patience please.

Could be the bootloader only looks at USB port. You may have to rewrite it to load via serial. Beyond my capability. Check the 32U4 datasheet, under Memory Programming, see if it's possible.

Ok, Leonardo has more than 1 serial port?
Maybe serial pins are not conected internally to usb serial port.

Edit: Looks like Leonardo built in usb com is not conected to serial. As crossroads says I think bootloader only looks on usb port.

So that now we got to the same conclusion, that it only checks USB serial, I would like to modify the Arduino bootloader so that it checks both serial ports. I think it's easier than to write it from scratch.

The problem is that I can't figure out which of the bootloaders is used by Leonardo. This is what I found in my folder ( /usr/share/arduino/hardware/arduino/bootloaders ): atmega atmega8 bt caterina caterina-Arduino_Robot caterina-LilyPadUSB lilypad optiboot stk500v2 .

I looked at some of them and I saw that caterina seems to use the USB serial. Anyone knows for sure which bootloader is used by Leonardo?

Thanks

Leonardo uses "caterina" as the bootloader.