Unlike using the Arduino approach (referenced in the Overview page), CircuitPython's toolchain is not integrated with AS7. This means that we can't just open up the raw code in Atmel Studio, set breakpoints, then have Atmel Studio compile and program the target board with CircuitPython firmware. We're in luck though.
Atmel Studio has the ability to open "object files" as a project and program/debug a device with it. These are also known as ELF (Executable and Linkable Format) Files, "a common standard file format for executable files, object code, shared libraries, and core dumps" (Wikipedia).
With your firmware built, open AS7 and in the File menu, select Open -> Open Object File For Debugging.
The following dialog window will open:
Fill in the dialog window:
- Select The Object File To Debug: type the path, or use the file selector, to "firmware.elf" in your build folder ("circuitpython/ports/atmel-samd/build_board_name/")
- Project Name: type a project name
- Location: location to store the project files (does not move/copy your firmware files)
- Maintain Folder heirarchy for source files & Add File As Link: leave these checked (or don't; your choice)
Here is how one of mine looks:
Select the Target MCU you are using. The list can be filtered by clicking the Device Family dropdown.
- For M0 boards, select "SAMD21" in Device Family. Then select the appropriate chip name (ATSAMD21G18 is most common; ATSAMD21E18 for Trinket/Gemma).
- For M4 boards, select "SAMD51" in Device Family. Then select the appropriate chip name (ATSAMD51J19 for Metro M4; other boards unreleased at this time).
- For boards released after this guide, the product page for the board should have the full name of the microcontroller it uses listed. Use that chip name in selecting the Device Family.