So, I am trying to upload the bootloader using Atmel Studio6. According to the instructions, I upload the bootloader via the flash section. However, wouldn't I do the same if I want to upload my actual program? My question is that since they will be two different uploads, would;t they erase each other? Or does the bootloader and program have smarts to let let the programmer know which program sections to upload to? BTW...this is for a mega 2560.
Bootloader goes in one section of flash, with a fuse setting that says how big that section is. Sketch goes in a different section. If you want to go bootloaderless, the entire flash is available for the sketch.
So, in other words, it is defined in the boot loader which memory space to program?
It would kind of have to be, wouldn't it? After all the boot loader loads the program into flash.
Why are you trying to use a bootloader with Atmel Studio? If you are using Atmel Studio instead of Arduino IDE, then I would expect you to upload your program using ICSP, in which case you don't need a bootloader.
I see...so the boot loader is just the front end for how the original IDE does it's thing over USB? I used the AVR MKII to upload blank chips. What I found was that it did not work well unless I the boot loader (LEDs that were supposed to flash flashed really slow instead of their normal timing....Serial did not work....). Does uploading the boot loader also change registers?
Those symptoms indicate you did not set the fuses correctly.
Installing a bootloader within the IDE also set the fuses. If using Atmel Studio, you have to set the fuses as a seperate step from loading the bootloader or loading the flash.
CrossRoads: If using Atmel Studio, you have to set the fuses as a seperate step from loading the bootloader or loading the flash.
You'll find it under Tools->Device programming, if you have your AVRISP and device connected. Use http://www.engbedded.com/fusecalc to work out what fuse settings you need. Note that the missing bits of the Extended fuse always read back as 1.