Description: The application note introduces Atmel-ICE setup, driver installation, user guide of the Atmel Studio command line utility (atprogram.exe), and provide a PC programming tool project written in C#. The Visual C# example project can be downloaded along with this application note and run with the ATmega328PB Xplained Mini kit. Jun 29, 2018 Configure Console System Service Step 7: Save the file, and then, press the upload arrow again. The bootloader can be restored with the Atmel-ICE, atmel ice the Linduino is not truly bricked, but atmel ice you are a novice user that atmel ice unfamiliar with the term bootloaderthis might not be the tutorial for you. Atmel-ICE-C is the cost effective solution for the powerful Atmel-ICE, it adopts the original ATMEL-ICE-PCBA and comes with a durable aluminium alloy enclosure. Atmel-ICE-C delivers the same functionality and usability just as the ATMEL-ICE Full Kit, it is capable of debugging and programming Atmel ARM® Cortex®-M based Atmel SAM and AVR.
Atmel maXTouch touchscreen drivers were deinstalled by 3rd party drier uptater soffware. Kivy – Supports multi-touch at the evdev layer. With maXTouch Atmel maxtouch touchscreen controllers featuring SlimSensor Technology, system designers can deliver mobile products that delight users with unprecedented slimness, vividness and responsiveness. Also the Atmel Software Framework of chip-specific source code libraries is available as a huge zip file download independent of Atmel studio. GDB works well with an SWD adapter for Atmel's ARM parts, there are some indications it can be made to work with the AVRs connected via an Atmel ICE, but never personally tried that.
Atmel-ICE is a powerful development tool for debugging and programming ARM®Cortex®-M based SAM and AVR microcontrollers with on-chip debug capability.Official reference can be found here.
Contents
You can configure debugging tool using debug_tool option in'platformio.ini' (Project Configuration File):
If you would like to use this tool for firmware uploading, please changeupload protocol:
More options:
Windows: | When installing the Atmel-ICE on a computer running Microsoft Windows,the USB driver is loaded when the Atmel-ICE is first plugged in. |
---|---|
Mac: | Not required. |
Linux: | Please install 'udev' rules 99-platformio-udev.rules. If you already installedthem before, please check that your rules are up-to-date or repeat steps. |
Name | Description |
---|---|
Atmel SAM | Atmel | SMART offers Flash- based ARM products based on the ARM Cortex-M0+, Cortex-M3 and Cortex-M4 architectures, ranging from 8KB to 2MB of Flash including a rich peripheral and feature mix. |
Name | Description |
---|---|
Arduino | Arduino Wiring-based Framework allows writing cross-platform software to control devices attached to a wide range of Arduino boards to create all kinds of creative coding, interactive objects, spaces or physical experiences |
Mbed | Arm Mbed OS is an open source embedded operating system designed specifically for the ‘things' in the Internet of Things. It includes all the features you need to develop a connected product based on an Arm Cortex-M microcontroller, including security, connectivity, an RTOS and drivers for sensors and I/O devices |
Simba | Simba is an RTOS and build framework with aims to make embedded programming easy and portable |
Zephyr RTOS | The Zephyr Project is a scalable real-time operating system (RTOS) supporting multiple hardware architectures, optimized for resource constrained devices, and built with safety and security in mind |
Note
For more detailed board
information please scroll tables below by horizontal.
Name | Platform | Debug | MCU | Frequency | Flash | RAM |
---|---|---|---|---|---|---|
Adafruit Circuit Playground Express | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
Adafruit Crickit M0 | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
Adafruit Feather M0 | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
Adafruit Feather M0 Express | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
Adafruit Feather M4 Express | Atmel SAM | External | SAMD51J19A | 120MHz | 512KB | 192KB |
Adafruit Gemma M0 | Atmel SAM | External | SAMD21E18A | 48MHz | 256KB | 32KB |
Adafruit Grand Central M4 | Atmel SAM | External | SAMD51P20A | 120MHz | 1MB | 256KB |
Adafruit Hallowing M0 | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
Adafruit Hallowing M4 | Atmel SAM | External | SAMD51J19A | 120MHz | 496KB | 192KB |
Adafruit ItsyBitsy M0 | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
Adafruit ItsyBitsy M4 | Atmel SAM | External | SAMD51G19A | 120MHz | 512KB | 192KB |
Adafruit MONSTER M4SK | Atmel SAM | External | SAMD51G19A | 120MHz | 496KB | 192KB |
Adafruit Metro M0 Expresss | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
Adafruit Metro M4 | Atmel SAM | External | SAMD51J19A | 120MHz | 512KB | 192KB |
Adafruit Metro M4 AirLift Lite | Atmel SAM | External | SAMD51J19A | 120MHz | 512KB | 192KB |
Adafruit PyGamer Advance M4 | Atmel SAM | External | SAMD51J20A | 120MHz | 1MB | 256KB |
Adafruit PyGamer M4 Express | Atmel SAM | External | SAMD51J19A | 120MHz | 512KB | 192KB |
Adafruit PyPortal M4 | Atmel SAM | External | SAMD51J20A | 120MHz | 1MB | 256KB |
Adafruit PyPortal M4 Titano | Atmel SAM | External | SAMD51J20A | 120MHz | 1MB | 256KB |
Adafruit Trellis M4 | Atmel SAM | External | SAMD51J19A | 120MHz | 512KB | 192KB |
Adafruit Trinket M0 | Atmel SAM | External | SAMD21E18A | 48MHz | 256KB | 32KB |
Adafruit pIRkey | Atmel SAM | External | SAMD21E18A | 48MHz | 256KB | 32KB |
Adafruit pyBadge AirLift M4 | Atmel SAM | External | SAMD51J20A | 120MHz | 1008KB | 192KB |
Adafruit pyBadge M4 Express | Atmel SAM | External | SAMD51J19A | 120MHz | 512KB | 192KB |
Arduino Due (Programming Port) | Atmel SAM | External | AT91SAM3X8E | 84MHz | 512KB | 96KB |
Arduino Due (USB Native Port) | Atmel SAM | External | AT91SAM3X8E | 84MHz | 512KB | 96KB |
Arduino M0 | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
Arduino M0 Pro (Native USB Port) | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
Arduino M0 Pro (Programming/Debug Port) | Atmel SAM | On-board | SAMD21G18A | 48MHz | 256KB | 32KB |
Arduino MKR FOX 1200 | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
Arduino MKR GSM 1400 | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
Arduino MKR NB 1500 | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
Arduino MKR WAN 1300 | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
Arduino MKR WAN 1310 | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
Arduino MKR WiFi 1010 | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
Arduino MKR1000 | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
Arduino MKRZERO | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
Arduino Tian | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
Arduino Zero (Programming/Debug Port) | Atmel SAM | On-board | SAMD21G18A | 48MHz | 256KB | 32KB |
Arduino Zero (USB Native Port) | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
Atmel ATSAMR21-XPRO | Atmel SAM | On-board | SAMR21G18A | 48MHz | 256KB | 32KB |
Atmel ATSAMW25-XPRO | Atmel SAM | On-board | SAMD21G18A | 48MHz | 256KB | 32KB |
Atmel SAMC21-XPRO | Atmel SAM | On-board | SAMC21J18A | 48MHz | 256KB | 32KB |
Atmel SAMD21-XPRO | Atmel SAM | On-board | SAMD21J18A | 48MHz | 256KB | 32KB |
Atmel SAML21-XPRO-B | Atmel SAM | On-board | SAML21J18B | 48MHz | 256KB | 32KB |
Briki ABC (MBC-WB) - Samd21 | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
Briki MBC-WB - Samd21 | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
Digistump DigiX | Atmel SAM | External | AT91SAM3X8E | 84MHz | 512KB | 96KB |
MKR Vidor 4000 | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
Minitronics v2.0 | Atmel SAM | External | SAMD21J18A | 48MHz | 256KB | 32KB |
Moteino M0 | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
NANO 33 IoT | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
SODAQ Autonomo | Atmel SAM | External | SAMD21J18A | 48MHz | 256KB | 32KB |
SODAQ ExpLoRer | Atmel SAM | External | SAMD21J18A | 48MHz | 256KB | 32KB |
SODAQ ONE | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
SODAQ SARA | Atmel SAM | External | SAMD21J18A | 48MHz | 256KB | 32KB |
SODAQ SFF | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
SainSmart Due (Programming Port) | Atmel SAM | External | AT91SAM3X8E | 84MHz | 512KB | 96KB |
SainSmart Due (USB Native Port) | Atmel SAM | External | AT91SAM3X8E | 84MHz | 512KB | 96KB |
Seeeduino Femto M0 | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
Seeeduino LoRaWAN | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
Seeeduino Wio Lite MG126 | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
Seeeduino Wio Terminal | Atmel SAM | External | SAMD51P19A | 120MHz | 496KB | 192KB |
Seeeduino XIAO | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
Seeeduino Zero | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
SparkFun 9DoF Razor IMU M0 | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
SparkFun Qwiic Micro | Atmel SAM | External | SAMD21E18A | 48MHz | 256KB | 32KB |
SparkFun RedBoard Turbo | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
SparkFun SAMD21 Dev Breakout | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
SparkFun SAMD21 Mini Breakout | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
SparkFun SAMD21 Pro RF | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
SparkFun SAMD51 Thing Plus | Atmel SAM | External | SAMD51J20A | 120MHz | 496KB | 192KB |
Tuino 096 | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
Work from the command line on OS X or Linux, without Atmel Studio or Eclipse.
May 22, 2017
NOTE: an updated version of this article is available here
These notes describe how I program a SAMD21E17 breakout board with the Atmel ICE, using the command line on Mac OS X, without Atmel Sudio or any other IDE.I assume that the almost exact same procedure can be applied to linux.
The board I used is a TAU (see http://rabidprototypes.com/product/tau/), but the procedure would be the same for the more popular SAMD21G18 that can be found on the Arduino Zero for example.
The ARM developper tools (arm-none-eabi) need to be installed your system.
OpenOCD
On the Mac, I used brew to install OpenOCD (see https://brew.sh/):
The first step is to set up OpenOCD correctly. For this purpose create a file called openocf.cfg, with the following content:
You should change the value at91samd21e17 to match the microcontroller you are using (e.g. at91sam21g18).
Atmel Ice Driver For Macbook Pro
If you have several Atmel-ICE debuggers connected to your machine, you need to distinguish them by their serial number in the openocd.cfg file by adding the following line with your own serial number substitued:
On a MAC, you can find the serial number by searching through the output of the command system_profiler SPUSBDataType
and on linux you would look through the output of lsusb -v
.
You can test you openocd.cfg file by simply typing openocd
. You should get an output similar to this:
Now you can plug the SWD header in the board you want to program (don't forget to power the board!). If you launch OpenOCD again, you should get the following output:
Now, while OpenOCD is still running, we can test that gdb works by typing arm-none-eabi-gdb -iex 'target extended-remote localhost:3333':
If you got this far, your OpenOCD is complete.
More options:
Windows: | When installing the Atmel-ICE on a computer running Microsoft Windows,the USB driver is loaded when the Atmel-ICE is first plugged in. |
---|---|
Mac: | Not required. |
Linux: | Please install 'udev' rules 99-platformio-udev.rules. If you already installedthem before, please check that your rules are up-to-date or repeat steps. |
Name | Description |
---|---|
Atmel SAM | Atmel | SMART offers Flash- based ARM products based on the ARM Cortex-M0+, Cortex-M3 and Cortex-M4 architectures, ranging from 8KB to 2MB of Flash including a rich peripheral and feature mix. |
Name | Description |
---|---|
Arduino | Arduino Wiring-based Framework allows writing cross-platform software to control devices attached to a wide range of Arduino boards to create all kinds of creative coding, interactive objects, spaces or physical experiences |
Mbed | Arm Mbed OS is an open source embedded operating system designed specifically for the ‘things' in the Internet of Things. It includes all the features you need to develop a connected product based on an Arm Cortex-M microcontroller, including security, connectivity, an RTOS and drivers for sensors and I/O devices |
Simba | Simba is an RTOS and build framework with aims to make embedded programming easy and portable |
Zephyr RTOS | The Zephyr Project is a scalable real-time operating system (RTOS) supporting multiple hardware architectures, optimized for resource constrained devices, and built with safety and security in mind |
Note
For more detailed board
information please scroll tables below by horizontal.
Name | Platform | Debug | MCU | Frequency | Flash | RAM |
---|---|---|---|---|---|---|
Adafruit Circuit Playground Express | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
Adafruit Crickit M0 | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
Adafruit Feather M0 | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
Adafruit Feather M0 Express | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
Adafruit Feather M4 Express | Atmel SAM | External | SAMD51J19A | 120MHz | 512KB | 192KB |
Adafruit Gemma M0 | Atmel SAM | External | SAMD21E18A | 48MHz | 256KB | 32KB |
Adafruit Grand Central M4 | Atmel SAM | External | SAMD51P20A | 120MHz | 1MB | 256KB |
Adafruit Hallowing M0 | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
Adafruit Hallowing M4 | Atmel SAM | External | SAMD51J19A | 120MHz | 496KB | 192KB |
Adafruit ItsyBitsy M0 | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
Adafruit ItsyBitsy M4 | Atmel SAM | External | SAMD51G19A | 120MHz | 512KB | 192KB |
Adafruit MONSTER M4SK | Atmel SAM | External | SAMD51G19A | 120MHz | 496KB | 192KB |
Adafruit Metro M0 Expresss | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
Adafruit Metro M4 | Atmel SAM | External | SAMD51J19A | 120MHz | 512KB | 192KB |
Adafruit Metro M4 AirLift Lite | Atmel SAM | External | SAMD51J19A | 120MHz | 512KB | 192KB |
Adafruit PyGamer Advance M4 | Atmel SAM | External | SAMD51J20A | 120MHz | 1MB | 256KB |
Adafruit PyGamer M4 Express | Atmel SAM | External | SAMD51J19A | 120MHz | 512KB | 192KB |
Adafruit PyPortal M4 | Atmel SAM | External | SAMD51J20A | 120MHz | 1MB | 256KB |
Adafruit PyPortal M4 Titano | Atmel SAM | External | SAMD51J20A | 120MHz | 1MB | 256KB |
Adafruit Trellis M4 | Atmel SAM | External | SAMD51J19A | 120MHz | 512KB | 192KB |
Adafruit Trinket M0 | Atmel SAM | External | SAMD21E18A | 48MHz | 256KB | 32KB |
Adafruit pIRkey | Atmel SAM | External | SAMD21E18A | 48MHz | 256KB | 32KB |
Adafruit pyBadge AirLift M4 | Atmel SAM | External | SAMD51J20A | 120MHz | 1008KB | 192KB |
Adafruit pyBadge M4 Express | Atmel SAM | External | SAMD51J19A | 120MHz | 512KB | 192KB |
Arduino Due (Programming Port) | Atmel SAM | External | AT91SAM3X8E | 84MHz | 512KB | 96KB |
Arduino Due (USB Native Port) | Atmel SAM | External | AT91SAM3X8E | 84MHz | 512KB | 96KB |
Arduino M0 | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
Arduino M0 Pro (Native USB Port) | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
Arduino M0 Pro (Programming/Debug Port) | Atmel SAM | On-board | SAMD21G18A | 48MHz | 256KB | 32KB |
Arduino MKR FOX 1200 | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
Arduino MKR GSM 1400 | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
Arduino MKR NB 1500 | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
Arduino MKR WAN 1300 | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
Arduino MKR WAN 1310 | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
Arduino MKR WiFi 1010 | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
Arduino MKR1000 | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
Arduino MKRZERO | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
Arduino Tian | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
Arduino Zero (Programming/Debug Port) | Atmel SAM | On-board | SAMD21G18A | 48MHz | 256KB | 32KB |
Arduino Zero (USB Native Port) | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
Atmel ATSAMR21-XPRO | Atmel SAM | On-board | SAMR21G18A | 48MHz | 256KB | 32KB |
Atmel ATSAMW25-XPRO | Atmel SAM | On-board | SAMD21G18A | 48MHz | 256KB | 32KB |
Atmel SAMC21-XPRO | Atmel SAM | On-board | SAMC21J18A | 48MHz | 256KB | 32KB |
Atmel SAMD21-XPRO | Atmel SAM | On-board | SAMD21J18A | 48MHz | 256KB | 32KB |
Atmel SAML21-XPRO-B | Atmel SAM | On-board | SAML21J18B | 48MHz | 256KB | 32KB |
Briki ABC (MBC-WB) - Samd21 | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
Briki MBC-WB - Samd21 | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
Digistump DigiX | Atmel SAM | External | AT91SAM3X8E | 84MHz | 512KB | 96KB |
MKR Vidor 4000 | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
Minitronics v2.0 | Atmel SAM | External | SAMD21J18A | 48MHz | 256KB | 32KB |
Moteino M0 | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
NANO 33 IoT | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
SODAQ Autonomo | Atmel SAM | External | SAMD21J18A | 48MHz | 256KB | 32KB |
SODAQ ExpLoRer | Atmel SAM | External | SAMD21J18A | 48MHz | 256KB | 32KB |
SODAQ ONE | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
SODAQ SARA | Atmel SAM | External | SAMD21J18A | 48MHz | 256KB | 32KB |
SODAQ SFF | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
SainSmart Due (Programming Port) | Atmel SAM | External | AT91SAM3X8E | 84MHz | 512KB | 96KB |
SainSmart Due (USB Native Port) | Atmel SAM | External | AT91SAM3X8E | 84MHz | 512KB | 96KB |
Seeeduino Femto M0 | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
Seeeduino LoRaWAN | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
Seeeduino Wio Lite MG126 | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
Seeeduino Wio Terminal | Atmel SAM | External | SAMD51P19A | 120MHz | 496KB | 192KB |
Seeeduino XIAO | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
Seeeduino Zero | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
SparkFun 9DoF Razor IMU M0 | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
SparkFun Qwiic Micro | Atmel SAM | External | SAMD21E18A | 48MHz | 256KB | 32KB |
SparkFun RedBoard Turbo | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
SparkFun SAMD21 Dev Breakout | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
SparkFun SAMD21 Mini Breakout | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
SparkFun SAMD21 Pro RF | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
SparkFun SAMD51 Thing Plus | Atmel SAM | External | SAMD51J20A | 120MHz | 496KB | 192KB |
Tuino 096 | Atmel SAM | External | SAMD21G18A | 48MHz | 256KB | 32KB |
Work from the command line on OS X or Linux, without Atmel Studio or Eclipse.
May 22, 2017
NOTE: an updated version of this article is available here
These notes describe how I program a SAMD21E17 breakout board with the Atmel ICE, using the command line on Mac OS X, without Atmel Sudio or any other IDE.I assume that the almost exact same procedure can be applied to linux.
The board I used is a TAU (see http://rabidprototypes.com/product/tau/), but the procedure would be the same for the more popular SAMD21G18 that can be found on the Arduino Zero for example.
The ARM developper tools (arm-none-eabi) need to be installed your system.
OpenOCD
On the Mac, I used brew to install OpenOCD (see https://brew.sh/):
The first step is to set up OpenOCD correctly. For this purpose create a file called openocf.cfg, with the following content:
You should change the value at91samd21e17 to match the microcontroller you are using (e.g. at91sam21g18).
Atmel Ice Driver For Macbook Pro
If you have several Atmel-ICE debuggers connected to your machine, you need to distinguish them by their serial number in the openocd.cfg file by adding the following line with your own serial number substitued:
On a MAC, you can find the serial number by searching through the output of the command system_profiler SPUSBDataType
and on linux you would look through the output of lsusb -v
.
You can test you openocd.cfg file by simply typing openocd
. You should get an output similar to this:
Now you can plug the SWD header in the board you want to program (don't forget to power the board!). If you launch OpenOCD again, you should get the following output:
Now, while OpenOCD is still running, we can test that gdb works by typing arm-none-eabi-gdb -iex 'target extended-remote localhost:3333':
If you got this far, your OpenOCD is complete.
Let's blink an LED
The TAU has an LED on Pin 25, which maps to the GPIO PA27: the 27th io port on port A. We will make it blink to test our setup.If you have another board it might have an LED on a different PIN or none at all, you will need to adapt the code below (e.g. the SAMD21 Xplained pro has a led on PB30).
To compile this file, you will need a set of headers provided by Microchip/Atmel. First, download the Atmel Software Framework (ASF) from http://www.atmel.com/tools/avrsoftwareframework.aspx
Atmel Ice Driver For Mac Windows 7
When uncompressing a the file, you'll get a directory named xdk-asf-3.34.2/
or something similar depending on the version you dowloaded. Let's name ASFROOT the absolute path corresponding to that directory (e.g. ASFROOT='/Users/pannetra/Downloads/xdk-asf-3.34.2').
Go to the directory where you put the openocd.cfg file and perform the following actions:
Now the following steps will need a small customisation depending on the microcontroller you have. In my case it's a SAMD21E17A:
If you have a different microcontroller from the SAMD21E17A, you should change the file name samd21e17a_flash.ld to match your microcontroller.
The above Makefile is derived from the great work of Geoffrey Brown on the STM32.
If you have a different microcontroller from the SAMD21E17A, you need to change the following two lines in the Makefile: LDSCRIPT = samd21e17a_flash.ld
and PTYPE=__SAMD21E17A__
, replacing references to the samd21e17a with your own.
Compiling and running the code
First we will check that the code compiles as expected.
Now, you are ready to run the program. Connect the OpenOCD and power your board. We will use gdb to load the program and run it:
Note the gdb commands (load, monitor reset, monitor halt, c...).
Atmel Ice Driver For Mac Os
Let the LED blink!
The example above does not include the HAL (Hardware Abstraction Layer), which is yet part of another directory in the ASF. A topic for another post I guess.
Comments
Thanks for the great write up. I got as far as typing arm-none-eabi-gdb. Seems I have to set up a cross compile environment on my Gentoo system to get an arm build of the gdb server.
Justin, over 3 years agoAtmel Ice Driver For Mac Os
Is your solution open sourced? I am designing a network for my small RV van and would like to use something like your solution, but need much smaller boards? Can I make a smaller version of the board? How would you get compensated?