If at any point you've managed to crash the ArduPilot code so badly that you've nuked the bootloader, don't worry: you can reload it. You'll need an AVR programmer
The best way to reload the bootloader is with the Arduino IDE, which is pretty straightforward. Just plug in your AVR programmer and select Burn Bootloader/ w/ AVRISP mk II. If you've already loaded AVR Studio, you may get an error in Arduino that says it can't find the USB. That's because of a driver conflict with the AVR Studio driver. Follow this
workaround to reload the correct driver.
It is also possible to load the bootloader with AVR Studio. Follow these