Building CircuitPython Firmware

First, you must be able to build the firmware on your local machine. If you have not already done this, the Building CircuitPython Learn Guide will get you up and running.

For any meaningful debugging results, you'll need to include DEBUG=1 in your make command. For example: make clean BOARD=itsybitsy_m0_express; make BOARD=itsybitsy_m0_express DEBUG=1

Non-Express boards may complain that the resulting compilation will not fit on the board; there are a couple workarounds, so contact one of the CircuitPython helpers on Discord or in the Adafruit CircuitPython forum.

Note: "make clean BOARD=" is a good habit to get into. It ensures that the cross-compiler builds everything from scratch. However, it does add time to the compilation.

Segger J-Link

You'll need a debugging adapater to allow the computer to communicate with the target board. I, and by extension this guide, use a Segger J-Link debugger and their J-Link software and drivers. I'm sure you could use almost any SWD compliant debugger, but that will not be covered in this guide.

The Segger J-Link Pro, Basic, EDU, and EDUmini are all compatible (choose your version according to Segger's license terms & budget). Additionally, you'll need to be able to connect your SAMD board to the J-Link. This is easiest using one (or both) of the following Adafruit breakouts and a 2x5 ribbon cable:

Refer to your target board's pinout to locate the SWDIO & SWCLK pins.

Atmel Studio 7

Lastly, you'll need Atmel Studio 7 ("AS7"). As luck would have it, Microchip provides it for FREE (at time of writing). Download is available from Microchip's website.

Understand this before moving forward: Atmel Studio can be buggy. You may experience "Not Responding" occurrences and crashes. Nothing new for us Windows users, right? Having said that, I haven't had any experiences of lost or corrupted data. While rarely needed, each board I have debugged has always been recoverable by re-programming when things got screwy. We'll cover that in the guide, as well.

Which brings me to one more thing I will suggest you have before starting: a local copy of the bootloader binary (*.bin) for the board you are debugging. They can be found in the uf2-samd GitHub release page.

If you've made it this far, you're ready for the joys of debugging! So, lets open Atmel Studio and get ready to debug.

This guide was first published on May 24, 2018. It was last updated on May 24, 2018.

This page (Get Ready, To Get Ready) was last updated on Oct 18, 2021.

Text editor powered by tinymce.