How the serial upload works?

I know that the development environment compiles and uploads the code to the arduino automatically but what is the process that it goes through to change whats on the flash memory inside the microcontroller. I would like to know so that I could upload code without relying on the dev environment. Is this in the documentation anywhere?

snowman,

Everything you need to know about programming the flash memory is here: Smart | Connected | Secure | Microchip Technology

-Mike

I would like to know so that I could upload code without relying on the dev environment.

When the reset is pulled the arduino runs some code called the boot loader. This looks on the serial line to see if any think is trying to communicate with it. If it is it then goes into a read from serial line / program into flash routine. If not it runs the program last loaded into flash. You can get detailed of how this actually happens by looking at the source code for the boot loader and the arduino development environment.