From my understanding, in order to burn a C program to the ATMega32's flash memory, the program is first compiled and converted into a hex file which is then uploaded using a computer program such as avrdude using a USB connection to an AVR programmer let's say a USBasp. The AVR programmer then sends the data using SPI to the ATMega32 to be programmed.
Now this is my very superficial understanding of how this whole operation works, however I'm very confused on one part. That is, how does the microcontroller know that the incoming data from the USBasp is the program and not some sort of binary data to be stored in the data memory. Also what is the need for an ATTiny8 microcontroller in the USBasp, what exactly does it do?
I have been meaning to make my very own ATMega32 programmer from scratch, and I really want to comprehend what actually happens behind the scenes.
avrdude using a USB connection... no .... avrdude knows nothing about USB ... avrdude uses a serial port connection ... the serial port is provided by the OS ... the underlying hardware is invisible to avrdude... the serial port could be a real hardware serial port or a virtual serial port that connects over USB, or even over internet \$\endgroup\$