Debugging with ATMEL STUDIO 6

In this example we will be using Arduino IDE Release v1.7.6 ( and Atmel Studio 6 (

Creating the file needed for debugging

Launch the IDE, open the blink.ino sketch and then select the Arduino M0 Pro (Programming Port) from the boards menu :

 Arduino IDE: board menu (M0 Pro Programming Port)

Arduino  IDE: Port menu

Comment out rows 26 and 28, to remove the delay call and save the sketch with a new name (i.e. save it as blink1.ino) :

Blink sketch

Click the arrow button so to compile the sketch and programming the Arduino M0 Pro. Once done, at this point copy into your clipboard the Blink1.cpp.bin path reported in the output shell (e.g. : C:\Users\...........\AppData\Local\Temp\build6278736204043834605.tmp) :

Arduino IDE: Output shell   
Use Atmel Studio 6 for debug

Now launch Atmel Studio 6 and from its main menu browse to : File -> Open -> Open Object File For Debugging

Atmel Studio 6

select the file Blink1.cpp.elf in Object file To Debug, then click 'next' :

Atmel Studio 6: Object file for Debugging

Choose SAMD21G18A, as shown in the next picture, and press 'finish' :

Device Selection on Atmel Studio 6

At this point, the "Remap Object Files To Disk Files" window will pop-up :

Remap Object Files to Disk Files

Select the three-point box in the same row of the Blink1.ino file :

Blink1.ino file

and open the Blink1.ino file itself, then click on finish. Open now the Blink1.ino entry in the Solution Explorerworkspace of the main window of Atmel Studio :

 Solution Explorer workspace of Atmel Studio

Click on the left side (the grayed out part) of the source code window to put a breakpoint (for example at row 25) in it :

Blink sketch

Press the play symbol in the top bar to start debugging :

Start Debugging

A window will pop-up asking you to choose the edbg debugger/programmer, press continue and then select the proper EDBG and SWD entries as shown in the image below :

Select debugger and Interface

Press once again the play button and if required, update the edbg firmware entry and click play another time. Debugging will start and the code will stop at the breakpoint. You can go ahead in debugging by pressing F11 or F10. The software executes the next function or instruction, according to pressed key. Please pay attention at the code is executed on the board itself, this is why we commented out the two delay calls so to speed up the debugging example.