Burn the bootloader using ATMEL STUDIO

Burning Bootloader procedure

To properly write the bootloader on your Arduino M0, you need to use a programmer, for example the Atmel-ICE, and the tool provided by ATMEL AtmelStudio.

Atmel ICE programmer 

Follow these steps:
- Plug in one side of the SWD connector to SAM port on Atmel ICE programmer and an other side to SWD header on Arduino M0.
- Connect both the devices to PC via USB cables, as shown in the below picture.
Do to coincide the connector red wire with the SWD Header white point on Arduino M0 .

Atmel ICE: SAM port 
Connect the board to the Atmel ICE 

- Open AtmelStudio tool, you can download it from here (here);

Atmel Studio 6 
- Go to Tools -> Device Programming or press the keys CTRL + SHIFT + P.

Select the Device Programming menu 
- Select Atmel-ICE in Tool.
- Select ATSAMD21G18A in Device.
- Select SWD in Interface.
- Press Apply.

Device Programming 
Interface settings of Device Programming menu 

- Go to Memories

Device Programming: Memories 
- Click Erase now and, if all has gone as it should, in the log console you will see OK.

Device Programming: Erase now 
- Go to Fuses.
- Ensure that the NVMCTRL_BOOTPROT is equal to 0x07, otherwise set this value by double clicking on the value.

Device Programming: Fuses 
- Press Program. In the log console, OK will be showed as output if everything has run smoothly.
- Go to Memories
- Select the file to write Bootloader_board_Vxxx.hex, this file is placed into ...\arduino-1.7.8\hardware\arduino\samd\bootloaders\zero folder.

Select the bootloader 

- Click Program, in the log console you will see OK.

Device Programming: burn the bootloader 
Bootloader burned 

- Now you have burned the bootloader. Try the board using upload a simple sketch for example the blink using the Arduino IDE, you can download it here.