Work from the command line on OS X or Linux, without Atmel Studio or Eclipse -- Updated article.
- Atmel Sam Ice
- Atmel Ice Driver For Mac Os
- Atmel Ice Basic
- Atmel Ice Driver Mac
- Atmel Ice Driver Download
- Atmel Sam Ice Driver
- Atmel Ice Driver For Mac Free
October 6, 2017
These notes describe how to program a SAMD21 breakout board with the Atmel ICE, using the command line on Mac OS X or Linux Debian, without Atmel Studio or any other IDE, or even any hardware abstraction library. This updates a previous blog entry with more details and minor corrections.
To illustrate SAMD21 programming, we will use a Sparkfun SAMD21 dev breakout board as our target. It features the popular Atmel SAMD21G18 ARM Cortex M0 and our examples should work with little or no modifications on similar platforms such as the Arduino M0 or the TAU featured in the previous version of this article.
ATSAMD21G18AU Part Pack for Atmel Studio 6.2: ATSAMD21G17AU Part Pack for Atmel Studio 6.2: SAMG55 Part Pack for Atmel Studio 6.2: ATSAM4C4C Part Pack for Atmel Studio 6.2: ATSAM4CMS4C Part Pack for Atmel Studio 6.2: ATSAMC20 Part Pack for Atmel Studio 6.2: ATSAMC21 Part Pack for Atmel Studio 6.2: Atmel Studio SAMD21 64K Exodus Device Support. Selected 'Browse my computer for driver software' Selected 'Let me picks from a list of available drivers on my computer. Which gave me these options: Now the trick here is to NOT select the 'Atmel-ICE' ones, but chose the 'USB Input Device' option instead. Click 'Next' and voila it worked! ATMEL ICE DATA GATEWAY DRIVER FOR WINDOWS 7 - Network Analysis Tools Review the Application Code Step 9: Generate Harmony code Step 7: Configure Evaluation Board Step 4: Know what an ISO file is and how to use it. Really know your way around a PC and feel comfortable troubleshooting problems, backing up data, formatting a hard drive, installing an operating.
In terms of hardware, this article also assumes you own an Atmel ICE programmer.
You will need to install some software packages to program your SAMD21 board. On Debian Linux, you will use your package manager (e.g. 'aptitude'). On the Mac, we suggest using homebrew to install the different tools described here.
Step 1: Install the programming header
To program a SAMD21 board with OpenOCD you will need to connect that programmer to your board with the SWD header. On the Sparkfun SAMD21 breakout board this SWD header is present but unpopulated as shown in the picture below, on the left. You will need to fit a 2x5 pin 1.27mm male header, as shown in the picture below, on the right.
You don't necessarily need to solder the header to the board: just plugging the header is usually good enough to establish electrical contact.You will then plug the corresponding connector on the Atmel ICE. Since the connector is not keyed, there are two possible ways to plug the Atmel ICE on the board. If you try one way and it doesn't work, just flip the connector around!
Atmel Sam Ice
Step 2: Install the C compiler for ARM
The ARM developer tools (arm-none-eabi) need to be installed on your system.
On the Mac, with homebrew, it boils down to one command:
On a Linux, with a Debian style OS, you will need to refer to your package manager (apt-get or aptitude).
Step 3: Install OpenOCD
Installing OpenOCD on the Mac is also a one-liner:
On Debian Linux, a similar aptitude install openocd
will do the trick.
Once installed, the next 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 at91samd21g18 to match the microcontroller you are using.
You can test your 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 separately, with USB for example. If you launch OpenOCD again, you should get the following output:
If this fails, you may have plugged the SWD connector backward: just flip it around.
Now, while OpenOCD is still running, we can test that gdb works by typing arm-none-eabi-gdb -iex 'target extended-remote localhost:3333' in another terminal window:
If you got this far, your OpenOCD is complete.
Step 4: Writing code to blink an LED
The Sparkfun SAMD21 breakout board has an LED on the pin labeled 'D13', which maps to the GPIO PA17: the 17th 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 an LED on PB30).
In the code above, blinking the LED PA17 is achieved by setting and clearing the 17th bit of a specific register called REG_PORT_DIR0
, which corresponds to port A on the SAMD21. There are in fact several ways to achieve the same result on the SAMD21, we are just showing one for simplicity.
Atmel Ice Driver For Mac Os
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.microchip.com/avr-support/advanced-software-framework-(asf). In fact, you will only be using a very small subset of this big framework, and you will be able to delete a large part of this framework if needed later.
When uncompressing the file, you'll get a directory named xdk-asf-3.37/
or something similar depending on the version you downloaded. Let's name ASF_ROOT the absolute path corresponding to that directory (e.g. set ASF_ROOT='/Users/pannetra/Src/xdk-asf-3.37'
).
Go to the directory where you put the openocd.cfg file and perform the following actions:
Now the following steps will need a small customization depending on the microcontroller you have. In the case of our Sparkfun board, it's a SAMD21G18A:
If you have a different microcontroller from the SAMD21G18A, you should change the file name samd21g18a_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 SAMD21G18A, you need to change the following two lines in the Makefile: LDSCRIPT = samd21g18a_flash.ld
and PTYPE=__SAMD21G18A__
, replacing references to the samd21g18a with your own.
Step 5: Compiling and running the code
Atmel Ice Basic
If you followed all the steps above, you should have the following files in your current directory:
- Makefile
- openocd.cfg
- startup_samd21.c
- main.c
- samd21g18a_flash.ld
We will check that the code compiles as expected.
Now, you are ready to run the program. Connect the Atmel ICE and power your board. Launch OpenOCD as shown previously. In a separate terminal window, we will use gdb to load the program and run it:
Note the gdb commands:
- load uploads the code to the SAMD21
- monitor reset halt resets the SAMD21
- c starts running the code (c is short of continue)
At this point, your LED should blink!
Atmel Ice Driver Mac
Comments
HI, I was just wondering. I already have the Atmel Power Debugger. How could i use it with this setup, instead of an Atmel ICE?
berkut3000, almost 2 years agoI used this as a guide on Ubuntu 19.04, and found that I had to make the following adaptations: use gdb-multiarch instead of arm-none-eabi-gdb, and change the Makefile debug section to: gdb-multiarch -ex 'target extended-remote localhost:3333' $(ELF). This was a very useful guide to getting everything working, thanks.
Atmel Ice Driver Download
Austin GoslingAtmel Sam Ice Driver
, about 1 year agoAtmel Ice Driver For Mac Free
Thank you for posting this, I have been trying to do this for a while, and your instructions were extremely helpful in sending me in the right direction.
Nathan, about 1 year ago