Programming ATmega128 via USB/ATmega16U2

Good morning,

I am currently attempting to program an ATmega128 chip through a miniUSB port that gets converted from USB data lines to UART data lines through the generic ATmega16U2 chip. I have already burnt the bootloader on the ATmega128 and can program this chip through the ICSP interface. I have already installed the proper drivers for the ATmega16U2 and it was discovered correctly as the ATmega16U2. After that, I used the FLIP software to update the firmware on the ATmega16U2 chip and used hex files in the Arduino directory (I used the Arduino-usbserial-atmega16u2-Uno-Rev3.hex). Now the chip is recognized as an arduino Uno, which is obviously not the microcontroller that I am trying to program via the Arduino IDE.

Is this just a case of writing the correct hex file to the ATemga16U2 so that my computer recognizes the ATmega128? If so, is that hex files floating around the web somewhere, or must I write it myself? Please let me know if there are any useful sources/hex files that I can use for this application!

Thanks in advance.

Quick update: I have looked into the hex files to convert the USB to UART communication through the ATmega16U2 to either the Uno or the Mega. I made a python script that read these hex files in and would output the differences in the hex files. Here is what I got as a result:

Line number 11 : Not same
Uno File: :1000A0004123430001000102DC0109023E0002017C
Mega File: :1000A0004123420001000102DC0109023E0002017D

So line 11 is the only dissimilar line between the two hex files. Can anybody tell me the exact differences between those two lines and is there any way that I can adjust it to fit the ATMega128 accordingly?

Thank you.

Go to the source code. It's all open.

Thanks for the response. Following that link, am I supposed to edit the MakeFile to my parameters, such as the MCU_TARGET? I suppose I am confused on how to obtain the hex files for USB to UART communication between the ATmega16U2 to an ATmega128.

Thanks.