Atmel Studio 7
Atmel Studio 7
Atmel Studio 7
Atmel Studio 7
Preface
® ®
Atmel Studio is an Integrated Development Environment (IDE) for writing and debugging AVR /ARM
® ®
applications in Windows XP/Windows Vista /Windows 7/8 environments. Atmel Studio provides a project
management tool, source file editor, simulator, assembler, and front-end for C/C++, programming, and
on-chip debugging.
Atmel Studio supports the complete range of Microchip AVR tools. Each new release contains the latest
updates for the tools as well as support for new AVR/ARM devices.
Atmel Studio has a modular architecture, which allows interaction with 3rd party software vendors. GUI
plugins and other modules can be written and hooked to the system. Contact Microchip for more
information.
Table of Contents
Preface............................................................................................................................ 1
1. Introduction................................................................................................................5
1.1. Features....................................................................................................................................... 5
1.2. New and Noteworthy.................................................................................................................... 5
1.3. Installation.................................................................................................................................. 12
1.4. Contact Information.................................................................................................................... 13
2. Getting Started........................................................................................................ 15
2.1. Atmel Studio 7, START, and Software Content.......................................................................... 17
®
2.2. AVR and SAM HW Tools and Debuggers.................................................................................19
2.3. Data Visualizer and Power Debugging Demo............................................................................ 21
2.4. Installation and Updates.............................................................................................................23
2.5. Microchip Gallery and Studio Extensions...................................................................................25
2.6. Atmel START Integration............................................................................................................26
2.7. Creating a New Project.............................................................................................................. 31
2.8. Creating From Arduino Sketch................................................................................................... 37
2.9. In-System Programming and Kit Connection............................................................................. 38
2.10. I/O View and Other Bare-Metal Programming References ....................................................... 45
2.11. Editor: Writing and Re-Factoring Code (Visual Assist)...............................................................57
2.12. AVR Simulator Debugging..........................................................................................................66
2.13. Debugging 1: Break Points, Stepping, and Call Stack............................................................... 71
2.14. Debugging 2: Conditional- and Action-Breakpoints ...................................................................81
2.15. Debugging 3: I/O View Memory View and Watch.......................................................................88
3. Project Management............................................................................................... 96
3.1. Introduction.................................................................................................................................96
3.2. GCC Projects............................................................................................................................. 99
3.3. Assembler Projects.................................................................................................................. 132
3.4. Import of Projects..................................................................................................................... 137
3.5. Debug Object File in Atmel Studio........................................................................................... 146
4. Debugging............................................................................................................. 152
4.1. Introduction...............................................................................................................................152
4.2. Starting a Debug Session.........................................................................................................152
4.3. Ending a Debug Session..........................................................................................................152
4.4. Attaching to a Target................................................................................................................ 153
4.5. Start without Debugging........................................................................................................... 153
4.6. Debug Control.......................................................................................................................... 154
4.7. Breakpoints.............................................................................................................................. 156
4.8. Data Breakpoints......................................................................................................................161
4.9. QuickWatch, Watch, Locals, and Autos Windows....................................................................175
4.10. DataTips................................................................................................................................... 181
4.11. Disassembly View ................................................................................................................... 184
5. Programming Dialog..............................................................................................201
5.1. Introduction...............................................................................................................................201
5.2. Interface Settings..................................................................................................................... 204
5.3. Tool Information........................................................................................................................208
5.4. Board Settings/Tool Settings.................................................................................................... 208
5.5. Card Stack................................................................................................................................211
5.6. Device Information................................................................................................................... 212
5.7. Oscillator Calibration................................................................................................................ 213
5.8. Memories..................................................................................................................................214
5.9. Fuse Programming...................................................................................................................216
5.10. Lock Bits...................................................................................................................................217
5.11. Production Signatures.............................................................................................................. 217
5.12. Production Files........................................................................................................................218
5.13. Security.................................................................................................................................... 221
5.14. Automatic Firmware Upgrade Detection.................................................................................. 222
7. GNU Toolchains.....................................................................................................240
7.1. GNU Compiler Collection (GCC)..............................................................................................240
7.2. ARM Compiler and Toolchain Options: GUI ............................................................................ 240
7.3. ARM GNU Toolchain Options...................................................................................................245
7.4. Binutils......................................................................................................................................250
7.5. AVR Compiler and Toolchain Options: GUI .............................................................................250
7.6. Commonly Used Options......................................................................................................... 255
7.7. 8-bit Specific AVR GCC Command Line Options.....................................................................259
7.8. 32-bit Specific AVR GCC Command Line Options...................................................................260
7.9. Binutils......................................................................................................................................263
Legal Notice.................................................................................................................358
Trademarks................................................................................................................. 358
1. Introduction
1.1 Features
Atmel Studio provides a large set of features for project development and debugging. The most notable
features are listed below.
• Rich code editor for C/C++ and Assembly featuring the powerful Visual Assist extension
• Cycle correct simulator with advanced debug functionality
• Advanced Software Framework allowing creation of modular applications and providing building
blocks for a prototype on any AVR platform
• Debugging on actual devices using Debugging Tools
• Rich SDK to enable tight integration of customer plugins
® ®
• Compatible with many Microsoft Visual Studio plugins
• AVRSV-7741: Writing Flash or EEPROM with size of 0x100 or 0x1000 fails on ISP/SPI
programming.
• AVRSV-7474: Kits connected to Atmel Studio are not getting enumerated in the QTouch Start Page.
• AVRSV-7477: Show all files does not work from solution explorer.
• AVRSV-7482: Exception when adding a breakpoint on SAM4L.
• AVRSV-7486: Debugging may fail in Cortex-M0+ SAM devices at high clock speeds.
Atmel Studio 7.0.790 resolves the following issues present in Atmel Studio 7.0.634:
• AVRSV-7084: Persist user settings during the upgrade.
• AVRSV-7014: Some ATmega and ATtiny devices failed to start debugging with the Simulator.
• AVRSV-7230: 'Show all files' in Solution Explorer not consistent.
• AVRSV-7062: Firmware upgrade of Xplained Mini kits not detected.
• AVRSV-7164: Reading flash to .bin file created incorrect .bin file.
• AVRSV-7106: Hex files with UNIX or mixed file endings fail to load.
• AVRSV-7126: Data breakpoints for ARM should not be limited to RAM.
– gdb 7.8
• AVR 32-bit GCC Toolchain 3.4.3 with upstream versions1:
– gcc 4.4.7
– Binutils 2.23.1
– Newlib 1.16.0
• ARM GCC Toolchain 4.9.3 with upstream versions1:
– gcc 4.9 (revision 221220)
– Binutils 2.24
– gdb 7.8.0.20150304-cvs
1 For more information, see the readme that is installed as part of the toolchain.
2 For more information, see the readme that is installed as part of the toolchain.
1.3 Installation
Installation instructions.
Supported Architectures
• 32-bit (x86)
• 64-bit (x64)
Hardware Requirements
• Computer that has a 1.6 GHz or faster processor
• RAM
– 1 GB RAM for x86
2. Getting Started
Getting Started Atmel Studio 7 - playlist.
This Getting Started training for Atmel Studio 7 will guide you through all the major features of the IDE. It
is designed as a video series with accompanying hands-ons. Each section starts with a video, which
covers that section.
Prerequisites
Much of the training could be completed by using the editor and simulator, however, in order to cover
everything the following is recommended.
Hardware prerequisites:
• ATtiny817 Xplained Pro
• Standard-A to Micro-B USB cable
Software prerequisites:
• Atmel Studio 7.0
• avr-gcc toolchain
®
• Latest Part Pack for tinyAVR devices
Atmel Studio 7.0 plugins used:
• Atmel START 1.0.113.0 or later
• Data Visualizer Extension 2.14.709 or later
WARNING
Indicates important information.
performance, as well as to better integrate with the Atmel START web user interface. ASF4 must be used
in conjunction with Atmel START, which replaces the ASF Wizard of ASF2 and 3.
Microchip.com: ASF Product Page
AVR Code
AVR Code, supporting the AVR product line, is a simple firmware framework for AVR 8-bit MCUs,
equivalent to Foundation Services, which supports 8- and 16-bit PIC MCUs. AVR Code is optimized for
code-size and -speed, as well as simplicity and readability of code. AVR Code is configured by Atmel
START.
Power Debugger also includes a CDC virtual COM port interface as well as Data Gateway Interface
channels for streaming application data to the host computer from an SPI, USART, TWI, or GPIO source.
The Power Debugger is a CMSIS-DAP compatible debugger which works with Studio 7.0 or later, or other
frontend software capable of connecting to a generic CMSIS-DAP unit. The Power Debugger streams
power measurements and application debug data to the Data Visualizer for real-time analysis.
Website: Power Debugger
/*
* Power_Demo_ADC_SleepWalking.c
* Device/board: ATtiny817 Xplained Pro
* Created: 8/6/2017 3:15:21 PM
*/
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/sleep.h>
void sys_init(void)
{
_PROTECTED_WRITE(CLKCTRL.MCLKCTRLB, CLKCTRL_PEN_bm | CLKCTRL_PDIV_2X_gc);
}
void rtc_pit_init(void)
{
RTC.CLKSEL = RTC_CLKSEL_INT1K_gc;
RTC.PITCTRLA = RTC_PITEN_bm | RTC_PERIOD_CYC256_gc;
void adc_init(void)
{
ADC0.CTRLC = ADC_PRESC_DIV8_gc | ADC_REFSEL_VDDREF_gc;
ADC0.CTRLA = ADC_ENABLE_bm | ADC_RESSEL_8BIT_gc;
ADC0.MUXPOS = ADC_MUXPOS_AIN6_gc;
uint8_t adc_get_result(void)
{
return ADC0.RESL;
}
//picoPower 5: Send quickly, then back to sleep: compare 9600, 115200, 1250000 baud rates
//note only sending 1 byte
#define BAUD_RATE 57600
void usart_init()
{
USART0.CTRLB = USART_TXEN_bm;
USART0.BAUD = (F_CPU * 64.0) / (BAUD_RATE * 16.0);
}
void usart_put_c(uint8_t c)
{
VPORTB.DIR |= PIN2_bm | PIN6_bm; //picoPower 2b: see Disable Tx below
USART0.STATUS = USART_TXCIF_bm;
VPORTB.OUT |= PIN6_bm;
USART0.TXDATAL = c;
while(!(USART0.STATUS & USART_TXCIF_bm));
VPORTB.OUT &= ~PIN6_bm;
VPORTB.DIR &= ~PIN2_bm | PIN6_bm;
//picoPower 2b: Disable Tx pin in-between transmissions
}
void io_init(void)
{
for (uint8_t pin=0; pin < 8; pin++)
{
(&PORTA.PIN0CTRL)[pin] = PORT_ISC_INPUT_DISABLE_gc;
(&PORTB.PIN0CTRL)[pin] = PORT_ISC_INPUT_DISABLE_gc;
(&PORTC.PIN0CTRL)[pin] = PORT_ISC_INPUT_DISABLE_gc;
}
}
int main(void)
{
sys_init();
rtc_pit_init();
evsys_init();
adc_init();
io_init();
usart_init();
VPORTB.DIR |= PIN6_bm;
while (1)
{
sleep_mode();
}
}
2.4.1 Installation
• Windows 10
Supported Architectures
• 32-bit (x86)
• 64-bit (x64)
Hardware Requirements
• A computer that has a 1.6 GHz or faster processor
• RAM
– 1 GB RAM for x86
– 2 GB RAM for x64
– An additional 512 MB RAM if running in a Virtual Machine
• 6 GB available hard disk space
8. A new Atmel Studio project will be created and the files will be imported.
11. Click on the Reconfigure button or right-click on the project node in the Solution Explorer, and, from
the menu, select Reconfigure Atmel START Project.
12. Atmel START will open in a window inside Atmel Studio.
13. Do the necessary changes to the project. Click the GENERATE PROJECT button at the bottom of
the Atmel START window.
To do: Create a new bare-metal GCC C Executable project for the ATtiny817 device.
3. The project generation wizard will appear. This dialog provides the option to specify the
programming language and project template to be used. This project will use C, so make sure C/C+
+ is selected in the upper left corner. Select the GCC C Executable Project option from the
template list to generate a bare-bones executable project. Give the project a Name and click OK.
See Figure 2-7.
Tip: All Atmel Studio projects belong to a solution, and by default, Atmel Studio will use
the same name for both the newly created solution and the project. The solution name
field can be used to manually specify the solution name.
Tip: The create directory for solution check-box is checked by default. When this box is
ticked, Atmel Studio will generate a new folder with the specified solution name at the
location specified by the Location field.
C/C++ GCC C Executable Select this template to create an AVR 8-bit or AVR/ARM 32-bit
Project GCC project.
C/C++ GCC C++ Executable Select this template to create an AVR 8-bit or AVR/ARM 32-bit C++
Project project.
C/C++ GCC C++ Static Select this template to create an AVR 8-bit or AVR/ARM 32-bit C++
Library Project static library (LIB) project. This pre-compiled library (.a) can be
used to link to other projects (closed source) or referenced from
applications that need the same functionality (code reuse).
Assembler Assembler Project Select this template to create an AVR 8-bit Assembler project.
Attention: This table only lists the default project types. Other project types may be
added by extensions.
4. Next, it is necessary to specify which device the project will be developed for. A list of devices will
be presented in the Device Selection dialog, which can be scrolled through, as depicted in Figure
2-8. It is possible to narrow the search by using the Device Family drop-down menu or by using the
search box. This project will be developed for the ATtiny817 AVR device, so enter '817' in the
search box in the top right corner. Select the ATtiny817 entry in the device list and confirm the
device selection by clicking OK.
Tip: A search for 'tiny' will provide a list of all supported ATtiny devices. A search for
'mega' will provide a list of all supported ATmega devices. Tools → Device Pack
Manager can be used to install support for additional devices.
Result: A new GCC C Executable project has now been created for the ATtiny817 device. The
Solution Explorer will list the content of the newly generated solution, as depicted in Figure
2-9. If not already open, it can be accessed through View → Solution Explorer or by pressing
Ctrl+Alt+L.
Figure 2-9. Solution Explorer
To do: Associate the EDBG on your ATtiny817 Xplained Pro kit with your project.
1. Connect the ATtiny817 Xplained Pro board to the computer using the provided Micro-USB cable.
The kit page should be present in Atmel Studio as in the figure below.
1.1. There are links to documentation for the board and data sheet for the device.
1.2. It is possible to create an Atmel START project for the board. Clicking on the Atmel START
links project links will bring you into Atmel START where you get options for this specific
board.
2. Opening the Programming Dialog by Tools → Device Programming.
2.1. Select EDBG Tool and assure that Device = ATtiny817, then you may read Device
Signature and Target Voltage.
2.2. Interface settings: You may see and change the interface clock frequency.
2.3. Tool information: Shows information about the EDBG tool.
2.4. Device information: Shows information about the device. Note that you can also see the
silicon revision of the device. This may be useful in customer support cases.
2.5. Memories: May program the flash, EEPROM, and user signature separately from the files.
2.6. Fuses: Read and set fuses, for instance, oscillator frequency (16 or 20 MHz), brown-out
voltage detection etc.
2.7. Lock bits: Lock memory.
2.8. Production file: Program the device using a production file to program flash, EEPROM, and
user signatures.
2.9. Note that AVR has flash in the HEX file and EEPROM in the EEP files, while PIC has
everything, even fuses, in a HEX file.
2.10. For instance, SAML21J devices don't have EEPROM (may be emulated in flash). It also
has a security bit option to lock the device.
3. Create a new project by selecting File → New project, select for instance C executable project,
select the device by filtering on the device name. Different project types are discussed in another
Getting Started video.
4. If a project is selected, click the Tool button located in the top menu bar to open the tool dialog as
indicated in the figure below.
Figure 2-11. Tool Button
5. The Tool tab of the Project Properties will open. In the drop-down menu, select the EDBG tool, as
indicated in the figure below. The interface should automatically initiate to UPDI (Unified
Programming Debugging Interface).
Tip: The serial number of the tool will accompany its name in the drop-down menu. This
serial number is printed on the backside of each tool, allowing differentiation when more
than one is connected.
Tip: These steps can always be repeated if a different tool should be used for the next debug/
program session.
WARNING
On the ATtiny817 Xplained Pro, the EDBG is permanently connected to the target MCU, but for
a custom hardware solution it is necessary to ensure the target device is powered and properly
connected before a debug session can be launched.
Result: The tool to be used by Atmel Studio when a debug/programming session is launched,
has now been specified.
To do: Verify the tool and project configuration setup done in the previous sections.
1. Click the Start Without Debugging button located in the Debug menu, as shown in the figure
below. This will compile the project and write it to the specified target MCU using the configured
tool.
Figure 2-13. Start Without Debugging
2. When Atmel Studio 7 builds the project (automatically done when pressing Start Without
Debugging), several generated output files will show up in the Solution Explorer window. The
following output files are generated:
2.1. EEP file: EEPROM content written to the device.
2.2. ELF file: Contains everything written to the device, including program, EEPROM, and
fuses.
2.3. HEX file: Flash content written to the device.
2.4. LSS file: Disassembled ELF file.
2.5. MAP file: Linker info, what did the linker do, decisions about where to put things.
2.6. SREC file: Same as HEX but in Motorola format.
Info: If there is new firmware available for the selected tool, the Firmware Upgrade dialog will
appear, as depicted in Figure 2-14. Click the Upgrade button to start the firmware upgrade.
Figure 2-14. Firmware Upgrade Dialog
Depending on the state of the connected tool and the actual firmware upgrade, the upgrade
may fail on the first attempt. This is normal and can be resolved by disconnecting and
reconnecting the kit before clicking Upgrade again. After the upgrade has completed, the dialog
should say 'EDBG Firmware Successfully Upgraded'. Close the dialog box and make a new
attempt at programming the kit by clicking the Start Without Debugging button again.
Result: By compiling the empty project and writing it to the ATtiny817 the following has been
verified:
• The project is configured for the correct MCU
• The correct tool has been selected
• The tool's firmware is up-to-date
Under View > Available Tools you are able to see a list of available or recently used Tools. Here you can
specifically ask Atmel Studio 7 to upgrade the firmware for a tool.
Figure 2-15. Atmel Studio 7 Available Tools (on view menu)
In the process the following code is written. Although the code is simple, the decision process, using the
list of programming references above, is described.
#include <avr/io.h>
#define F_CPU 3333333
#include <util/delay.h>
int main(void)
{
PORTB.DIR = PIN4_bm;
while (1)
{
_delay_ms(500);
PORTB.OUTTGL = PIN4_bm;
}
}
WARNING
Be sure to keep the #include <avr/io.h> line at the top of main.c. This header file will
include the correct register map for the selected device, and without this statement, the compiler
will not recognize any of the macros referenced in the code above.
Note: We used the device data sheet for the peripheral block diagram, as well as a description of the
PORT DIR and OUT registers.
Attach to Target
Start Debugging F5
Figure 2-19. Turning ON/OFF Kit LEDs Through Manipulating I/O View Registers when Debugging
Specifically in the video related to this section, the editor is used for the following.
The LED and button are connected to the pins as per the table below, from the ATtiny817 Xplained Pro
User Guide.
Table 2-3. ATtiny817 Xplained Pro GPIO Connections
The ATtiny817 Xplained Pro design documentation schematic shows the connections for the LED and
button, as in the figure below.
Figure 2-24. ATtiny827 Xplained Pro GPIO Connection Schematics
AVR Libc
All the references covered to this point are just as relevant for SAM as for AVR, however, as the name
suggests, this one is specific to AVR. AVR Libc is a Free Software project whose goal is to provide a high-
quality C library for use with GCC on AVR microcontrollers. Together, avr-binutils, avr-gcc, and avr-libc
form the heart of the Free Software toolchain for the AVR microcontrollers. Further, they are accompanied
by projects for in-system programming software (avrdude), simulation (simulavr), and debugging (avr-
gdb, AVaRICE).
The library reference is usually a quick interface into AVR Libc, as shown in Figure 2-25. One can quickly
search the page for a relevant library. Relevant header files, which should be added to the project, are
indicated in the module name. For example searching for 'interrupts', the relevant include will be #include
<avr/interrupt.h>. Clicking into the module, a list of available functions and relevant interrupt callbacks
can be found, as shown in Figure 2-26.
Figure 2-25. AVR Libc Library Reference
Atmel START
Atmel START is a web-based software configuration tool, for various software frameworks, which helps
you getting started with MCU development. Starting from either a new project or an example project,
Atmel START allows you to select and configure software components (from ASF4 and AVR Code), such
as drivers and middleware to tailor your embedded application in a usable and optimized manner. Once
an optimized software configuration is done, you can download the generated code project and open it in
the IDE of your choice, including Studio 7, IAR Embedded Workbench, Keil μVision, or simply generate a
make-file.
Although Atmel START is a tool for MCU and software configuration, it can still be useful even in bare-
metal development, i.e. writing code from scratch using the list of programming references described in
this section. Creating a new project for the kit you are using, can be a useful alternative to the board
schematic, using the PINMUX view. In addition, the CLOCKS view can be useful to check the default
clocks of a device. Furthermore, viewing the configuration code, useful pieces can be pasted back into
your project. For example, the AVR Libc delay functions require that the clock frequency is defined, as
shown in Figure 2-29. For the ATtiny817 this default value would be: #define F_CPU 3333333.
Figure 2-29. Checking Default Clock Configuration and Using VIEW CODE to Find F_CPU Define
int main(void)
{
PORTB.DIR = PIN4_bm;
while (1)
{
}
}
The ATtiny817 Xplained Pro design documentation schematic shows the connections for the LED and
button, as in the figure below.
2. However, before hitting enter, first type 'POR', then hit CTRL+SPACE. This will bring up the
Enhanced Listbox with all possible options.
Now it is possible to filter suggestions by type, as indicated in the picture below.
3. Test if SW0 is pressed, using if( ){...}else{...} visual assist code snippet.
Simply typing 'if' will bring up the option. Or, you could R-click and choose Surround With (VA),
which gives a full list of snippets. This is an editable list, so you can add your own snippets.
4. Test if the switch is pressed, as the if( ){...}else{...} condition, turn the LED ON if pressed and OFF
if not. main.c should now look as follows:
#include<avr/io.h>
int main(void)
{
PORTB.DIRSET = PIN4_bm; /* Configure LED Pin as output */
PORTB.PIN5CTRL = PORT_PULLUPEN_bm; /* Enable pull-up for SW0 pin */
while(1)
{
if (!(PORTB.IN & PIN5_bm)) /* Check switch state */
{
PORTB.OUTCLR = PIN4_bm; /* Turn LED off */
}
else
{
PORTB.OUTSET = PIN4_bm; /* Turn LED on */
}
}
}
5. Verify that LED0 lights up when pushing SW0. Run the code by clicking Start Without
Debugging (Ctrl+Alt+F5), to verify that LED0 lights up when pushing SW0 on the ATtiny817
Xplained Pro kit.
Now that the basic functionality is in place, let's refactor the code to make it more readable.
6. Create functions LED_on( ) and LED_off( ) using Refactor → Extract Method The line of code
to turn the LED ON is executed when SW0 is pressed. Highlight this line of code, right-click and go
to it, as indicated in the figure below.
Figure 2-31. Extract Method
A Extract Method dialog will appear. Name the function 'LED_on', as indicated in the following
figure.
Click OK, and the code should change. A new function called LED_on() should appear at the top
of the file, with a function call where the line of code used to be. Use the same method to
implement LED_off().
7. Create a variable for SW0 state, using Refactor → Introduce Variable. Next, it is necessary to
create a variable for the SW0 state. Highlight the condition inside the if() in the main()
while(1) loop. Right-click and go to it, as indicated in the figure below.
Figure 2-33. Introduce Variable
The Introduce Variable dialog will appear, as depicted in Figure 2-34. Name the variable 'uint8_t
SW0_state'.
tip: Change the automatically generated bool return value to uint8_t to avoid having
to include an extra header to deal with Boolean values.
Click OK and the code should change. The condition inside the if() statement should now
reference a variable assigned to the variable on the line above it, as shown in the code block below.
while (1)
{
uint8_t SW0_state = !(PORTB.IN & PIN5_bm);
if (SW0_state)
{
LED_on();
}
else
{
LED_off();
}
}
8. Create a function SW_get_state, using Refactor → Extract Method. Select the right side of
the SW0_state assignment and extract a method for SW_get_state.
9. Implement a function void LED_set_state(uint8_t state). Extract the method. Atmel
Studio will detect the argument SW0_state, as indicated in Figure 2-35.
Figure 2-35. Extract Method with Argument
Click OK and the code should change. Now, there is a separate method for setting the LED state.
10. In function void LED_set_state(uint8_t state) rename SW0_state to state using Refactor →
Rename. In a larger application, this function may be used for setting the LED state in a context
that is irrelevant to the SW0 state. Atmel Studio is capable of contextual renaming, so this feature
can be used to easily rename the argument and avoid confusion. Inside the LED_set_state()
function, right-click on the SW0_state variable and go to Refactor → Rename, as indicated in
Figure 2-36.
Figure 2-36. Contextual Rename
The Rename dialog will appear, as depicted in Figure 2-37. Rename the SW0_state variable to
'state'. Atmel Studio will detect all occurrences of the variable with the same context as the one
which has been selected, and which are presented in a list and able to be individually selected or
deselected.
Figure 2-37. Contextual Renaming Dialog
Click Rename and the code should change. Observe that the argument of LED_set_state() and
all of its references inside the function have been renamed, but the references to SW0_state in
main() have remained the same.
11. Create function definitions, moving created functions below main().
main.c should now look as follows:
#include <avr/io.h>
void LED_on(void);
void LED_off(void);
void LED_set_state(uint8_t state);
uint8_t SW_get_state(void);
int main(void)
{
PORTB.DIRSET = PIN4_bm; /* Configure LED Pin as output */
PORTB.PIN5CTRL = PORT_PULLUPEN_bm; /* Enable pull-up for SW0 pin */
while(1)
{
uint8_t SW0_state = SW_get_state(); /* Read switch state */
LED_set_state(SW0_state); /* Set LED state */
}
}
uint8_t SW_get_state(void)
{
return !(PORTB.IN & PIN5_bm); /* Read switch state */
}
void LED_off(void)
{
PORTB.OUTSET = PIN4_bm; /* Turn LED off */
}
void LED_on(void)
{
PORTB.OUTCLR = PIN4_bm; /* Turn LED on */
}
To associate the simulator with the project, click on the Tool icon , then select Simulator.
The Cycle Counter and Stopwatch is only available with the simulator. To use these, first, click Start
Debugging and Break to start a debug session and then open the Processor Status window by
typing 'Processor' into the quick-launch bar and hitting enter (or this can be found under Debug >
Windows > Processor Status). Similarly, the Disassembly window can also be opened.
The AVR Simulator is using models based on the same RTL code used to make the real device. This
makes the Cycle Counter both bug and delay accurately. Note that the Stop Watch is related to the
Frequency, which you can set by double-clicking on the value and entering the clock frequency you
would like to use.
The Cycle Counter can be reset by clicking on the value and entering 0. Values in the Processor Status
window are updated every time the program breaks, similar to the I/O view. Then running to a breakpoint.
Note the difference in generated assembly code between the SW read-modify-write (above) and the
virtual port registers (see below).
The result of comparing these three methods are summarized in the table below:
Next, we would like to simulate a pin change IRQ. We can do this by setting the relevant IRQ flag in the
I/O view when debugging.
As shown below the ISR is hit. Note that the INTERRUPT still needs to be enabled, as shown in the write
to PORTB.PIN5CTRL in the code below.
The pin change IRQ could also have been triggered by writing to the Port Input register in the I/O view.
Writing a bit in the Port Input register is the same as applying that value to the physical pin of the device
package. The internal Port logic will then trigger the interrupt if it is configured accordingly.
Most of the standard debugging features of Studio 7 are available when using the simulator, and those
features will also be available on devices that lack on-chip debugging capabilities and cannot be
debugged using hardware debuggers. See the debugging sections of this Getting Started guide.
void LED_on();
void LED_off();
bool SW_get_state();
void LED_set_state(bool SW_state);
int main(void)
{
PORTB.DIR &= ~PIN4_bm;
PORTB.DIR |= PIN4_bm;
PORTB.DIRCLR = PIN4_bm;
PORTB.DIRSET = PIN4_bm;
while (1)
{
}
}
void LED_off()
{
PORTB.OUTSET = PIN4_bm; //LED off
}
}
else
{
LED_off();
}
}
#pragma endregion LED_functions
bool SW_get_state()
{
return !(PORTB.IN & PIN5_bm);
}
ISR(PORTB_PORT_vect)
{
uint8_t intflags = PORTB.INTFLAGS;
PORTB.INTFLAGS = intflags;
To do: Place a breakpoint and inspect a list of all breakpoints in the project.
1. Set a breakpoint on the line getting the switch state, as indicated in Figure 2-38.
Figure 2-38. Placing a Breakpoint
2. Launch a debug session . The breakpoint will be hit when the switch (SW0) on the Xplained Pro
kit is pressed. Observe that execution is halted when the breakpoint is hit, and the execution arrow
indicates that the line of code where the breakpoint is placed is about to execute. See Figure 2-39.
Figure 2-39. Execution Halting when a Breakpoint is Hit
tip: If a breakpoint is hit in a file that is not currently open, Atmel Studio will open the file
in a temporary pane. A file containing a breakpoint that is hit in a debug session will
always be brought to focus.
3. Since most of the logic of the program is handled only when an ISR is processed, it is now possible
to check the logical flow of the program. If the switch is pressed and then released when the ISR is
hit - what will be the state of the switch that the function returns? The assumption is that since
pressing the switch triggered the interrupt, that switch will be set as pressed, and the LED will thus
be turned ON.
Code stepping can be used to check this assumption. The key buttons used for code stepping are
illustrated in the table below, found in the top menu bar or in the Debug menu. The corresponding
functionality and keyboard shortcuts are outlined in the figure below.
Figure 2-40. Atmel Studio Buttons for Code Stepping
To do: Find out what state is returned if the switch is pressed and then released when
the ISR is hit. Is our assumption correct that since pressing the switch triggered the
interrupt, it will be set as pressed, and the LED will thus be turned ON?
The Step Into Function Call can be used first. To go into the SW_get_state( ) function, the Step Out of
Function Call can be used to move to the next line after returning from the function. Pressing Step
Over from the breakpoint would land us at this same point directly. Note that we could step further into
the function LED_set_state(SW_state) to determine if the LED is turned ON or not. However, we could
simply hover the mouse pointer over the SW_state variable to see that it is now set to 0, i.e. the LED will
be turned OFF. Verify this by stepping further.
Figure 2-41. Checking Value of SW_state Using Mouse Hover
Info: Although the breakpoint was triggered by the falling edge by pressing the switch, only
when calling the SW_get_state( ) function the switch state is recorded. Verify that SW_state will
read 1 if the switch is held down when stepping over this line.
1. A window or view to keep track of the breakpoints in a program is needed. The Quick Launch bar
performs a search of the Studio 7 user interface menus. This is demonstrated below, by comparing
the two figures Figure 2-42 and Figure 2-43. Note that each of the hits in the Quick Launch bar is
from 'break' related entries in the Debug menu.
Figure 2-42. 'Break' Search in the Quick Launch Bar
Open the Breakpoints Window by clicking on the top result (Debug → Windows → Breakpoints).
The Breakpoints Window lists all the breakpoints in the project, along with the current hit count, as
depicted in Figure 2-44.
tip: The Disassembly view can be conveniently displayed alongside the source code, as
demonstrated in the Figure 2-45 section.
Figure 2-44. Breakpoints Window
To do: Examine the Call Stack and the effect on it when optimizations are disabled.
1. Following from the previous section, set a breakpoint on the LED_on() function, then trigger the
breakpoint so that it is hit.
2. Open the Call Stack window by typing 'Call' in the Quick Launch bar, selecting Debug → Windows
→ Call Stack, as represented in Figure 2-46.
Note: A debug session needs to be active to open this window.
Figure 2-46. Open the Call Stack Window
3. It would be expected that the Call Stack shows LED_set_state() as the caller of LED_on(),
since that's how the code is written. However, in the Call Stack window, _vector_4 is listed as the
caller (as in Figure 2-47); this is because of compiler optimization.
Info: The call order is different because of the compiler optimization. This code is
relatively simple to follow and it is possible to understand what is going on even though
the compiler has optimized and made subtle changes to what is expected. In a more
complex project, it can sometimes be helpful to disable the compiler optimization to track
down a bug.
Note: To see why the Call Stack shows that it comes from _vector_4 initially, click on
PORTB_PORT_vect and look in the context field for the definition, as shown in Figure 2-48.
Figure 2-48. __vector_4 is the PORTB ISR Vector
4. Stop debugging by clicking the Stop Debugging button or pressing Shift + F5.
5. Open the project settings by going to Project → <project_name> properties or pressing Alt + F7.
Go to the Toolchain tab on the left menu, as in Figure 2-49.
6. Under AVR/GNU C Compiler → Optimization, set the Optimization Level to None (-O0) using
the drop-down menu.
WARNING
Disabling compiler optimization will result in increased memory consumption and can
result in changes in execution timing. This can be important to consider when debugging
time is a critical code.
7. Launch a new debug session and break code execution inside LED_on().
8. Observe the Call Stack. It should now adhere to how the code is actually written and list
LED_set_state() as the caller of LED_on(), as shown in Figure 2-50.
Figure 2-50. Call Stack Without Optimization
tip: Atmel Studio will try to link the compiled code to the source-code as best it can, but the
compiler optimization can make this challenging. Disabling compiler optimization can help if
breakpoints seem to be ignored during debugging, or if the execution flow is hard to follow
during code stepping.
Result: The call stack has now been examined both with and without optimization enabled.
#include <avr/io.h>
#include <stdbool.h>
#include <avr/interrupt.h>
void LED_on();
void LED_off();
bool SW_get_state();
void LED_set_state(bool SW_state);
int main(void)
{
PORTB.DIRSET = PIN4_bm;
PORTB.OUTSET = PIN4_bm;
PORTB.PIN5CTRL |= PORT_PULLUPEN_bm | PORT_ISC_BOTHEDGES_gc;
sei();
while (1)
{
}
}
void LED_off()
{
PORTB.OUTSET = PIN4_bm; //LED off
}
bool SW_get_state()
{
return !(PORTB.IN & PIN5_bm);
}
/*
void My_mistake()
{
while(1)
{
asm("nop");
}
}
*/
ISR(PORTB_PORT_vect)
{
uint8_t intflags = PORTB.INTFLAGS;
PORTB.INTFLAGS = intflags;
//My_mistake();
LED_set_state(SW_state);
Video: Debugging - 2
To do: Use Atmel Studio to inspect and modify the contents of variables in the code.
1. The code (see below) used is the same as the one developed in section 2.11 Editor: Writing and
Re-Factoring Code (Visual Assist). The SW_get_state() function has just been replaced with the
following code (note also the change in return value type):
uint8_t SW_get_state(void)
{
static uint8_t SW0_prv_state = 0;
static uint8_t SW0_edge_count = 0;
uint8_t SW0_cur_state = !(PORTB.IN & PIN5_bm); /* Read the current SW0 state */
if (SW0_cur_state != SW0_prv_state) /* Check for edges */
{
SW0_edge_count++;
}
SW0_prv_state = SW0_cur_state; /* Keep track of previous state */
/*
* Report the switch as pushed when it is pushed or the edge counter is a
* multiple of 3
*/
return SW0_cur_state || !(SW0_edge_count % 3);
}
Info: This code will count how many times the SW0 push button has been pressed or
released. The return statement has also been modified to always report the button as
pushed if the SW0_edge_count variable is a multiple of three.
2. Go to Debug → Disable All Breakpoints to disable all breakpoints. This should be reflected by all
the checkboxes becoming unchecked in the Breakpoints window.
Info: When the cursor hovers over a variable that is in scope at the point where
execution is halted, Atmel Studio will present the content of the variable in a pop-up.
7. Right-click the SW0_edge_count variable and select Add Watch from the context menu to add the
variable to the data Watch window. The Watch window should appear, with the SW0_edge_count
variable listed, with the variable value, data type, and memory address, as in Figure 2-52.
8. Modify the contents of a Watch Window variable, using the process described below. Assign the
value '3' to the SW0_edge_count variable. The value will reflect as updated by turning red, as
indicated in Figure 2-53.
– Double-click a variable value in the Watch window
– Type in the desired new value of the variable
– Press Enter to confirm
Figure 2-53. Newly Updated Variable Value in the Watch Window
Info: The Value column in the Watch window can be displayed in hex by right-clicking in
the Watch window and selecting Hexadecimal Display from the context menu.
9. To have the device evaluate the new value of SW0_edge_count, disable all breakpoints and
continue the debug session by clicking or pressing F5. Observe how the LED stays ON as a
result of the change made to SW0_edge_count.
Info:
A variable can also be added to the Watch window by clicking on an empty field name and
typing the variable name. This way, it is even possible to cast a variable to a different data type
for better readability in the Watch window. This is especially useful if it is required to look at an
array that is passed to a function as a pointer.
For example, if an array is passed to a function, it will be passed to the function as a pointer.
This makes it impossible for Atmel Studio to know the length of the array. If the length of the
array is known, and it needs to be examined in the Watch window, the pointer can be cast to an
array using the following cast:
*(uint8_t (*)[<n>])<name_of_array_pointer>
Where <n> is the number of elements in the array and <name_of_array_pointer> is the
name of the array to be examined.
This can be tested on the SW0_edge_count variable by entering the following in an empty
name field in the Watch window:
*(uint8_t (*)[5])&SW0_edge_count
Note that the '&' symbol must be used in this case to obtain a pointer to the variable.
Result: Atmel Studio has now been used to inspect and modify the contents of variables in the
code.
1. Clear all breakpoints from the project using the Breakpoints window.
2. Place a breakpoint at the return line of SW_get_state(), as in Figure 2-54.
3. Right-click the breakpoint and select Conditions... from the context menu.
4. Enter the following in the condition textbox:
((SW0_edge_count % 5) == 0) && SW0_cur_state
WARNING
Even though code execution is completely halted only if the specified break condition is met,
Atmel Studio temporarily breaks code execution each time the breakpoint is hit to read the
variable content and determine if the break condition is met. Conditional breakpoints will,
therefore, have an impact on execution timing, even if the actual break condition is never met.
tip: Use the Hit Count condition if execution needs to break based on how many times a
breakpoint has been hit.
Result: Atmel Studio has been used to halt execution when the specified break condition is
satisfied.
1. Stop the ongoing debug session and clear all the breakpoints from the Breakpoints window.
2. Place a breakpoint at the SW0_prv_state = SW0_cur_state; line, as in Figure 2-55.
3. Right-click the breakpoint and select Actions... from the context menu.
4. Enter the following in the output message text box:
Prv state:{SW0_prv_state}, Cur_state:{SW0_cur_state}, Edge count:{SW0_edge_count}
WARNING
When using action breakpoints, Atmel Studio will temporarily halt code execution in order to
read out variable content. As a result, execution timing will be affected. A less intrusive
approach would be to place the action breakpoint at the SW0_edge_count++ line, which is
only executed upon SW0 edge detection. This will cause a temporary halt only when SW0 is
pressed, but will also cause the debug window output to be delayed by one line of code.
tip: Action and Conditional breakpoints can be used together in order to log data only if a
condition is satisfied.
Result: Atmel Studio has been used to log variable data using an action breakpoint.
#include <avr/io.h>
#include <avr/interrupt.h>
void LED_on();
void LED_off();
uint8_t SW_get_state();
void LED_set_state(uint8_t SW_state);
int main(void)
{
PORTB.DIRSET = PIN4_bm;
PORTB.OUTSET = PIN4_bm;
PORTB.PIN5CTRL |= PORT_PULLUPEN_bm | PORT_ISC_BOTHEDGES_gc;
sei();
while (1)
{
}
}
void LED_off()
{
PORTB.OUTSET = PIN4_bm; //LED off
}
uint8_t SW_get_state(void)
{
static uint8_t SW0_prv_state = 0;
static uint8_t SW0_edge_count = 0;
uint8_t SW0_cur_state = !(PORTB.IN & PIN5_bm); /* Read the current SW0 state */
if (SW0_cur_state != SW0_prv_state) /* Check for edges */
{
SW0_edge_count++;
}
SW0_prv_state = SW0_cur_state; /* Keep track of previous state */
/*
* Report the switch as pushed when it is pushed or the edge counter is a
* multiple of 3
*/
return SW0_cur_state || !(SW0_edge_count % 3);
}
ISR(PORTB_PORT_vect)
{
uint8_t intflags = PORTB.INTFLAGS;
PORTB.INTFLAGS = intflags;
LED_set_state(SW_state);
}
Video: Debugging - 3
4. Scroll through the list of peripherals and select I/O Ports (PORTB). Find the OUT register and click
on Bit 4 in the Bits column, so the corresponding square changes color, as depicted in Figure 2-57.
Observe that clicking Bit 4 in the PORTB.OUT register toggles the output level on GPIO pin PB4,
which controls the LED on the ATtiny817 Xplained Pro.
Figure 2-57. Manipulate Bit Value in Register Using I/O View
Info: The I/O view is refreshed after any register has been modified, and all detected
changes are highlighted in red.
tip: Multiple bits can be modified simultaneously by double-clicking the value field and
typing in the desired value to be assigned to the register.
5. Expand the Clock controller (CLKCTRL) in the I/O view, and answer the following questions:
Result: The Clock controller should be configured with the ATtiny817 default clock
settings; the main clock is running from the internal RC oscillator with prescaler enabled
and a division factor of six.
Info: The default clock configuration guarantees that the device will execute code
reliably over the entire supported operating voltage range, 1.8V to 5.5V. The Xplained Pro
kit powers the ATtiny817 at 3.3V. According to the 'General Operating Ratings' section in
the device data sheet, the device can be safely run at 10 MHz with a 3.3V supply.
6. The code will now be changed to run the ATtiny817 at 10 MHz. Modify the start of main() as
below:
int main(void)
{
/*
* Set the Main clock division factor to 2X,
* and keep the Main clock prescaler enabled.
*/
CLKCTRL.MCLKCTRLB = CLKCTRL_PDIV_2X_gc | CLKCTRL_PEN_bm;
7. Start a new debug session in order to recompile the project and program the device.
8. Halt code execution by clicking . Examine the clock settings in I/O view, depicted in Figure 2-58.
Figure 2-58. Clock Settings in I/O View Remain Unchanged
Info: Internet access is required to use the web-based register description. Refer to an
offline version of the ATtiny817 data sheet if internet access is not available.
11. Find out if any access restrictions apply to the MCLKCTRLB register.
12. Replace the line of code, which was just added, with the following:
_PROTECTED_WRITE(CLKCTRL.MCLKCTRLB, CLKCTRL_PDIV_2X_gc | CLKCTRL_PEN_bm);
tip: Right-click the macro name in the code and select Goto Implementation to
navigate to the implementation of the macro. This is also possible by placing the cursor at
the macro name in the code and pressing Alt+G on the keyboard. The same process can
also be used for variable declarations and function implementations.
13. Stop the previous debug session and launch a new session to program the device with the
changes.
14. Break code execution and use the I/O view to verify that the prescaler is now successfully set to
2X, as indicated in Figure 2-60.
Figure 2-60. Clock Settings in I/O View Changed Successfully
tip: The Processor Status window is the register view tool for the AVR Core. This tool can be
opened from the top menu bar by going to Debug → Windows → Processor Status. This
window will provide a detailed view of the status of the internal AVR Core registers. This view
can be used to check if global interrupts are enabled; look for the I-bit in the status register.
Result: The capabilities of the I/O view have been used to find and fix a bug in the project.
To do: Write two strings to the beginning of the ATtiny817 EEPROM and use Memory view to
verify the EEPROM contents.
4. Start a new debug session in order to program the device with the updated code.
5. After the breakpoint has been hit, open the memory window from the top menu bar by going to
Debug → Windows → Memory → Memory 1. Look at the current content of the EEPROM.
6. Push F10 on the keyboard to step over the eeprom_write_block() call and verify the EEPROM
write.
7. Allow the ATtiny817 to execute the next EEPROM write before verifying the write using the Memory
view. The view should appear as in Figure 2-62 at each interval respectively.
Figure 2-62. Memory View Updating After EEPROM Writes
tip: The Memory view tool can also be used to investigate the contents of other AVR
memory sections, including the program memory. This can be useful when debugging
bootloaders.
Result: The content of the EEPROM is updated after each call to eeprom_write_block().
The updated content is highlighted in red, and the ASCII interpretation of the EEPROM content
matches the written strings. Therefore, the contents of EEPROM after writing to it have been
verified using Memory view.
Info: A variable can also be added to the Watch window by clicking on an empty field name
and typing the variable name. This way, it is even possible to cast a variable to a different data
type for better readability in the Watch window. This is especially useful if it is required to look at
an array that is passed to a function as a pointer.
For example, if an array is passed to a function, it will be passed to the function as a pointer.
This makes it impossible for Atmel Studio to know the length of the array. If the length of the
array is known, and it needs to be examined in the Watch window, the pointer can be cast to an
array using the following cast:
*(uint8_t (*)[<n>])<name_of_array_pointer>
Where <n> is the number of elements in the array and <name_of_array_pointer> is the
name of the array to be examined.
This can be tested on the SW0_edge_count variable by entering the following in an empty
name field in the Watch window:
*(uint8_t (*)[5])&SW0_edge_count
Note that the '&' symbol must be used in this case to obtain a pointer to the variable.
Result: Atmel Studio has now been used to inspect and modify the contents of variables in the
code.
void LED_on(void);
void LED_off(void);
void LED_set_state(uint8_t state);
uint8_t SW_get_state(void);
uint8_t SW_get_state_logic(void);
int main(void)
{
PORTB.DIRSET = PIN4_bm; /* Configure LED Pin as output */
PORTB.PIN5CTRL = PORT_PULLUPEN_bm; /* Enable pull-up for SW0 pin */
while(1)
{
uint8_t SW0_state = SW_get_state_logic(); /* Read switch state */
LED_set_state(SW0_state); /* Set LED state */
}
}
uint8_t SW_get_state()
{
return !(PORTB.IN & PIN5_bm);
}
uint8_t SW_get_state_logic(void)
{
static uint8_t SW0_prv_state = 0;
static uint8_t SW0_edge_count = 0;
uint8_t SW0_cur_state = !(PORTB.IN & PIN5_bm); /* Read the current SW0 state */
if (SW0_cur_state != SW0_prv_state) /* Check for edges */
{
SW0_edge_count++;
}
SW0_prv_state = SW0_cur_state; /* Keep track of previous state */
/*
* Report the switch as pushed when it is pushed or the edge counter is a
* multiple of 3
*/
return SW0_cur_state || !(SW0_edge_count % 3);
}
void LED_off(void)
{
PORTB.OUTSET = PIN4_bm; /* Turn LED off */
}
void LED_on(void)
{
PORTB.OUTCLR = PIN4_bm; /* Turn LED on */
}
3. Project Management
3.1 Introduction
Atmel Studio is an Integrated Development Environment (IDE) for writing and debugging applications for
AVR/ARM platforms. Currently, as a code writing environment, it supports the included AVR Assembler
and any external AVRGCC/ARMGCC compiler in a complete IDE environment.
Using Atmel Studio as an IDE gives you several advantages:
1. Editing and debugging in the same application window allows for a faster error tracking.
2. Breakpoints are saved and restored between sessions, even if the code was edited in the
meantime.
3. Project item management is made convenient and portable.
Components that are included in a project are listed in the Component drop-down menu. Selecting a
component from the drop-down menu shows the component version, the files that the component is
contributing with, and the dependencies that the component has.
The version of the component can be changed by clicking the Change version button.
Use a specific version Lock the project to a specific version of the component.
Use the latest version Choose the most recent version of the component that is available.
Components are part of the device packs in Atmel Studio. These device packs are managed using the
Device Pack Manager.
Related Links
6.1 Device Pack Manager
Project types
Currently, several project types are available in the Project Type box. AVR board examples - to guide
you through the usage of the AVR boards, User board project - if you have created your own product with
the AVR tools, and a general AVR GCC project - a board independent project with a GNU compiler. It is
also possible to create an AVR Assembler project and a general AVR Solution, which may include any
supported source code type.
Tip:
Projects can also be created by loading supported object files. If you want to create such a
project, you should use the File → Open file menu.
2. Select C/C++→GCC C Executable Project as a template, then specify a project name, select a
location, and write a solution name for the project. A file with the same name as the project will be
created and added to the project by default. It will contain an empty main() function. If you want to
change the name of the initial file, just edit the main file name afterward. Press OK when you are
satisfied with the settings.
3. Select C/C++→GCC C Static Library Project as a template, then specify a project name, select a
location, and write a solution name for the project. This creates a Static Library (LIB) project, which
is a good way to reuse code.
Tip:
See section 3.2.6 Starting a New GCC Static Library Project to learn more about Static
Library projects.
4. A device selection table will appear. Choose the appropriate target platform for your project. To start
you can select the ATxmega128A1 device.
5. The project tree will be set up. Notice that the initial file created in step 2 has been added to the
project node. Also, the initial file will be opened in the editor.
6. In order to facilitate applications development and verification, you can also use the Driver
Selection Wizard, invoked from Project → ASF Wizard...
In the ASF Wizard you can select which Drivers, Components, and Services you would like to use
in the project for current build architecture and board.
7. Now, write the following code into the open editor window.
#define MAXINT 200000
int main(void)
{
unsigned int t=1000, k=0, l=5, pn=2;
unsigned int primes[t];
primes[0]=2;
primes[1]=3;
Dependencies
All the included files are listed here. Double-click on any file to open it in the editor.
Output Files
All output files will be displayed below this item.
Libraries
All Static Library files, Toolchain Library, and other Library Files will be displayed below this item.
Tip:
See section Library Options to know more about Library options.
Figure 3-7. Libraries
Tip:
Ensure you have static library projects in the current solution.
Right click on Project or Libraries Node in the project to invoke 'Add Library' Wizard.
Select Project Libraries Tab; here you will see all the static libraries in the current solution listed.
Select the Static Library which you would like to add.
Click OK.
Figure 3-8. View of a Project after Adding Libraries
Also, you will see that Project → Project Dependencies Static Library is added.
Figure 3-9. View of a Project Dependencies after Adding Libraries
Click OK.
Figure 3-10. View of a Project after Adding Libraries
You will also be able to see the new library added in the Toolchain Linker Settings.
2. Select C/C++ → GCC C Executable Project as a template, then specify a project name, select a
location, and write a solution name for the project. Some start-up files will be added to the project
by default, which will contain some device specific functions and libraries. Press OK when you are
satisfied with the settings.
3. Select C/C++ → GCC C Static Library Project as a template, then specify a project name, select
a location, and write a solution name for the project. This creates a Static Library (LIB) project,
which is a good way to reuse code.
Tip:
See section Static Library Project to learn more about Static Library projects.
4. A device selection table will appear. Choose the device family as SAM3 or SAM4 and select the
target platform for your project. To start you can select the ATSAM3S1A device.
5. The project tree will be set up. Notice that the initial files created in step 2 have been added to the
project node. Also, the file containing main() function will be opened in the editor.
Here is a list of files that will be created:
– A file with the same name as the project will be created and added to the project by default. It
will contain the main() function.
– A startup file(startup_*.c) will be available at 'cmsis\src' directory. It contains the default
interrupt handlers for all the peripherals.
– A system file(system_*.c) available at 'cmsis\src' provides the system level initialization
functions that are called on start-up
– Linker scripts with appropriate sections based on the device will be created at 'cmsis
\LinkerScripts' directory in the project folder
– In case if you have deleted any files in cmsis folder and want to revert it back or if you have
changed the device, just right click the Project and click 'CMSIS Update from Atmel' to get the
appropriate files.
Note: It is recommended not to change the contents of the startup_*.c and system_*.c files unless
you have no other choice. These startup, system, and linker scripts will not be created for ARM
static library projects.
6. In order to facilitate applications development and verification, you can also use the Driver
Selection Wizard, invoked from Project → ASF Wizard.
In the ASF Wizard you can select which Drivers, Components, and Services you would like to use
in the project for current build architecture and board.
7. Now, write the following code into the open editor window:
#define MAXINT 200000
int main(void)
{
unsigned int t=1000, k=0, l=5, pn=2;
unsigned int primes[t];
primes[0]=2;
primes[1]=3;
int main(void)
{
unsigned int t=1000, k=0, l=5, pn=2;
unsigned int primes[t];
primes[0]=2;
primes[1]=3;
Atmel Studio has a rich editor that is made even richer by Microchip and third-party plugins. Atmel Studio
has an automatic code generation faculty for snippets of C source code. To use it select and right click
the part of the code you wish to enclose in a conditional structure (like for,while,if … etc).
Using the code snippets you can add parts to your core source. In some snippets the variable names and
exit conditions are parametric within the IDE, so as if only one instance is changed all instances within the
snippet will also change, such is the case of for loop.
Table 3-1. Using 'Surround With'
⇒ ⇒
Click OK to create the Static Library project. A default source file with the same name as the project will
be added to the solution. You may then write and compile your routines/functions. You can also add new
source files or header files into the project.
Open the Project Properties on the menu Project → 'Your_project_name Properties'. This menu item
is only available when a Static Library project is open. Select the Build property page. Here you will see
that the Artifact Type is selected as Static Library.
Compile the project by selecting Build Solution from the Build menu. This creates a Static Library, which
can be used by other programs.
3.2.6.3 Static Library Project Options (AVR/GNU Archiver)
The AVR/GNU archiver, avr-ar, combines a collection of object files into a single archive file, also known
as a library.
Open the Project Properties on the menu Project → 'Your_project_name Properties'. This menu item
is only available when a Static Library project is open. In order to configure Static Library options, click on
the Toolchain property tab.
In the Toolchain property page, you will see AVR/GNU Archiver active and enabled. You may also see
that the AVR/GNU Linker is disabled for a static library project.
You can set the AVR/GNU Archiver flags at the Archiver Flags textbox in the above General options.
Now, save the project and compile by selecting Build Solution from the Build menu.
In the Build tab page, you can configure whether you want to use an external Makefile for your project. In
that case, just tick the Use External Makefile checkbox and browse to select the correct path of
makefile.
Build Commandline will be provided to the external makefile when build is invoked for the project. The
default build target is 'all'.
Clean Commandline will be provided to the external makefile when clean is invoked for the project. The
default clean target is 'clean'.
Besides the external makefile configuration, you can also specify the type of application to build. The
options are Executable or Static Library, which can be selected using the Artifact Type combo box.
Note: Custom makefile must fulfill these conditions:
1. Target name must the same as the project name.
2. Makefile and target must exist in the same folder (can be referenced with NTFS links too).
The Build events tab contains a list of scheduled events for each configuration, launched by the pre-
build and post-build scripts. These events can be added, deleted, or modified by clicking either the Edit
pre-build... or Edit post-build... buttons. Upon clicking these buttons, you should manually add your
commands in the following dialog. As of the current release, it is possible to use environment variables
and values declared within them as a link with other available applications. In order to use that function
press the Show Macros button.
Macros
Expands the edit box to display the list of macros/environment variables to insert in the command line edit
box.
Macro Table
List the available macros/environment variables and its value. You can select only one macro at a time to
insert into the command line edit box. MSBuild also provides a set of reserved properties that store
information about the project file and the MSBuild binaries. These properties may also be listed in the edit
box.
See Macros/environment variables below for a description which are specific to Atmel Studio.
Table 3-2. Atmel Studio Build Macro Table
Macro Description
$(AVRSTUDIO_EXE_PATH) The installation directory of Atmel Studio (defined with drive and path)
$(SolutionDir) The directory of the solution (defined with drive and path)
$(SolutionPath) The absolute path name of the solution (defined with drive, path, base
name, and file extension)
$(SolutionExt) The file extension of the solution. It includes the '.' before the file
extension.
$(Configuration) The name of the current project configuration, for example, 'Debug'
$(Platform) The name of the currently targeted platform, for example, 'AVR'
$(DevEnvDir) The installation directory of Atmel Studio (defined with drive and path)
Macro Description
$(ProjectVersion) The version of the project
$(avrdeviceseries) The series of the selected device. Used internally by the Atmel Studio.
$(OutputFileName) The file name of the primary output file for the build (defined as base file
name)
$(OutputFileExtension) The file extension of the primary output file for the build. It includes the '.'
before the file extension
$(AssemblyName) The assembly name of the primary output for the build
Macro Description
Option Description
General options
-mcall-prologues Use subroutines for functions prologues and epilogues
Preprocessor options
-F Preprocess only
Symbols options
Option Description
Symbols in source can be defined (-D) or undefined (-U). New symbol declarations can be added,
modified, or reordered, using the interface buttons below:
•
Add a new symbol. This and all following icons are reused with the same meaning in other
parts of Atmel Studio interface.
•
Remove a symbol.
•
Edit symbol.
•
Move the symbol up in the parsing order.
•
Move the symbol down in the parsing order.
Include directories
Contains all the included header and definition directories, can be modified, using the same interface as
symbols.
Optimization options
Optimization level (drop-down menu): -O0, - No optimization, optimize for speed (level 1 - 3), optimize
O1, -O2, -O3, -Os for size
Other optimization flags (manual input form) Here you should write optimization flags specific for the
platform and your requirements
Debug options
Debug level (drop-down menu): none, -g1, - Specifies the level of tracing and debugging code and
g2, -g3 headers left or inserted in the source code
Option Description
-pedantic Check conformity to GNU, raise warnings on non-
standard programming practice
Miscellaneous options
Other flags (form field) Input other project-specific flags
-v Verbose
Option Description
Option Description
-Wl -nostartfiles Do not use standard files
Libraries options
Libraries -Wl, -l (form field) You can add, prioritize, or edit library names here, using these
buttons: , , , ,
Library search path -Wl,-L (form field) You can add, prioritize or edit path where the linker will search for
dynamically linked libraries, same interface as above
Optimization options
Miscellaneous options
Option Description
Optimization options
Include path (form field) You can add, prioritize or edit path to the architecture
and platform specific included files here
Debugging options
Debugging level (drop down menu) -Wa -g1, - Defines a level of debugging symbol and debugging
Wa, -g2, -Wa, -g3 source insertion
Tip:
Click on the Device button on the Device and Debugger toolbar to get to this tab quickly while
editing.
Tip:
Click on the Device button on the Device and Debugger toolbar to get to this tab quickly while
editing.
Select tool/debugger from the drop-down list. The current selection is shown.
Select Interface from the drop-down list. The current selection is shown.
Note: Only tools and interfaces valid for the current device selection are shown.
Further Properties are dependent on the tool and interface selected.
JTAG
If you have selected JTAG as the programming interface clock speed, use external reset - and daisy-
chain setting may be available. This depends on the tool and device.
JTAG clock
JTAG clock is the maximum speed the tool will try to clock the device at. The clock range is different for
different tools and devices. If there are restrictions, they will be stated in a message below the clock
slider.
The clock can be set to Manual (all tools), Auto (SAM-ICE only), or Adaptive (SAM-ICE only).
Use external reset
If checked, the tool will pull the external reset line low when trying to connect to the device.
JTAG daisy-chain settings
PDI
The PDI interface has only one setting – the PDI clock speed.
PDI Clock is the maximum speed the tool will try to clock the device at. The clock range is different for
different tools and devices. If there are restrictions, they will be stated in a message below the clock
slider.
The clock cannot be adjusted on all tools, so an empty Interface settings page will be presented.
Programming and debug settings
In the drop-down menu, it is possible to specify which parts of memory that should be erased during a
programming/debug cycle.
• Skip programming - specifies that no programming should occur. The tool will try to attach to the
program already in memory.
• Erase only program area - specifies that only the program area of memory should be erased.
• Erase entire chip - specifies that the entire chip is to be erased.
The 'Preserve Eeprom' option lets you decide whether EEPROM data should be written when launching a
debug session. The EESAVE fuse will be set and cleared accordingly.
When a device is programmed at the start of a debug session, the default behavior is to erase the content
of the device (chip erase, if available). This can be changed by selecting a different option from the drop-
down box under 'Programming settings'.
Note: The option 'Use GDB' is enabled by default for ARM-based devices and also the following
warning will be shown for AVR 32-bit devices if GDB is enabled.
#include <avr/io.h>
int main(void)
{
while(1)
{
// TODO:: Please write your application code
}
}
#include <avr/io.h>
int main(void)
{
while(1)
{
// TODO:: Write your application code
}
}
#include <avr/io.h>
int main(void)
{
while(1)
{
//TODO:: Write your application code
}
}
start:
nop
ldi R16, 0xff
sts PORTE_DIR, r16
When a new project is created or an old project is loaded, the project view will be displayed with all the
project files. Files can be added, created, or removed from the project list using the context menu in the
Solution Explorer window.
Figure 3-22. View of an Assembler Project
All the source files will be listed at the end of the list. Double-click on any file to open it in the editor.
All custom include files will be listed directly under the project name item unless you create a new folder
in the project.
Figure 3-23. View of an Assembler Project after Build Completed
Dependencies: All include files are listed here. Double-click on any file to open it in the editor.
Labels: All labels in your assembler program are listed here. Double-click on any item to show its location
in the source. A marker will point to the correct line.
Output Files: All output files will be displayed below this item.
Open With... Right click n Open selected file with another editor or tool
All the interface views are docked by default. You can switch between docked and undocked views by
dragging windows around to a desirable location, or by dragging and dropping a window on a quick
docking menu of the Visual Studio IDE. The quick docking menu will appear every time you start dragging
an interface view or window.
3.3.1.1 Project Context Menu
Several build commands are available from the menu and the toolbars. There is also a context menu for
the project:
Add Ctrl Shift A/Shift Alt A (existing Add new files or existing files to the project
item)
Unload Project Right click l Unload active project files from the IDE
3. All configurations.
Platform menu shows compatible target platforms available for prototyping.
Hex Output format. The following file formats can be selected as additional output format:
1. Intel Hex.
2. Generic Hex.
3. Motorola Hex (S-record).
Wrap relative jumps. The AVR RJMP/RCALL instructions allow a 12-bit PC-relative offset,
corresponding to ±2k words. For devices having 4k words (8 kB) or less FLASH program memory, the
Wrap option causes the assembler's offset calculation to wrap around over the addressable program
memory range, enabling the entire program memory to be addressed using these instructions.
For devices with more than 4k words of program memory, using this option may cause unpredictable
results and it should be turned OFF. If it is left ON, the assembler will produce a warning when wrap takes
effect:
Attention:
Wrap rjmp/rcall illegal for device > 4k words - Turn off wrap option and use jmp/call.
This diagnostic is given as a warning and not an error to retain compatibility with earlier versions of the
assembler, but should be treated as an error by the user. The JMP/CALL 2-word instructions take 22-bit
absolute addresses and should be used instead.
Unsupported Instructions. By default, this option is set to give a warning when the assembler finds
unsupported instructions for the actual device. Optionally, you can output an error.
Include Paths (-I). Additional include paths can be set here when using third-party modules or your own
IP.
Other optimization flags can be set to tailor optimization to your specific needs, see Assembler help for
more information (Help > View Help > AVR Assembler Help).
3.4.1 Introduction
Atmel Studio allows import of projects from several pre-existing project sources. This section details how
to import existing projects.
Atmel Studio will proceed with conversion, giving updates the progress. Warnings and errors will be
shown in the Summary window.
Check Show conversion log after this page is closed to view the complete conversion log.
Click Finish to access your newly converted project.
Note: Currently, conversion only adds a project file and solution file if the Solution Folder is the same as
the APS File Location. No other files will be modified.
Type the name of your workspace or browse to the workspace location by clicking the ... (Browse button)
of the Workspace Tab. Click Find Projects to find all the project files and populate other folders available
in the workspace.
The Available AVR32 C/C++ Projects tab will be populated with all AVR32 C/C++ Projects that can be
imported and it will also display the total number of available projects.
The Invalid AVR32 Projects tab will be populated with all Unsupported AVR32 Projects that cannot be
imported and it will also display the total number of nonconvertible projects along with the reason.
Atmel Studio will proceed with conversion, giving updates the progress. Warnings and errors will be
shown in the Summary window.
Check 'Show conversion log after this page is closed' to view the complete conversion log.
Click Finish to access your newly converted project.
Note:
• The current version of AVR32 Importer supports AVR32 C/C++ Projects
• AP7 device family is currently not supported by Atmel Studio
• Currently, conversion only adds project files and solution file if the Solution Folder is the same as
the Workspace folder. No other files will be modified.
• Pre/Post builds settings are not imported
In the ' Import Project Template ' window, specify the following:
• The location of your project template
• The save location. The combo box will show installed templates that are available in the New
Project → Installed Templates.
Select any template under which you would like to add your template. You can also add your
template at the root by selecting <root> in 'Add to folder'.
• You can create a separate folder by specifying the name of the folder under the specified 'Add to
Folder (Optional)', where you want to add your project template.
The resulting project template will be added to the existing installed templates and can be accessed from
File → New → Project .. or Ctrl+Shift+N.
Note: 'Import Project Template Importer' will work with a template created for the same version.
3.5.1 Introduction
Debug session requires you to load an object file which is supported by Atmel Studio. The debug file
contains symbolic information for debugging.
UBROF .d90 UBROF is an IAR proprietary format. The debug output file contains a
complete set of debug information and symbols to support all types of
watches. UBROF8 and earlier versions are supported. This is the default
output format of IAR EW 2.29 and earlier versions. See below how to force
IAR EW 3.10 and later versions to generate UBROF8.
ELF/DWARF .elf ELF/DWARF debug information is an open standard. The debug format
supports a complete set of debug information and symbols to support all
AVRCOFF .cof COFF is an open standard intended for 3rd party vendors creating
extensions or tools supported by the Atmel Studio.
AVR Assembler .obj The AVR assembler output file format contains source file info for source
format stepping. It is a Microchip internal format only. The .map file is
automatically parsed to get some watch information.
Before debugging, make sure you have set up your compiler/assembler to generate a debug file like one
of the formats above. 3rd party compiler vendors should output the ELF/DWARF object file format.
• – In the Select the object file to debug, select your object file to debug. The object file must
be supported by Atmel Studio.
– In the Project Name, type a name for the project. Atmel Studio will suggest a name, which
you can override if wanted.
– In the Location, select a save location. Atmel Studio will suggest a name, which you can
override if wanted.
– Maintain Folder Hierarchy for Source Files option is selected by default which would create
a similar folder structure in the Solution Explorer as that of the source project i.e. the project
used to create the object file. Otherwise, all the files are added to the root folder of the project
file i.e. the user would not see any folder in the Solution Explorer.
– Add File As Link option is selected by default in which the object project shall refer the files
from its original location without a local copy into the project directory. If the option is not
selected, Atmel Studio would copy the files into the object project directory.
• Click Finish. The object project files re-mapper appears (see screen-shot below). This dialog
enables you to remap the location of the project files.
If the user resolves the parent folder for any original file, all other files in the subsequent directory
will be remapped recursively. So, it is useful for the user to remap the number of files by just
remapping only one.
• Now the Object Project is Created. The files that are not remapped properly are shown in solution
explorer like 'libgcc.S', with a warning sign. Press F5 to debug this Project.
4. Debugging
4.1 Introduction
Atmel Studio can be targeted towards the built-in Simulator, or a variety of tools (see 6.3 Available Tools
View), for example, AVR ONE!, JTAGICE mkII, or JTAGICE3 (bought separately).
To start a debug session and keep executing, press F5 or press the toolbar button with the continue
symbol, or choose Debug → Continue from the menu as illustrated below:
Figure 4-2. Starting a Debug Session
Attention:
Physically connecting a debug probe to a target might cause the target to reset, as most debug
probes need an electrical connection to the reset line of the device. Normal electrical
precautions need to be taken to avoid this.
by selecting Debug → Start without Debugging from the menu, or press the button on the toolbar.
Figure 4-3. Start without Debugging
This will build the solution (if any changes are made) and program the target device without starting a
debug session.
Start without Debugging uses the tool and interface settings specified in the project options. This is
different from what takes place when using the stand-alone Programming Dialog, which is not related to
the project at all.
Note: Programmers and starter kits can also be used with the Start without Debugging command, not
only debuggers.
The Start without Debugging command will also program the EEPROM, fuses, lockbits, and user
signature (XMEGA only) segments if they are present in the object file. The GCC compiler can generate
ELF object format files with such segments. See 3.2.7.7 Creating ELF Files with Other Memory Types for
more information.
Note: The user signature is not erased by Start without Debugging. The programmed user signature
from the ELF file will be AND-ed with the content in the device. If you want to replace the signatures with
what is in the file, you must perform a user signature erase manually.
Note: Some debug commands are available in design mode, some in debug mode.
• In design mode, the available debug commands are those that will start the debug session, e.g.
Start Debugging and Break, Start Debugging, Start without Debugging.
• In debug mode, you will find commands like Break All, Step Out, and Reset.
Start Debugging and Starts the debugger and breaks the execution on the first statement of the
Break program.
Start Debugging Starts the debugger and runs the program. In debug mode and stopped, it
resumes execution.
Start Without Programs the project without starting debugging. For details, see 4.5 Start
Debugging without Debugging.
Stop Debugging Stops and terminates the debug session, and returns to design mode.
Disable debugWire Available when debugging a device using the debugWire interface. The
and Close command disables the debugWire interface (enabling the use of the ISP
interface) and terminates the debug session.
Step Into Executes one instruction. When in disassembly level, one assembly level
instruction is executed, otherwise, one source level instruction is executed.
Step Over Similar to Step Into, Step Over executes one instruction. However, if the
instruction contains a function call/subroutine call, the function/subroutine is
executed as well. If a user breakpoint is encountered during Step Over,
execution is halted.
Step Out Continue execution until the current function has completed. If a user
breakpoint is encountered during Step Over, execution is halted. If a Step Out
command is issued when the program is on the top level, the program will
continue executing until it reaches a breakpoint or it is stopped by the user.
Quick Watch Adds a Quick Watch for the variable or expression under the cursor. For
details, see 4.9.4 QuickWatch and Watches.
Toggle Breakpoint Toggle the breakpoint status for the instruction where the cursor is placed.
Note that this function is available only when the source window or
disassembly window is the active view.
New Breakpoint Create a new breakpoint at the location of the cursor. For more information,
see 4.7 Breakpoints.
Disable All This function clears all set program breakpoints, including breakpoints which
Breakpoints have been disabled.
Clear All DataTips Clear all marked Data Tips. For more information, see 4.10 DataTips.
Export Data Tips Save all marked Data Tips to a file in Visual Studio Shell format.
Import DataTips Load Data Tips from a Visual Studio Shell file.
Options and Settings Debug options and settings, see 9.3.5 Debugger.
4.7 Breakpoints
Glyph Description
Normal breakpoint. The solid glyph indicates that the breakpoint is enabled. The hollow glyph
indicates that it is disabled.
Advanced breakpoint. Active/disabled. The + sign indicates that the breakpoint has at least one
advanced feature (such as condition, hit count, or filter) attached to it.
Breakpoint error. The X indicates that the breakpoint could not be set because of an error
condition.
Breakpoint warning. The exclamation mark indicates that a breakpoint could not be set because
of a temporary condition. Usually, this means that the code at the breakpoint or tracepoint
location has not been loaded. It can also be seen if you attach to a process and the symbols for
that process are not loaded. When the code or symbols are loaded, the breakpoint will be
enabled and the glyph will change.
In a source, Disassembly, or Call Stack window, right click a line that contains a breakpoint glyph
and then click Location from Breakpoints on the right click menu.
Note:
In a source window, you might have to right click the exact character where the breakpoint is set.
This is necessary if the breakpoint is set on a specific character within a line of source code.
4.7.2.4 Hit Count Keeps Track of How Many Times a Breakpoint is Hit
By default, execution breaks every time that a breakpoint is hit. You can choose to:
• Break always (the default)
• Break when the hit count equals a specified value
• Break when the hit count equals a multiple of a specified value
• Break when the hit count is greater than or equal to a specified value
If you want to keep track of the number of times a breakpoint is hit but never break execution, you can set
the hit count to a very high value so that the breakpoint is never hit.
The specified hit count is retained only for the debugging session. When the debugging session ends, the
hit count is reset to zero.
4.7.2.5 To Specify a Hit Count
1. In the Breakpoints window, right click a breakpoint and then click Hit Count on the right click menu.
—or—
In a source, Disassembly, or Call Stack window, right click a line that contains a breakpoint, and
then click Hit Count from the Breakpoints sub-menu on the right click menu.
2. In the Hit Count dialog box, select the behavior you want from the When the breakpoint is hit list.
If you choose any setting other than Break always, a text box appears next to the list. Edit the
integer that appears in the text box to set the hit count you want.
3. Click OK.
4.7.2.6 To Enable or Disable a Single Breakpoint
In a source, Disassembly, or Call Stack window, right click a line that contains a breakpoint glyph, point to
Breakpoint, then click Enable Breakpoint or Disable Breakpoint.
—or—
In the Breakpoints window, select or clear the checkbox next to the breakpoint.
To enable or disable all breakpoints
From the Debug menu, click Enable All Breakpoints.
4.7.2.7 To Delete a Breakpoint
In the Breakpoints window, right click a breakpoint, and then click Delete on the right click menu.
—or—
In a source window or a Disassembly window, click the breakpoint glyph.
4.7.2.8 To Delete all Breakpoints
From the Debug menu, click Delete All Breakpoints.
Confirmation Prompt
When you delete all breakpoints, a prompt requesting confirmation of the action might appear, depending
on options settings.
You can open the Breakpoints window from the Debug menu.
4.7.3.4 To Export all Breakpoints that Match the Current Search Criteria
In the Breakpoints window toolbar, click the Export all breakpoints matching current search criteria icon.
1. The Save As dialog box appears.
2. In the Save As dialog box, type a name in the File name box.
3. This is the name of the XML file that will contain the exported breakpoints. Note the folder path
shown at the top of the dialog box. To save the XML file to a different location, change the folder
path shown in that box, or click Browse Folders to browse for a new location.
4. Click Save.
2. Right click the selected breakpoints, and then click Edit labels.
3. The Edit breakpoint labels dialog box appears.
4. In the Choose among existing labels box, clear the checkboxes for labels that you want to
remove from the selected breakpoints.
4.7.3.13 To Sort the Breakpoint List by Label
1. In the Breakpoints window, right click the breakpoint list.
2. Point to Sort by and then click Label.
(Optional) To change the sort order, right click the breakpoint list again, point to Sort by, and then click
Sort Ascending or Sort Descending.
Icon Description
Normal breakpoint. The solid glyph indicates that the breakpoint is enabled. The hollow glyph
indicates that it is disabled.
Advanced breakpoint. Active/disabled. The + sign indicates that the breakpoint has hit count
attached to it.
Tracepoint. Active/disabled. Hitting this point performs a specified action but doesn't break
program execution.
Icon Description
Advanced tracepoint. Active/disabled. The + sign indicates that the tracepoint has hit count
attached to it.
Breakpoint or tracepoint error. The X indicates that the breakpoint or tracepoint couldn't be set
because of an error condition. Check Message column for more details on the error message.
Breakpoint or tracepoint is set but with a warning. Check Message column for more details on
the warning message.
This window provides configuration options related to data breakpoint for ATmega devices. Address mask
is optional.
Location
You can enter a specific address in RAM (e.g.: 0x8004) directly or an expression that evaluates to an
address in RAM (e.g.: &x). Make sure the expression you enter represents the address of the data to
monitor.
Note: Data breakpoints on local variables can result in false hits due to reuse of stack memory.
Suggestion to declare it as static for debugging purpose.
Access Mode
You can configure the breakpoint to break on a specific Access Mode. Three types of access modes are
supported:
• Read - Program breaks on read at a specified location.
• Write (Default) - Program breaks on write at a specified location.
• Read/Write - Program breaks on read or write at a specified location.
Address Mask
Address Mask on Mega Data Breakpoints is optional. Use address mask to break on more than one
address or a range of addresses on particular access.
Mask Mask value to mask the Location address to define more than one address or range of
addresses. Bits with value 1 in the mask are significant bits and 0 are don't care bits.
In general, for a given address A and mask M, an address B successfully matches when:
(A) & (M) == (B) & (M), where A is resolved address for the expression entered in Location,
M is mask value entered in Mask and B is any address in RAM.
Masked This is a read-only field which shows the range of matching addresses on which the
Address program can break. The masked address is shown in the binary format for simplicity. 'X'
represents don't care bits, remaining bits are expected to match.
E.g. 0b000000010XX000XX means it can break as per access mode, at addresses which
have all bits as per this string except X bits. In this case 0th, 1st, 5th, and 6th bit (LSb) can be
anything since these bits are don't care (X).
This window provides configuration options related to data breakpoint for XMEGA devices.
Location
You can enter a specific address in RAM (e.g.: 0x8004) directly or an expression that evaluates to an
address in RAM (e.g.: &x). Make sure the expression you enter represents the address of the data to
monitor.
Note: Data breakpoints on local variables can result in false hits due to reuse of stack memory.
Suggestion to declare it as static for debugging purpose.
Access Mode
You can configure the breakpoint to break on specific Access Mode. Three types of access modes are
supported:
• Read - Program breaks on read at a specified location.
• Write (Default) - Program breaks on write at a specified location.
• Read/Write - Program breaks on read or write at a specified location.
Data Match
Use the Data Match option to configure Data Breakpoint to compare the data at a specified location
based on one of the following conditions:
• Location content is equal to the value
• Location content is greater than the value
• Location content is less than or equal to the value
• Location content is within the range
• Location content is outside the range
• Bits of the location is equal to the value
Note: Bit Mask: This is an 8-bit value where bits with '1' are significant and the bits with '0' are
don't care.
In general, for a given value V and bit mask M, the break event is triggered when the value in the
location field VL satisfies the following condition:
(V) & (M) == (VL) & (M)
For example, using Value = 0xA0 and Bit Mask = 0xF0 will trigger a break event when the
location field has any of the values between 0xA0 to 0xAF.
Note: The Condition Value field has to be 1 byte.
This window provides configuration options related to data breakpoint for UC3 devices.
Location
You can enter a specific address in RAM (e.g.: 0x8004) directly or an expression that evaluates to an
address in RAM (e.g.: &x). Make sure the expression you enter represents the address of the data to
monitor.
Note: Data breakpoints on local variables can result in false hits due to reuse of stack memory.
Suggestion to declare it as static for debugging purpose.
Access Mode
You can configure the breakpoint to break on a specific Access Mode. Three types of access modes are
supported:
• Read - Program breaks on read at a specified location.
• Write (Default) - Program breaks on write at a specified location.
• Read/Write - Program breaks on read or write at a specified location.
Access Size
You can configure the breakpoint to break on a specific Access Size. Four types of access size are
supported:
• Any Access (Default) - Program breaks on any access size at a specified location.
• Byte Access - Program breaks on Byte access at a specified location.
• HalfWord Access - Program breaks on HalfWord access at a specified location.
• Word Access - Program breaks on Word access at a specified location.
Code:
1: int word = 0;
2: short *halfWord = (short*)&word;
3:
4: int main(void)
5: {
6: word = 0xAABBCCFF;
7: *halfWord = 0xDDEE;
8: }
For the above configuration and code, program breaks at line eight after halfWord
access.
Data Match
Use the Data Match option to configure Data Breakpoint to compare the data at a specified location with
a 32-bit value. Break event is triggered by a successful match.
Value 32-bit (4-byte) value to compare with data at Location address. The value can be decimal or
hexadecimal (e.g.: 100 or 0x64). Based on Access Size, respective bytes are used for data
comparison. For example, if you select 'HalfWord Access' as Access Size and enter
0xAABBCCDD as Value, then only the last two bytes (0xCCDD) are used for data comparison.
Further, you could refine the Value by specifying Mask.
Mask Each checkbox controls the significance of respective byte in the Value field. Select the
(Byte) appropriate checkbox to mask specific byte in the Value field. The number of checkboxes
displayed is decided based on Access Size. Four checkboxes (one per byte) are displayed
for 'Any' and 'Word Access', two checkboxes for 'HalfWord Access', and one checkbox for
'Byte Access'.
Match A read-only field, which displays masked value based on Access Size, Value, and Mask
Value (Byte) field. A masked byte is represented as 'XX', which means that byte is insignificant in
data comparison.
Provides the configuration options related to data breakpoint for SAM devices. Address mask and Data
match are optional.
Location
You can enter a specific address (e.g.: 0x8004) directly or an expression that evaluates to an address
(e.g.: &x). Make sure the expression you enter represents the address of the data to monitor.
Note: Data breakpoints on local variables can result in false hits due to reuse of stack memory.
Suggestion to declare it as static for debugging purpose.
Access Mode
You can configure the breakpoint to break on a specific Access Mode. Three types of access modes are
supported:
• Read - Program breaks on read at a specified location.
• Write (Default) - Program breaks on write at a specified location.
• Read/Write - Program breaks on read or write at a specified location.
Address Mask
Use this setting to define the range of addresses to monitor for access.
Byte Count You can enter a number of address locations to monitor starting at the Location address.
The actual range of monitored addresses can be wider than the expected range. E.g.: if
the Location is 0x23FA and the Byte Count is 5, then the actual range of the monitored
addresses is [0x23F8 to 0x23FF]. The way the actual range is computed is by calculating
the number of least significant bits that have to be masked in the Location address
(0x23FA) in order to cover the expected range [0x23FA to 0x23FA + 5]. In this case, the
number of bits to be masked is three. As a result, the actual range [0x23F8 to 0x23FF] is
wider than the expected range [0x23FA to 0x23FF].
Mask Size This is a read-only field, which displays the number of least significant bits masked in the
Location address. Mask Size is calculated based on the Byte Count and Location
addresses.
Address This is a read-only field, which displays the actual range of address monitored for access.
Range Range is closed interval including both minimum and maximum address.
Data Match
Use the Data Match option to configure Data Breakpoint to compare the data at a specified location with
a 32-bit value. The Break event is triggered by a successful match.
Value 32-bit (4-byte) value to compare with data at the Location address. The value can be
decimal or hexadecimal (e.g.: 100 or 0x64). You could further refine the Value by specifying
Mask.
Mask You can use Mask to extract the appropriate bytes from Value to use for data comparison.
E.g.: if the Value is 0xAABBCCDD and Mask is HalfWord, then the last two bytes (0xCCDD)
are extracted from Value and used for data comparison. This means data comparison would
succeed for the following matches 0xXXXXCCDD, 0xXXCCDDXX, and 0xCCDDXXXX, where X
is a don't care hexadecimal digit (0 to F). Three types of Mask's are supported:
• Byte - Last byte extracted from Value is used for data comparison.
• HalfWord - Last two bytes extracted from Value is used for data comparison.
• Word (Default) - Whole four bytes from Value is used for data comparison.
• 0xAAXXXXXX
The above configuration window is displayed for any device architecture when a simulator tool is
selected.
Location
You can enter a specific address in RAM (e.g.: 0x8004) directly or an expression that evaluates to an
address in RAM (e.g.: &x). Make sure the expression you enter represents the address of the data to
monitor.
Note: Data breakpoints on local variables can result in false hits due to reuse of stack memory.
Suggestion to declare it as static for debugging purpose.
Access Mode
You can configure the breakpoint to break on a specific Access Mode. Three types of access modes are
supported:
• Read - Program breaks on read at a specified location.
• Write (Default) - Program breaks on write at a specified location.
• Read/Write - Program breaks on read or write at a specified location.
Byte Count
You can enter a number of address locations to monitor starting at the Location address.
Note:
• The Simulator supports an unlimited number of data breakpoints
4.8.2.7 How to: Specify a Data Breakpoint Hit Count
Hit count
The number of times the value stored in the specified memory location is accessed (read/write).
To specify a hit count
To specify or edit the Hit Count property, you must open the Hit Count Dialog Box.
In Data Breakpoints window, select a breakpoint row, and then choose Hit Count on the context menu.
Figure 4-8. Hit Count Dialog Box
If you choose any option other than the default in When the breakpoint is hit list control, an edit box
appears next to it. Edit the value in this edit box to set the hit count value. For example, you might choose
break when hit count is equal to and enter 5. This causes execution to stop the 5th time the breakpoint is
hit, not on any other hit.
4.8.2.8 When Breakpoint is Hit Dialog Box
With this dialog box, you can print a message in the output window when a data breakpoint is hit.
To open the When Breakpoint Is Hit Dialog Box, go to the Data Breakpoints window, select a
breakpoint row, and then choose When Hit on the context menu.
Data breakpoints on local variables can result in false hits due to reuse of stack memory.
Tip:
Declare local variables as static and provide the static variable's address in the location
field, the address of the static variable is fixed during compilation/linking.
• Global variables are initialized with default values during the start-up, the valid data breakpoint for
global variables will hit in the disassembly or initialization code during the start-up
• There can be several instructions to perform read/write data for a variable, for example, 'int' data
type can have two individual bytes read/write instructions so the data breakpoint hits twice for the
same variable
• Data breakpoint event can occur when the bus access happens for the specific address
• Maximum number of data breakpoint supported: (this may vary based on specific device/family
refer data sheet)
On the Debug menu, choose Windows, then choose the name of the variable window you want to display
(Autos, Locals, Watch, or Watch1 through Watch4).
You cannot access these menu items or display these windows in design mode. To display these menu
items, the debugger must be running or in break mode.
The Watch window and QuickWatch dialog box are places where you can enter variable names and
expressions that you want to watch during a debugging session.
The QuickWatch dialog box enables you to examine a single variable or expression at a time. It is useful
for taking a quick look at one value or a larger data structure. The Watch window can store several
variables and expressions that you want to view over the course of the debugging session. Atmel Studio
has multiple Watch windows, which are numbered Watch1 through Watch4.
A variable name is the simplest expression you can enter. If you are debugging native code, you can use
register names as well as variable names. The debugger can accept much more complex expressions
than that, however. For example, you could enter the following expression to find the average value of
three variables:
(var1 + var2 + var3) / 3
The debugger accepts most valid language expressions in a Watch window. For more information, see
4.9.5 Expression Formatting.
If you are programming in native code, you may sometimes need to qualify the context of a variable name
or an expression containing a variable name. The context means the function, source file, and module
where a variable is located. If you have to do this, you can use the context operator syntax.
Expressions that Affect the State of Your Program
Evaluating some expressions can change the value of a variable or otherwise affect the state of your
program. For example, evaluating the following expression changes the value of var1:
var1 = var2
Expressions that change data are said to have side effects. If you enter an expression that has a side
effect into the Watch window, the side effect will occur every time the expression is evaluated by the
Watch window. This can produce unexpected results if you are unaware that the expression has side
effects. An expression that is known to have side effects is only evaluated one time when you first enter it.
Subsequent evaluations are disabled. You can manually override this behavior by clicking an update icon
that appears next to the value.
Unexpected side effects are frequently the result of function evaluation. For example, you could enter the
following function call into the Watch window:
PrintFunc1(var1)
Func1(var1)
If you call a function from the Watch window or QuickWatch, the function you are calling might change
data, creating a side effect. One way to avoid possible unexpected side effects from function evaluation is
to turn OFF automatic function evaluation in the Options dialog box. This disables automatic evaluation of
newer language features, such as properties. However, it is safer.
Note: When you examine an expression in the Watch window, you might see an update icon, which
resembles two green arrows, circling in opposite directions within a green circle. This is especially likely if
you have turned OFF automatic function evaluation. The update icon indicates an error or out-of-date
value.
The Atmel Studio debugger automatically expands common data types to show their most important
elements. You can also add expansions for custom data types.
Note: The dialog boxes and menu commands you see might differ from those described in Help
depending on your active settings or edition. To change your settings, choose Import and Export
Settings on the Tools menu. For more information, see 9. Menus and Settings.
To evaluate an expression in the Watch window
1. In the Watch window, click an empty row in the Name column. The debugger must be in break
mode at this point. Type or paste the variable name or expression you want to watch.
—or—
Drag a variable to a row in the Watch window.
2. Press ENTER.
3. The result appears in the Value column. If you type the name of an array or object variable, a tree
control appears next to the name in the Name column. Expand or collapse the variable in the Name
column.
4. The expression remains in the Watch window until you remove it.
To evaluate an expression in QuickWatch
1. In the QuickWatch dialog box, type or paste the variable, register, or expression into the Expression
text box.
2. Click Reevaluate or press ENTER.
3. The value appears in the Current value box.
4. If you type the name of an array or object variable in the Expression box, a tree control appears
next to the name in the Current value box. Expand or collapse the variable in the Name column.
To reevaluate a previous expression in QuickWatch
1. In the QuickWatch dialog box, click the down arrow that appears to the right of the Expression box.
2. Choose one of the previous expressions from the drop-down list.
3. Click Reevaluate.
Attention:
Editing floating-point values can result in minor inaccuracies because of decimal-to-binary
conversion of fractional components. Even a seemingly harmless edit can result in changes to
some of the least significant bits in the floating-point variable.
Attention:
Editing floating-point values can result in minor inaccuracies because of decimal-to-binary
conversion of fractional components. Even a seemingly harmless edit can result in changes to
some of the least significant bits in the floating-point variable.
more variables, you do not want to clutter the Watch window with such calculations. That is when the
QuickWatch dialog box is especially useful.
Another feature of the QuickWatch dialog box is that it is resizeable. If you want to examine the
members of a large object, it is frequently easier to expand and examine the tree QuickWatch than it is in
the Watch, Locals, or Autos window.
The QuickWatch dialog box does not allow you to view more than one variable or expression at a time.
Also, because QuickWatch is a modal dialog box, you cannot perform operations such as stepping
through your code while QuickWatch is open. If you want to do these things, use the Watch window
instead.
Some expressions have side effects that change the value of a variable or otherwise change the state of
your program when they are executed. Evaluating an expression in the QuickWatch dialog box will have
the same effect as executed the expression in your code. This can produce unexpected results if you do
not consider the side effects of the expression.
Note: In Atmel Studio, you can view a variable's value by placing the cursor over the variable. A small
box called a DataTip appears and shows the value.
To open the QuickWatch dialog box
While in break mode, choose QuickWatch on the Debug menu.
To open the QuickWatch dialog box with a variable added
While in break mode, right click a variable name in the source window name and choose QuickWatch.
This automatically places the variable into the QuickWatch dialog box.
To add a QuickWatch expression to the Watch window
In the QuickWatch dialog box, click Add Watch.
Whatever expression that was displayed in the QuickWatch dialog box is added to the list of expressions
in the Watch window. The expression will normally be added to the Watch1 window.
io, eeprom, fusebytes, lockbytes, signature, Memory types with same names
usersign, prodsign
4.10 DataTips
DataTips provide a convenient way to view information about variables in your program during
debugging. DataTips work only in break mode and only with variables that are in the current scope of
execution.
In Atmel Studio, DataTips can be pinned to a specific location in a source file, or they can float on top of
all Atmel Studio windows.
2. The DataTip disappears when you remove the mouse pointer. To pin the DataTip so that it remains
open, click the Pin to source icon, or
– Right click on a variable, then click Pin to source
Assembly-language instructions consist of mnemonics, which are abbreviations for instruction names,
and symbols that represent variables, registers, and constants. Each machine-language instruction is
represented by one assembly-language mnemonic, usually followed by one or more variables, registers,
or constants.
Because assembly code relies heavily on processor registers or, in the case of managed code, common
language runtime registers, you will often find it useful to use the Disassembly window in conjunction with
the Registers window, which allows you to examine register contents.
Note: You may see inconsistencies in instructions that work on explicit addresses. This stems from the
historic difference between the AVR Assembler and Assembly Language and the GCC Assembler and
the assembly used on bigger computer systems. You might, therefore, encounter disassemblies that look
like the one below.
13: asm volatile ("JMP 0x0001778A");
0000007D 0c.94.c5.bb JMP 0x0000BBC5 Jump >
Here, the assembly instruction JMP 0x0001778A is being assembled by the GCC Assembler and
disassembled using the built-in disassembler in Atmel Studio, which resolves the jump to 0x0000BBC5,
which is exactly half of the address in the initial assembly.
It should be noted that the addresses are always of the same dimension as the line addresses shown in
the disassembly, so the code is functionally similar.
The default view of the tool window is a vertically split window with peripheral groups in the top section
and registers in the bottom section. Each peripheral typically has a set of defined settings and value
enumerations, which can be displayed by expanding a register in the peripheral view (top section). The
register view (bottom section) will display all registers which belong to a selected peripheral group. If no
peripheral is selected, the view is empty. Each register can also be expanded to display the pre-defined
value groupings which belong to the register.
Debug → Processor View. The processor view offers a simulated or direct view of the current target
device MPU or MCU. On the picture above you can see a partial list of the simulated device's
ATxmega128U1 registers.
The program counter shows the address of the instruction being executed. The stack pointer shows the
application's current stack pointer value. The X, Y, and Z registers are temporary pointers that can be
used in indirect passing or retrieving arguments or objects to and from functions. The Cycle counter
counts the cycles elapsed from the simulation’s start. Status register or SREG shows the currently set
flags. Further on you will be able to toggle a setting for displaying the flag names.
The stopwatch field allows you to make rudimentary profiling of your application. It is influenced by the
frequency set in the Frequency field, which defines the target MCU/MPU frequency, in the case when the
prototyping board is connected.
Each register can be displayed in hexadecimal, decimal, octal, and binary (flag) format by right clicking
and choosing Display in binary, etc., or Display in.... Each field can also be modified as shown in the
below image. If a field is a status or flags register, composed of a number of the one-bit flags, you can
toggle individual flags by clicking on them - .
Along with function name, optional information such as module name, line number, etc. may also be
displayed. The display of this optional information can be turned ON or OFF. To switch ON/OFF the
optional information displayed, right click the Call Stack window and select or deselect Show <the
information that you want>
Stack frame of the current execution pointer is indicated by a yellow arrow. By default, this is the frame
whose information appears in the source, Disassembly, Locals, Watch, and Auto windows. The stack
frame context can also be changed to be another frame displayed in the Call Stack window.
WARNING
Call Stack may not show all the call frames with Optimization levels -O1 and higher.
A green arrow with a curly tail indicates the changed stack context. The execution pointer remains
in the original frame, which is still marked with the yellow arrow. If you select Step or Continue from
the Debug menu, the execution will be continued from the yellow arrow, not the frame you selected.
UBROF .d90 UBROF is an IAR proprietary format. The debug output file contains a
complete set of debug information and symbols to support all types of
watches. UBROF8 and earlier versions are supported. This is the default
output format of IAR EW 2.29 and earlier versions. See below how to force
IAR EW 3.10 and later versions to generate UBROF8.
ELF/DWARF .elf ELF/DWARF debug information is an open standard. The debug format
supports a complete set of debug information and symbols to support all
types of watches. The version of the format read by Atmel Studio is
AVRCOFF .cof COFF is an open standard intended for 3rd party vendors creating
extensions or tools supported by the Atmel Studio.
AVR Assembler .obj The AVR assembler output file format contains source file info for source
format stepping. It is a Microchip internal format only. The .map file is
automatically parsed to get some watch information.
Before debugging, make sure you have set up your external compiler/assembler to generate an object file
with debug information in one of the formats above.
3rd party compiler vendors should output the ELF/DWARF object file format to ensure support in Atmel
Studio. Optionally, you could provide an extension to have both debugging and compile support. See 1.4
Contact Information for more information.
Tip:
How to generate AVR-compatible ELF file in IARW32:
In the Project options → Output format dialog, choose elf/dwarf, and in the Project options
→ Format variant, select ARM-compatible '-yes'.
Tip:
How to force IAR EW 3.10 and later versions to generate UBROF8:
By default IAR EW 3.10 and later versions output UBROF9. Currently, Atmel Studio cannot read
this format. To force the debug format to UBROF8, open the project options dialog and change
the Output format setting to ubrof 8 (forced). Note that the default file name extension is
changed from '.d90' to '.dbg' when selecting this option. To keep the '.d90' extension, click the
Override default check button and change the extension.
4.18 Trace
In Atmel Studio, the Trace is provided on a plug-in basis. This means that different plugins separate from
the core of Atmel Studio will be the provider of the different graphics view to visualize Trace.
In the realm of the Trace, there is some terminology that describes the different Trace sources that a
device and tool combination supports. These high-level source names are mapped to different
architecture specific Trace sources.
The following sections will describe some of the high-level Trace sources that might be available, and
how it is mapped to the target architecture. Only a high-level description of the different sources will be
given, as the device-specific details are available in the respective data sheet.
Note: The architecture for discovering Trace capabilities in Atmel Studio is based on what the chip itself
reports. This means that a debug session needs to be running so that the capabilities can be probed.
This means that when activating a Trace source, Atmel Studio might fail if the device does not support the
source that was asked for during launch.
4.18.1.1 ITM
ITM is an optional part of the debug system on ARM cores. The module provides a set of registers that an
application can write data to, that will be streamed out to the debugger.
Note that the Output window does not have the “IDR Messages” drop-down if no IDR events have been
sent from the debugger.
As not all Cortex implementation can emit the program counter, Atmel Studio also supports doing a
periodical readout of the program counter while the core is running. This is possible as most Cortex
devices support readout of memory while the core is running, with a small impact on the running
application as the debug system needs to access the memory bus.
Note: Only the compilable lines are taken into consideration. For example, lines with comments and
variable declaration are ignored.
4.19.1.5 Trace View Settings
The device has to be configured to record the trace information in SRAM. The allocated size for recording
the program trace can be configured from this setting. The memory can be allocated in:
• Source code, allocating a global array
• Linker scripts, reserving an amount of the memory map
Select the memory size to be allocated for recording the program trace. Copy the snippet of code
displayed in configuration window by clicking on the CopyToClipBoard button and paste into your source
code. Follow the instructions given in the dialog to enable the tracing capability.
Note: If both the linker script and the source code is configured for trace, the linker script settings takes
the higher precedence over source code settings.
• Repeat Count - Represents the number of times the same source and destination combination
occurred consecutively. For example, if there is a delay which is logging the same packets, it will be
grouped together and number of times record occurrence is termed as repeat count.
The source and destination contain instruction address, function name, source file name, and line
number. If the source line cannot be mapped only the instruction address is given. Double-clicking on the
source or destination navigates the cursor in the editor to the appropriate line. Navigation keys Up, Down,
Left, Right, and Tab can be used to locate the source/disassembly view for the trace records.
The program trace that is shown in the TraceStack view is cut down to the latest 20,000 records by
default. The threshold value can be changed using the slider.
The program trace records are highlighted with a yellow color when the branching instruction was not an
expected one. Unexpected branches usually happen due to some exception, and the entry and exit of the
exception handler are highlighted with yellow color. The branching inside the exception is not highlighted.
Figure 4-15. Exception Record
Tip:
The next and previous exception records can be easily navigated to by using the up and down
arrow buttons in the trace view window toolbar.
There are some exceptional cases where some program traces could be missed. In that case, there will
be a packet with red color which represents that there is some discontinuation of the program trace
information in the sequence. Since the number of missed packets is unknown, the sequence number
shown in the Trace Stack view will be continued without any break except adding a red colored packet
with a sequence number for it.
Note: The disassembly view is not supported when navigation keys are used, but it is supported when
the record is double-clicked using a mouse.
Note: Only the compilable lines are taken into consideration for the statistics. For example, lines with
comments and variable declaration are not taken into account.
A coverage report can be exported. Click the export icon in the trace view toolbar to invoke the export
operation.
5. Programming Dialog
5.1 Introduction
The Device Programming window (also known as the programming dialog), gives you the most low-level
control of the debugging and programming tools. With it, you can program the device's different
memories, fuses, and lockbits, erase memories, and write user signatures. It can also adjust some of the
starter kit properties such as voltage and clock generators.
Note: If you are editing a code project in Atmel Studio and want to see the results of a compilation by
downloading the code into the device, take a look at the Start without Debugging command. It is a sort of
one-click programming alternative to the programming dialog. See section 4.5 Start without Debugging
for more information.
The programming dialog is accessible from a button on the standard toolbar or the menu Tools →
Device Programming.
Figure 5-1. Device Programming Icon
Click on the arrow. This will reveal the list of supported devices. Click to select.
• Select by typing. In this example, we will select the ATxmega128A3:
2.1. Double-click in the text field to select the text already present.
2.2. Start typing some part of the device's name, in this example 128A. The list updates while
you type, showing all devices containing what is typed.
2.3. Press the Arrow Down keyboard button to move the selection into the list. Use the up and
down keys to navigate. Press ENTER to make a selection.
2.4. The ATxmega128A3 is now selected.
Note: A red border around the device selector indicates that the text entered is not a valid device
name. Continue typing until the device name is complete, or select from the list.
Interface
When a tool and a device is selected, the interface list will show the available interfaces. Only interfaces
available on both the tool and the device will appear in this menu.
Select the interface to use to program the AVR.
Apply button
When tool, device, and interface are selected, press the Apply button to make the selections take effect.
This will establish a connection to the tool. The list on the left side of the window will be updated with the
relevant pages for the selected tool.
If a different tool, device, or interface is selected, the Apply button must be pressed again, to make the
new selections take effect.
Device ID
Press the Read button to read the signature bytes from the device. The device's unique tag will appear in
this field and can be used for tool compatibility checking and to obtain help either from customer support
®
or from the people at AVR Freaks .
Target voltage
All tools are capable of measuring the target's operating voltage. Press the refresh button to make a new
measurement.
A warning message will appear if the measured voltage is outside the operating range for the selected
device, and the target voltage box will turn red.
JTAG Clock
JTAG clock is the maximum speed the tool will try to clock the device at. The clock range is different for
different tools and devices. If there are restrictions, they will be stated in a message below the clock
slider.
Use external reset
If checked, the tool will pull the external reset line low when trying to connect to the device.
JTAG daisy-chain settings
Specify the JTAG daisy-chain settings relevant to the device to program.
Target is not part of a daisy-chain. Select this option when the target device is not part of a daisy-chain.
Daisy chain-Manual. Allows you to manually configure the JTAG daisy-chain in case you are
programming in a system-on-board.
• Devices before - specifies the number of devices preceding the target device.
• Instruction bits before - specifies the total size of the instruction registers of all devices, preceding
the target device.
• Devices after - specifies the number of devices following the target device.
• Instruction bits after - specifies the total size of the instruction registers of all devices, following
the target device.
Daisy chain-Auto. Automatically detects the devices in the JTAG daisy-chain. Allows you to select the
device in the JTAG daisy-chain. Auto-detection is supported only for SAM devices.
To accept the changes and configure the tool, press the Set button.
PDI
The PDI interface has only one setting – the PDI clock speed.
PDI Clock is the maximum speed the tool will try to clock the device at. The clock range is different for
different tools and devices. If there are restrictions, they will be stated in a message below the clock
slider.
To apply the changes and configure the tool, press the Set button.
The clock cannot be adjusted on all tools, so an empty Interface settings page will be presented.
The voltage output (VOUT) is adjusted by the slider, or by typing a voltage in the Generated text boxes
below the slider.
After adjusting the set-point, press the Write button to apply the changes. The value is then sent to the
tool, and the measured value is read back.
Press the Read button to read both the set-point (Generated) and the Measured values from the Power
Debugger.
Note: There may be slight differences between the Generated and the Measured voltages.
The output voltage range is 1.6V to 5.5V.
The Channel A and Channel B measurements are snapshots of analog readings taken by the Power
Debugger. The tool is optimized for real-time monitoring of voltage and current, and this snapshot is thus
approximate. It does not perform calibration compensation, and readings are locked in the highest-current
range. For best results, use the Atmel Data Visualizer.
Note: When no load is connected to a measurement channel, non-zero measurements can be
expected.
5.4.2 STK600
The STK600 has three voltage sources and one clock generator.
The set-points of the three voltage sources (VTG, ARef0, and ARef1) are adjusted by the means of three
sliders. It is also possible to type a voltage in the Generated text boxes below the sliders. When you drag
the sliders, the text boxes will update. And when you type a value in the text box, the slider will move.
After adjusting the set-points, press the Write button to apply the changes. The values are sent to the
tool, and measured values are read back.
Measurements are shown in the Measured row and shown as blue columns as part of the slider controls.
The measured values cannot be edited.
Press the Read button to read both the set-point (Generated) and the Measured values from the
STK600.
Note: What is the difference between the Generated and the Measured voltages? The generated
voltage is the setting on the adjustable power supply, the measured voltage is the readout from the built-
in voltmeter. If the measured value is different from the generated voltage, this may indicate that the
target circuitry draws a lot of current from the generator.
Note: If the VTARGET jumper on STK600 is not mounted, the measured voltage will be 0, unless an
external voltage is applied to the VTARGET net.
The Clock generator is also adjusted by dragging the slider or typing into the text box below. Press the
Write button to apply the new value.
5.4.3 QT600
The QT600 has only one setting, the VTarget voltage. This voltage can be set to five fixed voltages: 0,
1.8, 2.7, 3.3, and 5V. Press the Write button to apply the changes.
The actual VTarget value is read back automatically when pressing the Write button. It is also possible to
read it back manually using the Read button.
5.4.4 STK500
STK500 has settings similar to the STK600, but only one Aref voltage and combined generated/
measured values.
The card stack page tells which cards are mounted on the STK600 and if they support the selected
device. If they do match, a list of devices supported by that card combination is listed.
If the mounted cards do not match, a list of suggested card combinations will be listed.
The device information page contains basic information on the selected device. When the page is
accessed, it will try to read the JTAG (or device) signature from the connected device.
In the upper part of the dialog, you can see the device name, its signature, the JTAG part identification
number, and the device revision (extracted from the JTAG signature).
In the lower part of the dialog, you can see the device variants and characteristics of each variant.
Acceptable voltage range, followed by maximum operating clock speed, and the sizes of on-chip
memories.
The two links on the bottom of the dialog offer you to see a slightly more detailed device information in the
purchase catalog online or to download a complete data sheet of the target device.
The calibration value is read from the storage in the device and shown in the Value text box by pressing
the Read button.
The calibration byte is programmed into FLASH or EEPROM memory by pressing the Write button.
Memory type and address must be specified first.
5.8 Memories
Figure 5-10. Memories Programming
From the Memories tab, you can access all the programmable memories on the target device. Memory is
erased by first selecting the memory type and then clicking on the Erase button. Selecting Erase Chip
will erase the entire contents of the device, including FLASH, EEPROM (unless the EESAVE fuse is
programmed), and lock-bits, but not Userpages if the device contains this.
Program
To program a file into the device's Flash memory, write the full path and file name in the combo box in the
flash section. Or, select the file by pressing the browse button (...).
Now, press the Program button to program the file into the memory.
If the Erase device before programming checkbox is checked, a chip erase operation will be
performed before the programming operation starts.
If the Verify device after programming checkbox is checked, the content will be verified after the
programming operation is done.
Some devices can also be programmed through a flashloader. This is mainly an advanced technique, but
it will usually give a significant speedup in the programming speed. For devices where this is supported, a
checkbox named Program flash from RAM will be shown. If this box is checked, the base address of the
location of the flashloader needs to be given.
Verify
To verify the flash content of the device, first, select the file you want to verify against, then, press the
Verify button.
Read
®
The contents of the Flash memory can be read out in Intel hexadecimal file format, using the Read
button. Pressing the Read button will bring up a dialog offering you to specify where the file will be saved.
EEPROM
The device's EEPROM memory can be programmed in a similar way.
User Signatures
The XMEGA device's User Signature memory can be programmed the same way.
Detailed information on which fuses are available in the different programming modes and their functions
can be found in the device data sheet. Note that the selected fuse setting is not affected by erasing the
device with a chip-erase cycle (i.e. pressing the Chip Erase button on the Memories page).
Fuse values can also be written directly into the fuse registers in the lower pane as hexadecimal values.
Auto read If this check box is checked, the fuse settings will be read from the device
each time you enter the fuse page.
Verify after When this check box is checked, the settings will be verified after a
programming programming operation is completed.
The appearance of the fuse glyph describes whether the fuse information is up-to-date compared to the
state of the device.
The fuse value is up-to-date, i.e the same state as in the device.
The fuse has been modified by the user and it is not yet programmed into the device.
The fuse state is unknown, it has not been read from the device, nor modified by the user.
Program device from ELF production file: To program your device from an ELF file, you must first
select a source file by typing its full path into the combo box, or by pressing the browse button .
Depending on the contents of your file, checkboxes for the different memory segments will be activated.
It is possible to select one or several of the memory segments that the ELF production file contains. You
can then program and verify the device with the content of these segments in one single operation. Select
which memory segments you want to program by ticking off the corresponding checkboxes.
Select the Erase memory before programming check box, if you want an erase operation to be
performed before the programming operation.
Note: The erase memory operation will depend on the device selection. For tinyAVR and megaAVR,
both Flash, EEPROM, and lockbits will be erased (chip erase) independent of which memories are
selected, while for XMEGA only the selected memories will be erased.
Select the Verify device after programming checkbox, if you want the contents to be verified after the
programming operation is done.
Select the Verify Device ID checkbox, if you want to verify the device id stored in the file (signature
bytes) with the connected device.
Now, press the Program button to program the file into the memory.
You can verify the contents of the device against an ELF file by pressing the Verify button. The
verification will only verify the contents of the selected memory segments.
Figure 5-14. Production Files Creation
Save to ELF production file: Prior to creating the ELF file, specify the input file path for FLASH,
EEPROM, and Usersignature on the production file tab. Then configure the Fuse and Lockbits on the
corresponding tab and program it. The Fuse and Lockbits, which are programmed in the device will be
taken as input while creating ELF file. Back on the production file tab, press the 'Save' button to generate
the ELF file.
You must specify which segments are to be present in the production ELF file by ticking the
corresponding checkboxes.
5.13 Security
The security bit allows the entire chip to be locked from external JTAG or other debug access for code
security. Once set, the only way to clear the security bit is through the Chip Erase command.
Figure 5-15. Security Page
To check the state of the security bit, press the Read button on the Security page of the programming
dialog. The value should now read Cleared or Set. Set meaning that the security bit is set, and Cleared
meaning that it is not set. If the Auto Read checkbox is ticked off, the Read operation will be performed
automatically when the Security page is opened.
To set the security bit, simply press the Set button on the Security page of the programming dialog. Now
the device is locked for all further JTAG or aWire access except for the Chip Erase command.
Locked device
When the security bit is set, the device is locked for most external debug access. Attempts to program or
read any memories or fuses will cause an error message to appear.
To unset the security bit, issue the Chip Erase command. This can be done from the Memories page,
see 5.8 Memories.
6. Miscellaneous Windows
The Device Pack Manager consists of two panes. The left pane shows the list of packs that are installed.
The right pane shows the devices that are provided by the pack selected in the left pane.
Packs can have any of the following statuses:
Actions
Install selected packs Download and install all packs that have been selected using the check-boxes
besides the version.
Install all updates Download and install all available updates.
Browse pack file Install an already downloaded pack file.
Uninstall Uninstalls all packs that have been selected using the checkboxes besides the
version.
Check for Updates Check for new and updated packs.
Search The search box can be used to search for a specific pack or a device in any of
the packs.
Reset cache Resetting the cache will re-index all installed packs. This does not uninstall or
remove anything. It is in the Advanced menu.
Note: After installing, updating, or removing packs, Atmel Studio has to be restarted before the changes
become visible.
Standard The default profile. Includes the most used windows and menus.
Advanced The profile used in previous versions of Atmel Studio. This profile includes advanced
debugging and refactoring tools.
The profile selection window is shown the first time Atmel Studio is started. Selecting a profile in the list
will show a description of the profile. Clicking the Apply button applies the profile to Atmel Studio.
The profile can be changed at any time by navigating to Tools → Select Profile, or by clicking the profile
name that is displayed in the top right corner of Atmel Studio.
When switching profiles, any changes done to the active profile is saved. Going back to the previous
profile will restore the changes as well as the profile.
Using the Reset option discards any changes saved to the profile and restores it to the default profile.
6.3.1 Introduction
The Available Tools view (View → Available Atmel Tools) contains a list of all connected tools such as
programmers, debuggers, and starter kits. The Simulator is always present. Other tools will show up
when they are connected to the PC.
Device Programming Opens the Device Programming window with the tool preselected.
Self-test Some tools are capable of performing a self-test. Follow the displayed
instructions.
Add target Adds a tool to the list of available tools that is not auto-detectable. See 6.3.3
Add a Non-Detectable Tool for more information.
Upgrade Starts the firmware upgrade tool with the selected tool.
Show Info Window Shows the Tool Info window. Not all tools support this feature. See 6.4 Tool Info
Window for more information.
Press the Apply button and the STK500 will be displayed in the list of available tools.
Note: An STK500 that has been added will be visible in the Available Tools view event even if no
STK500 is connected to the specified COM port.
If you want to remove STK500 from the list, you can right click on it and select Remove from the context
menu.
6.3.3.1 Add J-Link over IP
In the Add target dialog, it is possible to add a remote Segger J-Link debug probe. Both using a debug
probe with built-in ethernet such as the J-Link PRO3 and any other Segger probe by using the J-Link
Remote Server software4.
Figure 6-5. Add J-Link over IP
3 See https://www.segger.com/jlink-pro.html
4 See https://www.segger.com/jlink-remoteserver.html
To add a debug probe that is connected to a J-Link Remote Server, choose Connect by hostname and
enter the IP address or the hostname of the computer running the J-Link Remote Server. If the J-Link
Remote server is running on a non-standard port5 then the port also needs to be entered. If the J-Link
Remote Server is running on the default port, the port can be left empty.
To add a debug probe that has built-in ethernet, choose Connect by serial number in the Add target
dialog, and enter the serial number of the debug probe.
When a tool is connected, the window will open. It has a short description of the tool, an image of the tool,
and a section of links to the user guide, relevant data sheets on the internet, etc.
There is also a table with technical details about the tool, such as firmware version, serial number, etc.
6.5.1 Introduction
Atmel Studio will include the latest firmware for all Microchip tools. New firmware may provide support for
new devices and bugfixes.
You can also check for firmware upgrades by using the Available Tools view (View → Available Atmel
Tools). Right click on a tool and select Upgrade.
For a description on how to do a manual upgrade, downgrade, and upgrade with a custom firmware
image, see 6.5.3 Manual Upgrade.
Quick Find allows you to search the code of one or more open documents for a string or expression. The
selection moves from match to match, allowing you to review each match in its surrounding context.
Note: The matches found are not listed in the Find Results window.
You can use any of the following methods to display Quick Find in the Find and Replace window.
To display Quick Find
1. On the Edit menu, expand Find and Replace.
2. Choose Quick Find.
-or-
If the Find and Replace window is already open, on the toolbar, click the triangular View button on
the left drop-down and then choose Quick Find.
Quick Find can search through a document either forward or backward from the insertion point. The
search automatically continues past the end or start of the document into the unsearched portion. A
message appears when the entire document has been searched.
Find what
These controls allow you to specify the string or expression that will be matched.
Reuse one of the last 20 search strings by selecting it from this drop-down list, or type a new text string or
expression to find.
Table 6-1. Quick Find
Option Description
[string with If you want to use wildcards such as asterisks (*) and question marks (?) in your
wildcards] search string, select the Use checkbox under Find options and then choose
Wildcards.
[regular expression] To instruct the search engine to expect regular expressions, select the Use
checkbox under Find options and then choose Regular expressions.
Expression Builder
This triangular button next to the Find what field becomes available when the Use Checkbox is selected
in Find options and Regular Expressions appears in the drop-down list. Click this button to display a list
of wildcards or regular expressions, depending upon the Use option selected. Choosing any item from
this list adds it into the Find what string.
Find Next
Click this button to find the next instance of the Find what string within the search scope chosen in Look
in.
Bookmark All
Click this button to display blue bookmarks at the left edge of the code editor to indicate each line where
an instance of the Find what string occurs.
Look in
The option chosen from the Look in the drop-down list determines whether Quick Find searches only in
currently active files.
Look in
Select a predefined search scope from this list.
Table 6-2. Look in Scopes
Option Description
Selection This option is available when text is selected in the code editor. Searches only the
selected text in the currently active document.
<Current Block> The name of this option indicates the location of the insertion point in the code
editor. Searches within the current procedure, module, paragraph, or code block.
Current This option is available when a document is open in an editor. Searches only the
Document active document for the Find what string.
Current Window This option is available when a searchable tool window, such as the View in Browser
window, has focus. Searches all content displayed in this window for the Find what
string.
Option Description
All Open Searches all files currently open for editing as if they were one document. When the
Documents starting point of the search is reached in the current file, the search automatically
moves to the next file and continues until the last open file has been searched for
the Find what string.
Current Project Searches all files in the current project as if they were one document. When the
starting point of the search is reached in one file, the search continues in the next
until the last file in the project has been searched.
Find options
You can expand or collapse the Find options section. The following options can be selected or cleared:
Match case
Only displays instances of the Find what string that are matched both by content and by case. For
example, a search for 'MyObject' with Match case selected will return 'MyObject' but not 'myobject' or
'MYOBJECT'.
Match whole word
Only displays instances of the Find what string that are matched in complete words. For example, a
search for 'MyObject' will return 'MyObject' but not 'CMyObject' or 'MyObjectC'.
Search up
When selected, files are searched from the insertion point to the top of the file.
Search hidden text
When selected, the search will also include concealed and collapsed text, such as the metadata of a
design-time control; a hidden region of an outlined document; or a collapsed class or method.
Use
Indicates how to interpret special characters entered in the Find what or Replace with text boxes. The
options include:
Table 6-3. Search with Special Characters
Option Description
Wildcards Special characters such as asterisks (*) and question marks (?) represent one or
more characters. For a list, see Wildcards (Visual Studio).
Regular Expressions Special notations define patterns of text to match. For a list, see Regular
Expressions (Visual Studio).
Toolbar
A toolbar, with two drop-downs, appears at the top of the Find and Replace window. These drop-downs
allow you to choose the type of search or replace you intend to perform and changes the options
displayed in the window to match.
template wizard that runs in the background when a user clicks OK in the New Project or Add New Item
dialog boxes.
Parameter Description
$itemname$ The name provided by the user in the Add New Item dialog box
$machinename$ The current computer name
$projectname$ The name provided by the user in the New Project dialog box
$registeredorganization$ The registry key value from HKLM\Software\Microsoft\Windows NT
\CurrentVersion\RegisteredOrganization
$safeitemname$ The name provided by the user in the Add New Item dialog box, with all
unsafe characters and spaces removed
$safeprojectname$ The name provided by the user in the New Project dialog box, with all unsafe
characters and spaces, removed
$time$ The current time in the format DD/MM/YYYY 00:00:00
$userdomain$ The current user domain
$username$ The current username
$year$ The current year in the format YYYY
$guid[1-10]$ A GUID used to replace the project GUID in a project file. You can specify up
to 10 unique GUIDs (for example, guid1)
Some examples of the choices that can be made are listed in the following table.
Note: When the persistent mode is used, the kit will reboot into Auto mode, since the persistent choice
changes the kit default.
7. GNU Toolchains
GNU Toolchains are a set of standalone command line programs used to create applications for SAM and
AVR microcontrollers.
Option Description
Thumb(-mthumb)/ARM(-marm) Switch between ARM and Thumb processor mode
Option Description
Preprocessor options
Symbols options
There one can define (-D) or undefine (-U) a number of in-source symbols. New symbol declarations
can be added, modified, or reordered, using the interface buttons below:
•
Option Description
Add a new symbol. This and all following icons are reused with the same meaning in other parts
of Atmel Studio interface.
•
Remove a symbol.
•
Edit symbol.
•
Include directories
Default Include Path Enabling this option will add the include path that is
specific to the selected SAM device
Contains all the included header and definition directories, can be modified, using the same interface as
symbols
Optimization options
Optimization level (drop-down menu): -O0, - No optimization, optimize for speed (level 1 - 3),
O1, -O2, -O3, -Os optimize for size
Other optimization flags (manual input form) Here you should write optimization flags specific to the
platform and your requirements
Debug options
Debug level (drop-down menu): none, -g1, - Specifies the level of tracing and debugging code and
g2, -g3 headers left or inserted in the source code
Option Description
Warning messages output options
-Wall All warnings
Miscellaneous options
Other flags (form field) Input other project-specific flags
Option Description
Option Description
-Wl -nostartfiles Do not use standard files
Libraries options
Libraries -Wl, -l (form field) You can add, prioritize, or edit library names here, using those
buttons: , , , ,
Library search path -Wl, -L (form field) You can add, prioritize, or edit path where the linker will search
for dynamically linked libraries. Same interface as above.
Optimization options
Option Description
-funsafe-math-optimizations Enable unsafe math optimizations
Miscellaneous options
Option Description
Linker Scripts
• In 'linker->miscellaneous->linker flags' ($LinkerScript_FLASH) is added by
default. It will be replaced with the appropriate (device_name)_flash.ld file during Build. Similarly
($LinkerScript_SRAM) will be replaced with the appropriate (device_name)_sram.ld file.
• You can always override the default flash linker scripts by replacing ($LinkerScript_FLASH) or
($LinkerScript_SRAM) with your custom linker script option -
T'custom_linker_script.ld'.
Note: These device-specific linker scripts will be available in the 'ProjectFolder/Linkerscripts' directory. In
case of changing the device after project creation, Atmel Studio will automatically add the correct linker
scripts for the selected device.
ARM Assembler Options
Table 7-4. Arm Assembler Options
Option Description
Optimization options
Include path (form field) You can add, prioritize, or edit path to the architecture and
platform specific included files here
-W Suppress Warnings
Debugging options
Debugging level (drop-down menu) None, Enable debugging symbols and debugging source insertion
(-g).
Option Description
Option Description
Optimization options
Include path (form field) You can add, prioritize, or edit path to the architecture and
platform specific included files here
-W Suppress Warnings
Debugging options
Debugging level (drop-down menu) None, - Enables debugging symbols and debugging source
Wa -g. insertion
Option Description
7.3.2.1 Preprocessor
• -nostdinc
Do not search the standard system directories for header files. Only the directories you have
specified with -I options (and the directory of the current file, if appropriate) are searched.
• -E
Stop after the preprocessing stage; do not run the compiler proper. The output is in the form of
preprocessed source code, which is sent to the standard output. Input files which don't require
preprocessing are ignored.
7.3.2.2 Symbols
• -D
• -D name
Predefine name as a macro, with definition 1.
Eg:
• -D name=value
Predefine name as a macro, with definition value. The contents of definition are tokenized
and processed as if they appeared during translation phase three in a #define directive. In
particular, the definition will be truncated by embedded newline characters.
• -U
Cancel any previous definition of name, either built in or provided with a -D option.
-D and -U options are processed in the order they are given on the command line. All -imacros file and -
include file options are processed after all -D and -U options.
7.3.2.3 Directories
• -I dir
Add the directory dir to the list of directories to be searched for header files. Directories named by -I
are searched before the standard system include directories. If the directory dir is a standard
system include directory, the option is ignored to ensure that the default search order for system
directories and the special treatment of system headers are not defeated.
7.3.2.4 Optimization
• There is a general switch ‘-O<optimization_level>’ which specifies the level of optimization used
when generating the code:
– -Os
Signal that the generated code should be optimized for code size. The compiler will not care
about the execution performance of the generated code.
– -O0
No optimization. GCC will generate code that is easy to debug but slower and larger than with
the incremental optimization levels outlined below.
– -O1 or -O
This will optimize the code for both speed and size. Most statements will be executed in the
same order as in the C/C++ code and most variables can be found in the generated code.
This makes the code quite suitable for debugging. This is default.
– -O2
Turn on most optimizations in GCC except for some optimizations that might drastically
increase code size. This also enables instruction scheduling, which allows instructions to be
shuffled around to minimize CPU stall cycles because of data hazards and dependencies, for
CPU architectures that might benefit from this. Overall this option makes the code quite small
and fast, but hard to debug.
– -O3
Turn on some extra performance optimizations that might drastically increase code size but
increase performance compared to the -O2 and -O1 optimization levels. This includes
performing function inlining
• Other optimization options
– -ffunction-sections
– -fdata-sections
Place each function or data item into its own section in the output file if the target supports
arbitrary sections. The name of the function or the name of the data item determines the
section's name in the output file.
Only use these options when there are significant benefits from doing so. When you specify
these options, the assembler and linker will create larger object and executable files and will
also be slower.
– -funroll-loops
Perform loop unrolling when iteration count is known. If code size is not a concern then some
extra performance might be obtained by making gcc unroll loops by using the ‘-funroll-loops’’
switch in addition to the ‘-O3’ switch.
7.3.2.5 Debugging
• -g level (Debugging level)
• -g1
It produces minimal information, enough for making backtraces in parts of the program that
you don't plan to debug. This includes descriptions of functions and external variables, but no
information about local variables and no line numbers.
• -g2
It is the default debugging level.
• -g3
It includes extra information, such as all the macro definitions present in the program. Some
debuggers support macro expansion when you use -g3.
7.3.2.6 Warnings
• -Wall
Show all warnings.
• -Werror
Show warnings as errors.
• -fsyntax-only
Check the code for syntax errors, but don't do anything beyond that.
• -pedantic
Issue all the warnings demanded by strict ISO C, reject all programs that use forbidden extensions,
and some other programs that do not follow ISO C. Valid ISO C programs should compile properly
with or without this option (though a rare few will require -ansi or a -std option specifying the
required version of ISO C). However, without this option, certain GNU extensions and traditional C
features are supported as well. With this option, they are rejected.
• -pedantic-errors
Pedantic warnings are produced as errors.
• -w
Inhibit all warning messages.
7.3.2.7 Miscellaneous
• -v
Verbose option. It prints (on standard error output) the commands executed to run the stages of
compilation. Also, print the version number of the compiler driver program and of the preprocessor
and the compiler proper.
• -ansi
Support ANSI programs. This turns off certain features of GCC that are incompatible with ISO C90
(when compiling C code). For the C compiler, it disables recognition of C++ style // comments as
well as the inline keyword. The -ansi option does not cause non-ISO programs to be rejected
gratuitously. For that, -pedantic is required in addition to -ansi.
7.3.3.1 General
• -Wl,option
Pass option as an option to the linker. If option contains commas, it is split into multiple options
at the commas. You can use this syntax to pass an argument to the option. For example, `-Wl,-
Map,output.map' passes `-Map output.map' to the linker.
• -Wl, -nostartfiles
Do not use the standard system startup files when linking. The standard system libraries are used
normally, unless -nostdlib or -nodefaultlibs is used.
• -Wl,-nodefault
Do not use the standard system libraries when linking. Only the libraries you specify will be passed
to the linker, options specifying linkage of the system libraries, such as -static-libgcc or -
shared-libgcc, will be ignored. The standard start-up files are used normally, unless -
nostartfiles is used. The compiler may generate calls to memcmp, memset, memcpy, and
memmove. These entries are usually resolved by entries in libc. These entry points should be
supplied through some other mechanism when this option is specified.
• -Wl,-nostdlib
Do not use the standard system start-up files or libraries when linking.
One of the standard libraries bypassed by -nostdlib and -nodefaultlibs is libgcc.a, a
library of internal subroutines that GCC uses to overcome shortcomings of particular machines, or
special needs for some languages. In most cases, you need libgcc.a even when you want to avoid
other standard libraries. In other words, when you specify -nostdlib or -nodefaultlibs you
should usually specify -lgcc as well. This ensures that you have no unresolved references to
internal GCC library subroutines.
• -Wl,-s
Remove all symbol table and relocation information from the executable.
• -Wl,-static
On systems that support dynamic linking, this prevents linking with the shared libraries. On other
systems, this option has no effect.
• -Wl,-Map
Generates Map file.
7.3.3.2 Libraries
• -Wl,-llibrary
Search the library named library when linking.
It makes a difference where in the command you write this option; the linker searches and
processes libraries and object files in the order they are specified. Thus, foo.o -lz bar.o searches
library z after file foo.o but before bar.o.
The linker searches a standard list of directories for the library, which is actually a file named
liblibrary.a. The linker then uses this file as if it had been specified precisely by name.
• -Wl, Ldir
Add directory dir to the list of directories to be searched for -l.
7.3.3.3 Optimization
• -Wl, --gc-sections
Garbage collect unused sections.
Enable garbage collection of unused input sections. It is ignored on targets that do not support this
option. The default behavior (of not performing this garbage collection) can be restored by
specifying `--no-gc-sections' on the command line. `--gc-sections' decides which input sections are
used by examining symbols and relocations. The section containing the entry symbol and all
sections containing symbols undefined on the command-line will be kept, as will sections containing
symbols referenced by dynamic objects.
• -funsafe-math-optimizations
Enable unsafe math optimizations.
• -ffast-math
Enable fast math
• -fpic
Generate position independent code.
7.4 Binutils
The following ARM GNU Binutils are available:
• arm-none-eabi-ld - GNU linker.
• arm-none-eabi-as - GNU assembler.
• arm-none-eabi-addr2line - Converts addresses into filenames and line numbers.
• arm-none-eabi-ar - A utility for creating, modifying, and extracting from archives.
• arm-none-eabi-c++filt - Filter to demangle encoded C++ symbols.
• arm-none-eabi-nm - Lists symbols from object files.
• arm-none-eabi-objcopy - Copies and translates object files.
• arm-none-eabi-objdump - Displays information from object files.
• arm-none-eabi-ranlib - Generates an index to the contents of an archive.
• arm-none-eabi-readelf - Displays information from any ELF format object file.
• arm-none-eabi-size - Lists the section sizes of an object or archive file.
• arm-none-eabi-strings - Lists printable strings from files.
• arm-none-eabi-strip - Discards symbols.
For more information about each util, use the built-in help command: <util name here> --help.
Option Description
General options
-mcall-prologues Use subroutines for functions prologues and epilogues
Preprocessor options
-E Preprocess only
Symbols options
Option Description
One can define (-D) or undefine (-U) a number of in-source symbols. New symbol declarations can be
added, modified, or reordered, using the interface buttons below:
•
Add a new symbol. This and all following icons are reused with the same meaning in other parts
of Atmel Studio interface.
•
Remove a symbol.
•
Edit symbol.
•
Include directories
Contains all the included header and definition directories, can be modified, using the same interface as
symbols.
Optimization options
Optimization level (drop-down menu): -O0, - No optimization, optimize for speed (level 1 - 3),
O1, -O2, -O3, -Os optimize for size
Other optimization flags (manual input form) Here you should write optimization flags specific to the
platform and your requirements
Debug options
Debug level (drop-down menu): none, -g1, - Specifies the level of tracing and debugging code and
g2, -g3 headers left or inserted in the source code
Option Description
Other debug options (form field) Architecture-specific debug options
Miscellaneous options
Other flags (form field) Input other project-specific flags
-v Verbose
Option Description
-Wl -nostartfiles Do not use standard files
Libraries options
Libraries -Wl, -l (form field) You can add, prioritize, or edit library names here, using those
buttons: , , , ,
Library search path -Wl,-L (form field) You can add, prioritize, or edit path where the linker will search
for dynamically linked libraries, same interface as above
Optimization options
Option Description
-mrelax Relax branches
Miscellaneous options
Memory Settings
Displays a dialog where it is possible to configure memory segments. (Syntax for specifying segment
values: <segmentname> = <address>, for example boot=0xff)
The address must be given as a hexadecimal number prefixed with 0x. It is interpreted as a word address
for flash memory and a byte address for SRAM and EEPROM memory.
Figure 7-3. Memory Settings
Note that the address has been multiplied by 2 to get the byte address.
A relocation definition for the .data section will be passed as:
• -Wl,-section-start=anewdatasegment=0x800
AVR Assembler Options
Table 7-8. AVR Assembler Options
Option Description
Optimization options
Include path (form field) You can add, prioritize, or edit path to the architecture and
platform specific included files here
Debugging options
Debugging (drop-down menu) None, -Wa Enables debugging symbol and debugging source insertion
-g
7.6.1.1 General
• -funsigned-char
Each kind of machine has a default for what char should be. It is either like unsigned char by
default or like signed char by default. This option says that the default char type is unsigned.
• -funsigned-bitfields
These options control whether a bit-field is signed or unsigned when the declaration does not use
either signed or unsigned. These options say that the default bitfield type is unsigned.
7.6.1.2 Preprocessor
• -nostdinc
Do not search the standard system directories for header files. Only the directories you have
specified with -I options (and the directory of the current file, if appropriate) are searched.
• -E
Stop after the preprocessing stage; do not run the compiler proper. The output is in the form of
preprocessed source code, which is sent to the standard output. Input files which don't require
preprocessing are ignored.
7.6.1.3 Symbols
• -D
• -D name
Predefine name as a macro, with definition 1.
E.g.:
• -D name=value
Predefine name as a macro, with definition value. The contents of definition are tokenized
and processed as if they appeared during translation phase three in a #define directive. In
particular, the definition will be truncated by embedded newline characters.
• -U
Cancel any previous definition of name, either built-in or provided with a -D option.
-D and -U options are processed in the order they are given on the command line. All -imacros file and -
include file options are processed after all -D and -U options.
7.6.1.4 Directories
• -I dir
Add the directory dir to the list of directories to be searched for header files. Directories named by -I
are searched before the standard system include directories. If the directory dir is a standard
system include directory, the option is ignored to ensure that the default search order for system
directories and the special treatment of system headers are not defeated.
7.6.1.5 Optimization
• There is a general switch ‘-O<optimization_level>’ which specifies the level of optimization used
when generating the code:
– -Os
Signal that the generated code should be optimized for code size. The compiler will not care
about the execution performance of the generated code.
– -O0
No optimization. This is the default. GCC will generate code that is easy to debug but slower
and larger than with the incremental optimization levels outlined below.
– -O1 or -O
This will optimize the code for both speed and size. Most statements will be executed in the
same order as in the C/C++ code and most variables can be found in the generated code.
This makes the code quite suitable for debugging.
– -O2
Turn on most optimizations in GCC except for some optimizations that might drastically
increase code size. This also enables instruction scheduling, which allows instructions to be
shuffled around to minimize CPU stall cycles because of data hazards and dependencies, for
CPU architectures that might benefit from this. Overall this option makes the code quite small
and fast, but hard to debug.
– -O3
Turn on some extra performance optimizations that might drastically increase code size but
increase performance compared to the -O2 and -O1 optimization levels. This includes
performing function inlining
• Other optimization options
– -ffunction-sections
– -fdata-sections
Place each function or data item into its own section in the output file if the target supports
arbitrary sections. The name of the function or the name of the data item determines the
section's name in the output file.
Only use these options when there are significant benefits from doing so. When you specify
these options, the assembler and linker will create a larger object and executable files and will
also be slower.
– -funroll-loops
If code size is not a concern then some extra performance might be obtained by making gcc
unroll loops by using the ‘-funroll-loops’’ switch in addition to the ‘-O3’ switch.
7.6.1.6 Debugging
• -g level (Debugging level)
• -g1
It produces minimal information, enough for making back-traces in parts of the program that
you don't plan to debug. This includes descriptions of functions and external variables, but no
information about local variables and no line numbers.
• -g2
It is the default debugging level.
• -g3
It includes extra information, such as all the macro definitions present in the program. Some
debuggers support macro expansion when you use -g3.
7.6.1.7 Warnings
• -Wall
Show all warnings.
• -Werror
Show warnings as errors.
• -fsyntax-only
Check the code for syntax errors, but don't do anything beyond that.
• -pedantic
Issue all the warnings demanded by strict ISO C, reject all programs that use forbidden extensions,
and some other programs that do not follow ISO C. Valid ISO C programs should compile properly
with or without this option (though a rare few will require -ansi or a -std option specifying the
required version of ISO C). However, without this option, certain GNU extensions and traditional C
features are supported as well. With this option, they are rejected.
• -pedantic-errors
Pedantic warnings are produced as errors.
• -w
Inhibit all warning messages.
7.6.1.8 Miscellaneous
• -v
Verbose option. It prints (on standard error output) the commands executed to run the stages of
compilation. Also, print the version number of the compiler driver program and of the preprocessor
and the compiler proper.
• -ansi
Support ANSI programs. This turns off certain features of GCC that are incompatible with ISO C90
(when compiling C code). For the C compiler, it disables recognition of C++ style // comments as
well as the inline keyword. The -ansi option does not cause non-ISO programs to be rejected
gratuitously. For that, -pedantic is required in addition to -ansi.
7.6.2.1 General
• -Wl,option
Pass option as an option to the linker. If option contains commas, it is split into multiple options
at the commas. You can use this syntax to pass an argument to the option. For example, `-Wl,-
Map,output.map' passes `-Map output.map' to the linker.
• -Wl, -nostartfiles
Do not use the standard system startup files when linking. The standard system libraries are used
normally, unless -nostdlib or -nodefaultlibs is used.
• -Wl,-nodefault
Do not use the standard system libraries when linking. Only the libraries you specify will be passed
to the linker, options specifying linkage of the system libraries, such as -static-libgcc or -
shared-libgcc, will be ignored. The standard start-up files are normally used, unless -
nostartfiles is used. The compiler may generate calls to memcmp, memset, memcpy, and
memmove. These entries are usually resolved by entries in libc. These entry points should be
supplied through some other mechanism when this option is specified.
• -Wl,-nostdlib
Do not use the standard system start-up files or libraries when linking.
One of the standard libraries bypassed by -nostdlib and -nodefaultlibs is libgcc.a, a
library of internal subroutines that GCC uses to overcome shortcomings of particular machines, or
special needs for some languages. In most cases, you need libgcc.a even when you want to avoid
other standard libraries. In other words, when you specify -nostdlib or -nodefaultlibs you
should usually specify -lgcc as well. This ensures that you have no unresolved references to
internal GCC library subroutines.
• -Wl,-s
Remove all symbol table and relocation information from the executable.
• -Wl,-static
On systems that support dynamic linking, this prevents linking with the shared libraries. On other
systems, this option has no effect.
7.6.2.2 Libraries
• -Wl,-llibrary
Search the library named library when linking.
It makes a difference where in the command you write this option; the linker searches and
processes libraries and object files in the order they are specified. Thus, foo.o -lz bar.o searches
library z after file foo.o but before bar.o.
The linker searches a standard list of directories for the library, which is actually a file named
liblibrary.a. The linker then uses this file as if it had been specified precisely by name.
• -Wl, Ldir
Add directory dir to the list of directories to be searched for -l.
7.6.2.3 Optimization
• -Wl, --gc-sections
Garbage collect unused sections.
Enable garbage collection of unused input sections. It is ignored on targets that do not support this
option. The default behavior (of not performing this garbage collection) can be restored by
specifying `--no-gc-sections' on the command line. `--gc-sections' decides which input sections are
used by examining symbols and relocations. The section containing the entry symbol and all
sections containing symbols undefined on the command-line will be kept, as will sections containing
symbols referenced by dynamic objects.
• --rodata-writable
Put read-only data in writable data section.
7.7.1.1 General
• -mcall-prologues
Functions prologues/epilogues are expanded as call to appropriate subroutines. Code size will be
smaller.
• -mno-interrupts
Change the stack pointer without disabling interrupts. Generated code is not compatible with
hardware interrupts. Code size will be smaller.
• -mno-tablejump
Do not generate table jump instructions (removed from GCC 4.5.1 coz same as -fno-jump-tables).
• -msize
Output instruction sizes to the asm file (removed from avr-gcc coz same as using -dp switch which
prints the instruction length).
7.7.1.2 Optimization
• -fpack-struct
Without a value specified, pack all structure members together without holes. When a value is
specified (which must be a small power of two), pack structure members according to this value,
representing the maximum alignment (that is, objects with default alignment requirements larger
than this will be output potentially unaligned at the next fitting location).
• -fshort-enums
Allocate to an enum type only as many bytes as it needs for the declared range of possible values.
Specifically, the enum type will be equivalent to the smallest integer type which has enough room.
• -mshort-calls
Use rjmp/rcall (limited range) on >8K devices.
7.7.1.3 Miscellaneous
• -save-temps
Do not delete temporary files. Store the usual 'temporary' intermediate files permanently; place
them in the current directory and name them based on the source file. Thus, compiling foo.c with -c
-save-temps would produce files foo.i and foo.s, as well as foo.o. This creates a preprocessed foo.i
output file even though the compiler now normally uses an integrated preprocessor.
7.8.1 Optimization
• -mfast-float
The switch, causes fast, non-ieee compliant versions of some of the optimized AVR 32-bit floating-
point library functions to be used. This switch is by default enabled if the ‘-ffast-math’ switch is
used.
• -funsafe-math-optimizations
Allow optimizations for floating-point arithmetic that (a) assume that arguments and results are valid
and (b) may violate IEEE or ANSI standards. When used at link-time, it may include libraries or
start-up files that change the default FPU control word or other similar optimizations. This option is
not turned ON by any ‘-O’ option since it can result in incorrect output for programs which depend
on an exact implementation of IEEE or ISO rules/specifications for math functions. It may, however,
yield faster code for programs that do not require the guarantees of these specifications. Enables ‘-
fno-signed-zeros’, ‘-fno-trapping-math’, ‘-fassociative-math’ and ‘-freciprocal-math’.
• -ffast-math
This option causes the preprocessor macro __FAST_MATH__ to be defined. This option is not
turned on by any ‘-O’ option since it can result in incorrect output for programs which depend on an
exact implementation of IEEE or ISO rules/specifications for math functions. It may, however, yield
faster code for programs that do not require the guarantees of these specifications. It sets ‘-fno-
math-errno’, ‘-funsafe-math-optimizations’, ‘-ffinite-math-only’, ‘-fno-rounding-math’, ‘-fno-signaling-
nans’ and ‘-fcx-limited-range’.
• -fpic
Generate position-independent code (PIC) suitable for use in a shared library, if supported for the
target machine. Such code accesses all constant addresses through a global offset table (GOT).
The dynamic loader resolves the GOT entries when the program starts (the dynamic loader is not
part of GCC; it is part of the operating system). If the GOT size for the linked executable exceeds a
machine-specific maximum size, you get an error message from the linker indicating that ‘-fpic’
does not work; in that case, recompile with ‘-fPIC’ instead. (These maximums are 8k on the SPARC
and 32k on the m68k and RS/6000. The 386 has no such limit.) Position-independent code requires
special support, and therefore works only on certain machines. For the 386, GCC supports PIC for
System V but not for the Sun 386i. Code generated for the IBM RS/6000 is always position-
independent. When this flag is set, the macros __pic__ and __PIC__ are defined to 1.
• -mno-init-got
Do not initialize GOT register before using it when compiling PIC code.
• -masm-addr-pseudos
This option is enabled by default and causes GCC to output the pseudo instructions call and lda.w
for calling direct functions and loading symbol addresses respectively. It can be turned OFF by
specifying the switch ‘-mno-asm-addr-pseudos’. The advantage of using these pseudo-instructions
is that the linker can optimize these instructions at link time if linker relaxing is enabled. The ‘-
mrelax’ option can be passed to GCC to signal to the assembler that it should generate a relaxable
object file.
• -mforce-double-align
Force double-word alignment for double-word memory accesses.
• -mimm-in-const-pool
When GCC needs to move immediate values not suitable for a single move instruction into a
register, it has two possible choices; it can put the constant into the code somewhere near the
current instruction (the constant pool) and then use a single load instruction to load the value or it
can use two immediate instruction for loading the value directly without using a memory load. If a
load from the code memory is faster than executing two simple one-cycle immediate instructions,
then putting these immediate values into the constant pool will be most optimal for speed. This is
often true for MCU architectures implementing an instruction cache, whereas architectures with
code executing from the internal flash will probably need several cycles for loading values from
code memory. By default, GCC will use the constant pool for AVR 32-bit products with an
instruction cache and two immediate instructions for flash-based MCUs. This can be overridden by
using the option ‘-mimm-in-const-pool’ or its negated option ‘-mno-imm-in-const-pool’.
• -muse-rodata-sections
By default GCC will output read-only data into the code (.text) section. If the code memory is slow it
might be more optimal for performance to put read-only data into another faster memory, if
available. This can be done by specifying the switch ‘-muse-rodata-section’, which makes GCC put
read-only data into the .rodata section. Then the linker file can specify where the content of
the .rodata section should be placed. For systems running code from flash, this might, however,
mean that the read-only data must be placed in flash and then copied over to another memory at
start-up, which means that extra memory usage is required with this scheme.
7.8.2 Debugging
• -pg
Generate extra code to write profile information suitable for the analysis program gprof. You must
use this option when compiling the source files you want data about, and you must also use it when
linking.
• -p
Generate extra code to write profile information suitable for the analysis program prof. You must
use this option when compiling the source files you want data about, and you must also use it when
linking.
and 32k on the m68k and RS/6000. The 386 has no such limit.) Position-independent code requires
special support and, therefore, works only on certain machines. For the 386, GCC supports PIC for
System V but not for the Sun 386i. Code generated for the IBM RS/6000 is always position-
independent. When this flag is set, the macros __pic__ and __PIC__ are defined to 1.
• -Wl,--direct-data
Allow direct data references when optimizing. To enable the linker to convert an lda.w into an
immediate move instruction, i.e. linker relaxing, the option ‘—direct-data’ must be given to the
linker.
7.8.3.2 Miscellaneous
• -Xlinker[option]
Pass option as an option to the linker. You can use this to supply system-specific linker options
which GCC does not know how to recognize. If you want to pass an option that takes a separate
argument, you must use -Xlinker twice; once for the option and once for the argument. For
example, to pass -assert definitions, you must write `-Xlinker -assert -Xlinker definitions'. It does not
work to write -Xlinker '-assert definitions', because this passes the entire string as a single
argument, which is not what the linker expects. When using the GNU linker, it is usually more
convenient to pass arguments to linker options using the option=value syntax than as separate
arguments. For example, you can specify `-Xlinker -Map=output.map' rather than `-Xlinker -Map -
Xlinker output.map'. Other linkers may not support this syntax for command-line options.
7.9 Binutils
The following AVR 32-bit GNU Binutils are available:
• avr32-ld- GNU linker.
• avr32-as - GNU assembler.
• avr32-addr2line - Converts addresses into filenames and line numbers.
• avr32-ar - A utility for creating, modifying and extracting from archives.
• avr32-c++filt - Filter to demangle encoded C++ symbols.
• avr32-nm - Lists symbols from object files.
• avr32-objcopy - Copies and translates object files.
• avr32-objdump - Displays information from object files.
• avr32-ranlib - Generates an index to the contents of an archive.
• avr32-readelf - Displays information from any ELF format object file.
• avr32-size - Lists the section sizes of an object or archive file.
• avr32-strings - Lists printable strings from files.
• avr32-strip - Discards symbols.
For more information about each util, use the built-in help command: avr32-<util name here> --
help.
• For general information about GNU Assembler (GAS), GNU linker and other binutils, visit the
official GNU Binutils web site.
The extensions are displayed in the middle pane. You can sort the list by name or author from the
combobox above the list.
When you select an extension in the middle pane, information about it appears in the right pane.
Extension installed by the current user can be uninstalled or disabled, extensions distributed with Atmel
Studio cannot be changed.
The Extension Manager window also includes a search box. Depending on the selection in the left pane,
you can search installed extensions, the online gallery, or available updates.
Online Gallery Extension Manager can install extensions from the Atmel Studio Gallery. These extensions
may be packages, templates, or other components that add functionality to Atmel Studio.
To get started with the extension manager, check the 8.3 Installing New Extensions in Atmel Studio.
Extension Types
Extension Manager supports extensions in the VSIX package format, which may include project
templates, item templates, toolbox items, Managed Extension Framework (MEF) components, and
VSPackages. Extension Manager can also download and install MSI-based extensions, but it cannot
enable or disable them. Atmel Studio Gallery contains both VSIX and MSI extensions.
Dependency Handling
If a user tries to install an extension that has dependencies, the installer verifies that those dependencies
are already installed. If they are not installed, Extension Manager shows the user a list of dependencies
that must be installed before the extension can be installed.
Installing Without Using Extension Manager
Extensions that have been packaged in .vsix files may be available in locations other than the Atmel
Studio Gallery. Extension Manager cannot detect these files. However, you can install a .vsix file by
double-clicking it and then following the setup instructions. When the extension is installed, you can use
Extension Manager to enable it, disable it, or remove it.
Once you click download, you will be taken to the sign-in page of the Microchip Gallery.
Clicking on Sign in, on the top right of the dialog, you will be asked to sign into your Microchip account.
The download will start as indicated in the status bar of Atmel Studio. If the extension is distributed as a
standalone installer you will be asked for a location to save the file. Downloading can take several
minutes for large files. A dialog with a running bar is displayed during download. Not that download can
take a long time for large extensions. Press Cancel to abort the download.
Step 4
Figure 8-10. Extension License
A license agreement will appear for you to read, most of the times when you install a new extension.
Read it carefully and install only the extensions you really need as most of the extensions' authors do not
take liability in a possible malfunction resulting from installation of mutually incompatible extensions and
collateral damages, for example, if extension security is breached.
Step 5
Once the extension is downloaded a message in the lower status bar will appear.
Figure 8-11. Extension Manager Restart Warning
Click the Restart Now button to restart the IDE immediately, otherwise, if you plan to restart it later - click
the Close button.
If you have an unsaved project you will be requested to save the changes you made, before restarting.
Step 6
Figure 8-12. QTouch Composer Button
After restarting Atmel Studio, a new button is added for starting QTouch Composer.
• Jump directly to relevant documentation using hyperlinks in the Visual Assist options dialog
8.5.1 Installation
1. Start Atmel Studio.
2. Go to Tools → Extension Manager → Online Gallery.
3. Select QTouch Library, click 'Download', and then install it.
4. Select QTouch Composer, click 'Download', and then install it.
5. Click the 'Restart Now' button in the Extension manager window.
6. After starting Atmel Studio, go to Tools → Extension Manager. Check that the QTouch library and
the QTouch composer are listed and the status is enabled.
3. The 'New Project' dialog is opened. Select 'GCC C QTouch Executable Project' in the New Project
dialog.
Enter the following details in the 'New Project' dialog and click the OK button.
– Name of the project
– Location of the project and solution
– Name of the solution
4. The 'QTouch Project Builder' wizard is opened, which will guide you through the steps involved in
creating a project.
Attention:
Error checking is kept at a minimum for the functions exported into the Python environment so
that the time used on initialization during normal sessions are kept low. This means that there
are many ways to crash Atmel Studio through this interface.
To load a Python file, place a file named debughooks.py in the Debug folder of your project, next to the
ELF file, or one folder up where the project file is. It is also possible to place this file inside the Atmel
Studio installation directory to make the script load for all projects.
Note: The Python file is loaded and compiled when a project is launched, so changes to the Python file
during a debug session will not be active until the next debug session is started. The Python file is
running in an IronPython context, with full access to .NET and a Python 2.7 runtime. See http://
ironpython.net/documentation/dotnet/ for more information of the runtime.
The functions that Atmel Studio will try to load are shown below with their function signature.
def should_process_breakpoint(studio_interface,
breakpoint_address,
breakpoint_id,
obj):
"""
Called to determine if a breakpoint should cause Atmel Studio to enter debug mode.
If this function returns False, Atmel Studio will not break at the breakpoint.
"""
return True
def has_processed_breakpoint(studio_interface,
breakpoint_address,
breakpoint_id,
obj):
"""
This function is called if Atmel Studio is breaking at a breakpoint.
The GUI is now in halted mode.
"""
pass
def on_reset(studio_interface,
reset_address):
"""
This function is called when the target is reset. The address
where the reset went to is 'reset_address'.
"""
pass
def on_eval_expr(studio_interface,
expression):
"""
This function is called for each expression that is evaluated in Atmel Studio.
This includes the watch window and other windows that show data from the target.
Pass the 'expression' string through to evaluate it, or return another expression
to be evaluated to override the expression. This override is not visible in the
Atmel Studio GUI.
"""
return expression
Note: Atmel Studio expects all these functions to be available if the script has been found and is loaded
correctly. If, for instance, the should_process_breakpoint is undefined, breakpoints might start to
misbehave as the return value of an undefined function is in itself undefined.
In the code shown above, the main interface back into the Atmel Studio is the studio_interface
object. This object contains some functions to show messages and do target interaction.
The Print function in the studio_interface object is used to show text in the output window inside
Atmel Studio. The function takes two arguments; the string to print and the name of the tab in the output
window. The example below prints all the evaluated expressions to the “Expressions” tab.
def on_eval_expr(studio_interface, expression):
studio_interface.Print("Evaluating {}".format(expression), "Expressions")
return expression
Note: The severity level of text sent through Print is set to INFO, which means that the output may be
masked by Atmel Studio. To lower the threshold, go to Tools > Tools, select Status Management, and
set the Display Threshold to INFO.
The ExecStmt function in the studio_interface object is used to execute statements in the
debugger. This can, for instance, be used to set variables. See MSDN Debugger.ExecuteStatement
Method for more information.
The WriteMemory and ReadMemory are symmetric functions for reading and writing memory on the
target. It is important to use a System.Array[System.Byte] object to pass the data between the
script and Atmel Studio.
import System
def should_process_breakpoint(studio_interface,
breakpoint_address,
breakpoint_id,
obj):
vals = System.Array[System.Byte]([1, 2, 3, 4, 5, 6, 7, 8, 9])
The CalcNumericValue is a shorthand for the CalcValue call. It will return the numeric value of the
symbol or the provided default value if the function fails to retrieve the value of the symbol.
def should_process_breakpoint(studio_interface,
breakpoint_address,
breakpoint_id,
obj):
a = studio_interface.CalcNumericValue("a", 0)
if a == 0:
studio_interface.Print("a was 0 or default", "Value scripts")
else:
studio_interface.Print("a = {}".format(a), "Value scripts")
return True
The CalcValue function is used to retrieve information about a symbol in the scope where the target
code is running. The return value of this call is a list of information containing the address of the symbol,
symbol information, and value. The objects sent to this list contains all known information about a symbol,
but the most useful field is the last element which contains the value of the evaluated symbol.
def should_process_breakpoint(studio_interface,
breakpoint_address,
breakpoint_id,
obj):
a = studio_interface.CalcValue("a")
# a now contains all information about the variable a.
# It is a list with the following members:
# a = [
# <Atmel.VsIde.AvrStudio.Services.TargetService.TCF.Services.ValueInfo>,
# <Atmel.VsIde.AvrStudio.Services.TargetService.TCF.Services.SymbolInfo>,
# <Atmel.VsIde.AvrStudio.Services.TargetService.TCF.Services.ExpressionInfo>,
# '1' ] <-- This is the value of the symbol as a string, here it had the value 1
Note: The different objects returned by the CalcValue call contains objects that are either internal or
documented in the Atmel Studio SDK. Use the python dir() command to look at the fields that are
exported.
2. On the Welcome to the Import and Export Settings Wizard page, click Reset all settings and
then click Next.
3. If you want to save your current settings combination, click Yes, save my current settings, specify
a file name, and then click Next.
—or—
If you want to delete your current settings combination, choose No, just reset settings, overwriting
my current settings, and then click Next. This option does not delete default settings, which will still
be available the next time you use the wizard.
4. In Which collection of settings do you want to reset to, select a settings collection from the list.
5. Click Finish.
The Reset Complete page alerts you to any problems encountered during the reset.
In addition, this options page allows you to specify the folders in which Atmel Studio searches for .Addin
registration files. This enhances security by allowing you to limit the locations where .Addin registration
files can be read, helping prevent malicious .Addin files from inadvertently being used.
The settings in the Add-in/Macros Security, Environment, and Options Dialog Box that relate to add-in
security are:
• Allow add-in components to load. Checked by default. When checked, add-ins are allowed to load
in Atmel Studio. When unchecked, add-ins are prohibited from loading in Atmel Studio.
• Allow add-in components to load from a URL. Unchecked by default. When checked, add-ins are
allowed to be loaded from external Web sites. When unchecked, remote add-ins are prohibited
from loading in Atmel Studio. If an add-in cannot load for some reason, then it cannot be loaded
from the web. This setting controls only the loading of the add-in DLL. The .Addin registration files
must always be located on the local system.
Default .Add-In File Search Locations
In addition to the security settings, the options page has a list containing folders in which to search
for .Addin registration files. By default, the following tokens are included:
• %ALLUSERSDOCUMENTS%
• %ALLUSERSPROFILE%
• %APPDATA%
• %VSAPPDATA%
• %VSCOMMONAPPDATA%
• %VSMYDOCUMENTS%
When Atmel Studio begins searching for .AddIn files, it replaces these tokens with the following path
strings:
Table 9-1. AddIn Files Search Path Tokens
Token Path
%ALLUSERSDOCUMENTS% %PUBLIC%\Documents
%APPDATA% %USERPROFILE%\AppData
Note: Some of the default paths may resolve to targets that do not exist on your system.
You can remove these predefined tokens from the list by highlighting the token and clicking Remove. To
add other folders to the search list, click Add and specify a folder in the Browse for Folder dialog box.
9.3.1.3 AutoRecover
Use this page of the Options dialog box to specify whether or not files are automatically backed up. This
page also allows you to specify whether or not modified files are restored when the integrated
development environment (IDE) shuts down unexpectedly. You can access this dialog box by selecting
the Tools menu and choosing Options, and then select the Environment folder and choose the
AutoRecover page. If this page does not appear in the list, select Show all settings in the Options dialog
box.
Save AutoRecover information every <n> minutes
Use this option to customize how often a file is automatically saved in the editor. For previously saved
files, a copy of the file is saved in \...\My Documents\Atmel Studio 6.2\Backup Files
\<projectname>. If the file is new and has not been manually saved, the file is auto-saved using a
randomly generated file name.
Keep AutoRecover information for <n> days
Use this option to specify how long Atmel Studio keeps files created for auto-recovery.
Select this option to paste the text on either side of the current editor's insertion point into the Find what
field when you select any view of the Find and Replace Window window from the Edit menu. Clear this
option to use the last search pattern from the previous search as the Find what string.
Hide Find and Replace window after a match is located for Quick Find or Quick Replace
Select this option to automatically close the Find and Replace window when the first match is found for
Quick Find. To go to the next match, use the shortcut key for Edit.FindNext, usually F3, or display the
Find and Replace window again.
9.3.1.5 Fonts and Colors
The Fonts and Colors page of the Options dialog box lets you establish a custom font and color scheme
for various user interface elements in the integrated development environment (IDE). You can access this
dialog box by clicking Options on the Tools menu, and then select the Fonts and Colors page in the
Environment folder. If this page does not appear in the list, select Show all settings in the Options dialog
box.
Note: The dialog boxes and menu commands you see might differ from those described in Help
depending on your active settings or edition. To change your settings, choose Import and Export Settings
on the Tools menu.
Color scheme changes do not take effect during the session in which you make them. You can evaluate
color changes by opening another instance of Atmel Studio and producing the conditions under which
you expect your changes to apply.
Show settings for
Lists all of the user interface elements for which you can change font and color schemes. After selecting
an item from this list you can customize color settings for the item selected in Display items.
Text Editor
Changes to font style, size, and color display settings for Text Editor affect the appearance of text in your
default text editor. Documents opened in a text editor outside the IDE will not be affected by these
settings.
Printer
Changes to font style, size, and color display settings for Printer affect the appearance of text in printed
documents.
Note: As needed, you can select a different default font for printing than that used for display in the text
editor. This can be useful when printing code that contains both single-byte and double-byte characters.
Statement Completion
Changes the font style and size for the text that appears in statement completion pop-up in the editor.
Editor Tool tip
Changes the font style and size for the text that appears in ToolTips displayed in the editor.
Environment Font
Changes the font style and size for all IDE user interface elements that do not already have a separate
option in Show settings for. For example, this option applies to the Start Page but would not affect the
Output window.
[All Text Tool Windows]
Changes to font style, size, and color display settings for this item affect the appearance of text in tool
windows that have output panes in the IDE. For example, Output window, Command window, Immediate
window, etc.
Note: Changes to the text of [All Text Tool Windows] items do not take effect during the session in which
you make them. You can evaluate such changes by opening another instance of Atmel Studio.
Use Defaults/Use
Resets the font and color values of the list item selected in Show settings for. The Use button appears
when other display schemes are available for selection. For example, you can choose from two schemes
for the Printer.
Font (bold type indicates fixed-width fonts)
Lists all the fonts installed on your system. When the drop-down menu first appears, the current font for
the element selected in the Show settings for the field is highlighted. Fixed fonts — which are easier to
align in the editor — appear in bold.
Size
Lists available point sizes for the highlighted font. Changing the size of the font affects all Display items
for the Show settings for selection.
Display items
Lists the items for which you can modify the foreground and background color.
Note: PlainText is the default display item. As such, properties assigned to PlainText will be overridden
by properties assigned to other display items. For example, if you assign the color blue to PlainText and
the color green to Identifier, all identifiers will appear in green. In this example, Identifier properties
override PlainText properties.
Some of the display items include:
Display items
Description.
Plain Text
Text in the editor.
Selected Text
Text that is included in the current selection when the editor has focus.
Inactive Selected Text
Text that is included in the current selection when the editor has lost focus.
Indicator Margin
The margin at the left of the Code Editor where breakpoints and bookmark icons are displayed.
Line Numbers
Optional numbers that appear next to each line of code.
Visible White Space
Spaces, tabs, and word wrap indicators.
Bookmark
Lines that have bookmarks. A bookmark is visible only if the indicator margin is disabled.
Brace Matching (Highlight)
Highlighting that is typically bold formatting for matching braces.
Brace Matching (Rectangle)
Highlighting that is typically a grey rectangle in the background.
Breakpoint (Enabled)
Specifies the highlight color for statements or lines containing simple breakpoints. This option is
applicable only if statement-level breakpoints are active or the Highlight entire source line for breakpoints
or current statement option is selected on General, Debugging, and Options Dialog Box.
Breakpoint (Error)
Specifies the highlight color for statements or lines containing breakpoints that are in an error state.
Applicable only if statement-level breakpoints are active or the Highlight entire source line for breakpoints
or current statement option is selected on General, Debugging, and Options Dialog Box.
Breakpoint (Warning)
Specifies the highlight color for statements or lines containing breakpoints that are in a warning state.
Applicable only if statement-level breakpoints are active or the Highlight entire source line for breakpoints
or current statement option is selected on General, Debugging, and Options Dialog Box.
Breakpoint - Advanced (Disabled)
Specifies the highlight color for statements or lines containing disabled conditional or hit-counted
breakpoints. Applicable only if statement-level breakpoints are active or the Highlight entire source line for
breakpoints or current statement option is selected on General, Debugging, and Options Dialog Box.
Breakpoint - Advanced (Enabled)
Specifies the highlight color for statements or lines containing conditional or hit-counted breakpoints.
Applicable only if statement-level breakpoints are active or the Highlight entire source line for breakpoints
or current statement option is selected on General, Debugging, and Options Dialog Box.
Breakpoint - Advanced (Error)
Specifies the highlight color for statements or lines containing conditional or hit-counted breakpoints that
are in an error state. Applicable only if statement-level breakpoints are active or the Highlight entire
source line for breakpoints or current statement option is selected on General, Debugging, and Options
Dialog Box.
Breakpoint - Advanced (Warning)
Specifies the highlight color for statements or lines containing conditional or hit-counted breakpoints that
are in a warning state. Applicable only if statement-level breakpoints are active or the Highlight entire
source line for breakpoints or current statement option is selected on General, Debugging, and Options
Dialog Box.
Code Snippet Dependent Field
A field that will be updated when the current editable field is modified.
Code Snippet Field Editable
Keyword
Keywords for the given language that are reserved. For example class and namespace.
Memory Address
The color of text used to display the address column inside the Memory window.
Memory Changed
The color of text used to display changed data inside the Memory window.
Memory Data
The color of text used to display data inside the Memory window.
Memory Unreadable
The color of text used to display unreadable memory areas within the Memory window.
Number
A number in code that represents an actual numeric value. Operators such as +, -, and !=.
Other Error
Other error types not covered by other error squiggles. Currently, this includes rude edits in
<guimenuitem>Edit and Continue</guimenuitem>.
Preprocessor Keyword
Keywords used by the preprocessor such as #include.
Read-Only Region
Code that cannot be edited. For example, code displayed in the Code Definition View window or code
that cannot be modified during Edit and Continue.
Register Data
The color of text used to display data inside the Registers window.
Register NAT
The color of text used to display unrecognized data and objects inside the Registers window.
Stale Code
Superseded code awaiting an update. In some cases, Edit and Continue cannot apply code changes
immediately but will apply them later as you continue debugging. This occurs if you edit a function that
must call the function currently executing, or if you add more than 64 bytes of new variables to a function
waiting on the call stack. When this happens, the debugger displays a 'Stale Code Warning' dialog box,
and the superseded code continues to execute until the function in question finishes and is called again.
Edit and Continue apply the code changes at that time.
String
String literals.
Syntax Error
Parse errors.
Task List Shortcut
If a Task List shortcut is added to a line, and the indicator margin is disabled, the line will be highlighted.
Tracepoint (Enabled)
Specifies the highlight color for statements or lines containing simple tracepoints. This option is applicable
only if statement-level tracepoints are active or the Highlight entire source line for breakpoints or current
statement option is selected on General, Debugging, and Options Dialog Box.
Tracepoint (Error)
Specifies the highlight color for statements or lines containing tracepoints that are in an error state. This
option is applicable only if statement-level tracepoints are active or the Highlight entire source line for
breakpoints or current statement option is selected on General, Debugging, and Options Dialog Box.
Tracepoint (Warning)
Specifies the highlight color for statements or lines containing tracepoints that are in a warning state. This
option is applicable only if statement-level tracepoints are active or the Highlight entire source line for
breakpoints or current statement option is selected on General, Debugging, and Options Dialog Box.
Tracepoint - Advanced (Disabled)
Specifies the highlight color for statements or lines containing disabled conditional or hit-counted
tracepoints. This option is applicable only if statement-level tracepoints are active or the Highlight entire
source line for breakpoints or current statement option is selected on General, Debugging, and Options
Dialog Box.
Tracepoint - Advanced (Enabled)
Specifies the highlight color for statements or lines containing conditional or hit-counted tracepoints. This
option is applicable only if statement-level tracepoints are active or the Highlight entire source line for
breakpoints or current statement option is selected on General, Debugging, and Options Dialog Box.
Tracepoint - Advanced (Error)
Specifies the highlight color for statements or lines containing conditional or hit-counted tracepoints that
are in an error state. This option is applicable only if statement-level tracepoints are active or the Highlight
entire source line for breakpoints or current statement option is selected on General, Debugging, and
Options Dialog Box.
Tracepoint - Advanced (Warning)
Specifies the highlight color for statements or lines containing conditional or hit-counted tracepoints that
are in a warning state. This option is applicable only if statement-level tracepoints are active or the
Highlight entire source line for breakpoints or current statement option is selected on General,
Debugging, and Options Dialog Box.
Track Changes after save
Lines of code that have been modified since the file was opened but are saved to disk.
Track Changes before save
Lines of code that have been modified since the file was opened but are not saved to disk.
User Types
Types defined by users.
User Types (Delegates)
You can access this dialog box by selecting Options from the Tools menu and then choosing
International Settings from the Environment folder. If this page does not appear in the list, select Show
all settings in the Options dialog box.
Any changes you make on this page apply only to the default IDE and do not take effect until the
environment is restarted.
Language
Lists the available languages for the installed product language versions. This option is unavailable
unless you have more than one language version installed on your machine. If multiple languages of
products or a mixed language installation of products share the environment, the language selection is
changed to Same as Microsoft Windows.
CAUTION
In a system with multiple languages installed, the build tools are not affected by this setting.
These tools use the version for the last language installed and the tools for the previously
installed language are overwritten because the build tools do not use the satellite DLL model.
Tip:
If this page does not appear in the list, select Show all setting in the Options dialog box.
Note: The options available in dialog boxes, and the names and locations of menu commands you see
might differ from what is described in Help depending on your active settings or edition. This Help page
was written with General Development Settings in mind. To change your settings, choose Import and
Export Settings on the Tools menu.
Automatically load and save settings
Automatically save my settings to this file:
Displays the location and name of the .vssettings file you are currently using. When you close the IDE,
any changes you have made, such as moving windows or changing option selections, are saved to the
current file. The next time you start the IDE, your settings are loaded.
Team settings
Use team settings file:
When selected, allows you to navigate to a shared .vssettings file by using the Browse button. This
settings file is automatically re-applied each time Atmel Studio detects if a newer version is available.
Note: The location of the team settings file must be specified as a UNC path or local path. URLs and
other protocols are not supported paths.
9.3.1.10 Task List
This Options page allows you to add, delete, and change the comment tokens that generate Task List
reminders. To display these settings, select Options from the Tools menu, expand the Environment folder,
and choose Task List.
Confirm deletion of tasks
When selected, a message box is displayed whenever a User Task is deleted from the Task List, allowing
you to confirm the deletion. This option is selected by default.
Note: To delete a Task Comment, use the link to find the comment, and then remove it from your code.
Hide full file paths
When selected, the File column of the Task List displays only the names of files to be edited, not their full
paths.
Tokens
When you insert a comment into your code whose text begins with a token from the Token List, the Task
List displays your comment as new entry whenever the file is opened for editing. You can click this Task
List entry to jump directly to the comment line in your code.
Token List
Displays a list of tokens, and allows you to add or remove custom tokens. Comment tokens are case
sensitive.
Note: If you do not type the desired token exactly as it appears in the Token List, a comment task will
not be displayed in the Task List.
Priority
Sets the priority of tasks that use the selected token. Task comments that begin with this token are
automatically assigned the designated priority in the Task List.
Name
Enter the token string. This enables the Add button. On Add, this string is included in the Token List, and
comments that begin with this name will be displayed in the Task List.
Add
Enabled when you enter a new Name. Click to add a new token string using the values entered in the
Name and Priority fields.
Delete
Click to delete the selected token from the Token List. You cannot delete the default comment token.
Change
Click to make changes to an existing token using the values entered in the Name and Priority fields.
Note: You cannot rename or delete the default comment token, but you can change its priority level.
9.3.1.11 Web Browser Options
Sets options for both the internal Web browser and Internet Explorer. To access this dialog box, click
Options on the Tools menu, expand the Environment folder, and select Web Browser.
Note: The dialog boxes and menu commands you see might differ from those described in Help
depending on your active settings or edition. To change your settings, choose Import and Export Settings
on the Tools menu.
Attention:
Opening certain files or components from the Web can execute code on your computer.
Home page
Sets the page displayed when you open the Integrated Development Environment Web Browser.
Search page
Lets you designate a Search page for the internal Web browser. This location can differ from the search
page used by instances of Internet Explorer initiated outside of the integrated development environment
(IDE).
View Source in
Sets the editor used to open a Web page when you choose View Source on the page from the internal
Web browser.
Source editor
Select to view source in the Code and Text Editor.
HTML editor
Select to view source in the HTML Designer. Use this selection to edit the Web page in one of two views:
Design view or the standard text-based Source view.
External editor
Select to view source in another editor. Specify the path of any editor you choose, for example,
Notepad.exe.
Internet Explorer Options
Click to change options for Internet Explorer in the Internet Properties dialog box. Changes made in this
dialog box affect both the internal Web browser and instances of Internet Explorer initiated outside of the
Atmel Studio IDE (for example, from the Start menu).
3. In the Customize Start Page list, select the Start Page you want.
4. This list includes every .xaml file in your user Start Pages folder and any installed extensions of
type StartPage.
5. Click OK.
Troubleshooting
It is possible for an error in a third-party Start Page to cause Atmel Studio to crash. If this happens, you
can start Atmel Studio in safe mode by adding the /SafeMode switch to the application, i.e.
avrstudio5.exe /SafeMode.
This prevents the bad Start Page from loading. You can then return to the Options dialog box and reset
Atmel Studio to use the default Start Page.
one configuration or the two configurations debug and release. If a project has a user-defined
configuration, the build configuration options are shown.
When deselected, the commands on the Build menu, such as Build Solution, Rebuild Solution, and Clean
Solution, are performed on the Release configuration and the commands on the Debug menu, such as
Start Debugging and Start Without Debugging, are performed on the Debug configuration.
Always show solution
When selected, the solution and all commands that act on solutions are always shown in the IDE. When
cleared, all projects are created as standalone projects and you do not see the solution in Solution
Explorer or commands that act on solutions in the IDE if the solution contains only one project.
Save new projects when created
When selected, you can specify a location for your project in the New Project dialog box. When cleared,
all new projects are created as temporary projects. When you are working with temporary projects, you
can create and experiment with a project without having to specify a disk location.
Warn user when the project location is not trusted
If you attempt to create a new project or open an existing project in a location that is not fully trusted (for
example, on a UNC path or an HTTP path), a message is displayed. Use this option to specify whether
the message is displayed each time that you attempt to create or open a project in a location that is not
fully trusted.
Show Output window when build starts
Automatically displays the Output Window in the IDE at the outset of solution builds.
Prompt for symbolic renaming when renaming files
When selected, displays a message box asking whether or not Atmel Studio 7 should also rename all
references in the project to the code element.
9.3.2.2 Build and Run Options
Determines whether changed files are automatically saved when a project or its solution is built, the
maximum number of Visual C++ projects that can build at the same time, and certain default behavior on
Run. To access this dialog box, on the Tools menu, click Options, click Projects and Solutions, and then
click Build and Run.
Save all changes
Automatically saves changes to the solution file and all project files that were changed since the last build
when you press F5, or click Start on the Debug menu or Build on the Build menu. No prompt is given.
Items are saved with their current names. By default, this option is enabled.
Save changes to open documents only
Automatically saves changes to all open documents when you press F5, or click Start on the Debug
menu or Build on the Build menu. No prompt is given.
Prompt to save all changes
When selected, displays a dialog box that asks whether you want to save changes to the solution and
project items when you press F5 or click Start on the Debug menu or Build on the Build menu. The Save
As dialog box is displayed so that you can assign a name and location to your project. If this option is not
selected, the project runs by using the memory image that contains your changes, but the changes are
not saved.
CAUTION
This page sets default options for all development languages. Remember that resetting an
option in this dialog will reset the General options in all languages to whatever choices are
selected here. To change Text Editor options for just one language, expand the subfolder for
that language and select its option pages.
A grayed checkmark is displayed when an option has been selected on the General options pages for
some programming languages, but not for others.
Note: The dialog boxes and menu commands you see might differ from those described in Help
depending on your active settings or edition. To change your settings, choose Import and Export Settings
on the Tools menu.
Statement Completion
Auto list members
When selected, pop-up lists of available members, properties, values, or methods are displayed by
IntelliSense as you type in the editor. Choose any item from the pop-up list to insert the item into your
code. Selecting this option enables the Hide advanced members option.
Hide advanced members
When selected, shortens pop-up statement completion lists by displaying only those items most
commonly used. Other items are filtered from the list.
Parameter information
When selected, the complete syntax for the current declaration or procedure is displayed under the
insertion point in the editor, with all of its available parameters. The next parameter you can assign is
displayed in bold.
Settings
Enable virtual space
When this option is selected and Word wrap is cleared, you can click anywhere beyond the end of a line
in the Code Editor, and type. This feature can be used to position comments at a consistent point next to
your code.
Word wrap
When selected, any portion of a line that extends horizontally beyond the viewable editor area is
automatically displayed on the next line. Selecting this option enables the Show visual glyphs for word
wrap option.
Note: The Virtual Space feature is turned off while Word Wrap is on.
Show visual glyphs for word wrap
When selected, a return-arrow indicator is displayed where a long line wraps onto a second line.
Tip:
To display indicators for spaces, tabs, and line ends, and thus distinguish indented lines from
lines that are entirely blank, select Advanced from the Edit menu and choose View White
Space.
Display
Line numbers
When selected, a line number appears next to each line of code.
Note: These line numbers are not added to your code, and do not print. They are for reference only.
Enable single-click URL navigation
When selected, the mouse cursor changes to a pointing hand as it passes over a URL in the editor. You
can click the URL to display the indicated page in your Web browser.
Navigation bar
When selected, the Navigation bar at the top of the code editor is displayed. Its drop-down Objects and
Members lists allow you to choose a particular object in your code, select from its members, and
navigates to the declaration of the selected member in the Code Editor.
9.3.4.4 Tabs Dialog
This dialog box allows you to change the default behavior of the Code Editor. These settings also apply to
other editors based upon the Code Editor, such as the HTML Designer's Source view. To display these
options, select Options from the Tools menu. Within the Text Editor folder expand the All Languages
subfolder and then choose Tabs.
CAUTION
This page sets default options for all development languages. Remember that resetting an
option in this dialog will reset the Tabs options in all languages to whatever choices are selected
here. To change Text Editor options for just one language, expand the subfolder for that
language and select its option pages.
If different settings are selected on the Tabs options pages for particular programming
languages, then the message 'The indentation settings for individual text formats conflict with
each other,' is displayed for differing Indenting options; and the message 'The tab settings for
individual text formats conflict with each other,' is displayed for differing Tab options.
Note: The dialog boxes and menu commands you see might differ from those described in Help
depending on your active settings or edition. To change your settings, choose Import and Export Settings
on the Tools menu.
Indenting
None
When selected, new lines are not indented. The insertion point is placed in the first column of a new line.
Block
When selected, new lines are automatically indented. The insertion point is placed at the same starting
point as the preceding line.
Smart
When selected, new lines are positioned to fit the code context, per other code formatting settings and
IntelliSense conventions for your development language. This option is not available for all development
languages.
For example, lines enclosed between an opening brace ( { ) and a closing brace ( } ) might automatically
be indented an extra tab stop from the position of the aligned braces.
Tab and indent size
Sets the distance in spaces between tab stops and for automatic indentation. The default is four spaces.
Tab characters, space characters, or both will be inserted to fill the specified size.
Insert spaces
When selected, indent operations insert only space characters, not TAB characters. If the Tab and Indent
size are set to 5, for example, then five space characters are inserted whenever you press the TAB key or
the Increase Indent button on the Formatting toolbar.
Keep tabs
When selected, each indent operation inserts one TAB character.
9.3.4.5 AVR Assembler Language-Specific Settings
9.3.4.5.1 General Language Options
This dialog box allows you to change the default behavior of the Code Editor. These settings also apply to
other editors based upon the Code Editor, such as the HTML Designer's Source view. To open this dialog
box, select Options from the Tools menu. Within the Text Editor folder, expand the All Languages
subfolder and then choose General.
CAUTION
This page sets default options for all development languages. Remember that resetting an
option in this dialog will reset the General options in all languages to whatever choices are
selected here. To change Text Editor options for just one language, expand the subfolder for
that language and select its option pages.
A grayed checkmark is displayed when an option has been selected on the General options pages for
some programming languages, but not for others.
Note: The dialog boxes and menu commands you see might differ from those described in Help
depending on your active settings or edition. To change your settings, choose Import and Export Settings
on the Tools menu.
Statement Completion
Auto list members
When selected, pop-up lists of available members, properties, values, or methods are displayed by
IntelliSense as you type in the editor. Choose any item from the pop-up list to insert the item into your
code. Selecting this option enables the Hide advanced members option.
Hide advanced members
When selected it shortens the pop-up statement completion lists by displaying only those items most
commonly used. Other items are filtered from the list.
Parameter information
When selected, the complete syntax for the current declaration or procedure is displayed under the
insertion point in the editor, with all of its available parameters. The next parameter you can assign is
displayed in bold.
Settings
Enable virtual space
When this option is selected and Word wrap is cleared, you can click anywhere beyond the end of a line
in the Code Editor and type. This feature can be used to position comments at a consistent point next to
your code.
Word wrap
When selected, any portion of a line that extends horizontally beyond the viewable editor area is
automatically displayed on the next line. Selecting this option enables the Show visual glyphs for word
wrap option.
Note: The Virtual Space feature is turned off while Word Wrap is on.
Show visual glyphs for word wrap
When selected, a return-arrow indicator is displayed where a long line wraps onto a second line.
Clear this option if you prefer not to display these indicators.
Note: These reminder arrows are not added to your code, and do not print. They are for reference only.
Apply Cut or Copy commands to blank lines when there is no selection
This option sets the behavior of the editor when you place the insertion point on a blank line, select
nothing, and then Copy or Cut.
When this option is selected, the blank line is copied or cut. If you then Paste, a new, blank line is
inserted.
When this option is cleared, the Cut command removes blank lines. However, the data on the Clipboard
is preserved. Therefore, if you then use the Paste command, the content most recently copied onto the
Clipboard is pasted. If nothing has been copied previously, nothing is pasted.
This setting has no effect on Copy or Cut when a line is not blank. If nothing is selected, the entire line is
copied or cut. If you then Paste, the text of the entire line and its endline character are pasted.
Tip:
To display indicators for spaces, tabs, and line ends, and thus distinguish indented lines from
lines that are entirely blank, select Advanced from the Edit menu and choose View White
Space.
Display
Line numbers
When selected, a line number appears next to each line of code.
Note: These line numbers are not added to your code, and do not print. They are for reference only.
Enable single-click URL navigation
When selected, the mouse cursor changes to a pointing hand as it passes over a URL in the editor. You
can click the URL to display the indicated page in your Web browser.
Navigation bar
When selected, displays the Navigation bar at the top of the code editor. Its drop-down Objects and
Members lists allow you to choose a particular object in your code, select from its members, and
navigates to the declaration of the selected member in the Code Editor.
9.3.4.5.2 Tabs Dialog
This dialog box allows you to change the default behavior of the Code Editor. These settings also apply to
other editors based upon the Code Editor, such as the HTML Designer's Source view. To display these
options, select Options from the Tools menu. Within the Text Editor folder expand the All Languages
subfolder and then choose Tabs.
CAUTION
This page sets default options for all development languages. Remember that resetting an
option in this dialog will reset the Tabs options in all languages to whatever choices are selected
here. To change Text Editor options for just one language, expand the subfolder for that
language and select its option pages.
If different settings are selected on the Tabs options pages for particular programming
languages, then the message 'The indentation settings for individual text formats conflict with
each other,' is displayed for differing Indenting options; and the message 'The tab settings for
individual text formats conflict with each other,' is displayed for differing Tab options.
Note: The dialog boxes and menu commands you see might differ from those described in Help
depending on your active settings or edition. To change your settings, choose Import and Export Settings
on the Tools menu.
Indenting
None
When selected, new lines are not indented. The insertion point is placed in the first column of a new line.
Block
When selected, new lines are automatically indented. The insertion point is placed at the same starting
point as the preceding line.
Smart
When selected, new lines are positioned to fit the code context, per other code formatting settings and
IntelliSense conventions for your development language. This option is not available for all development
languages.
For example, lines enclosed between an opening brace ( { ) and a closing brace ( } ) might automatically
be indented an extra tab stop from the position of the aligned braces.
Tab and indent size
Sets the distance in spaces between tab stops and for automatic indentation. The default is four spaces.
Tab characters, space characters, or both will be inserted to fill the specified size.
Insert spaces
When selected, indent operations insert only space characters, not TAB characters. If the Tab and Indent
size are set to 5, for example, then five space characters are inserted whenever you press the TAB key or
the Increase Indent button on the Formatting toolbar.
Keep tabs
When selected, each indent operation inserts one TAB character.
9.3.4.6 AVR GCC Language-Specific Settings
9.3.4.6.1 General Language Options
This dialog box allows you to change the default behavior of the Code Editor. These settings also apply to
other editors based upon the Code Editor, such as the HTML Designer's Source view. To open this dialog
box, select Options from the Tools menu. Within the Text Editor folder, expand the All Languages
subfolder and then choose General.
CAUTION
This page sets default options for all development languages. Remember that resetting an
option in this dialog will reset the General options in all languages to whatever choices are
selected here. To change Text Editor options for just one language, expand the subfolder for
that language and select its option pages.
A grayed checkmark is displayed when an option has been selected on the General options pages for
some programming languages, but not for others.
Note: The dialog boxes and menu commands you see might differ from those described in Help
depending on your active settings or edition. To change your settings, choose Import and Export Settings
on the Tools menu.
Statement Completion
Auto list members
When selected, pop-up lists of available members, properties, values, or methods are displayed by
IntelliSense as you type in the editor. Choose any item from the pop-up list to insert the item into your
code. Selecting this option enables the Hide advanced members option.
Hide advanced members
When selected it shortens the pop-up statement completion lists by displaying only those items most
commonly used. Other items are filtered from the list.
Parameter information
When selected, the complete syntax for the current declaration or procedure is displayed under the
insertion point in the editor, with all of its available parameters. The next parameter you can assign is
displayed in bold.
Settings
Enable virtual space
When this option is selected and Word wrap is cleared, you can click anywhere beyond the end of a line
in the Code Editor and type. This feature can be used to position comments at a consistent point next to
your code.
Word wrap
When selected, any portion of a line that extends horizontally beyond the viewable editor area is
automatically displayed on the next line. Selecting this option enables the Show visual glyphs for word
wrap option.
Note: The Virtual Space feature is turned off while Word Wrap is on.
Show visual glyphs for word wrap
When selected, a return-arrow indicator is displayed where a long line wraps onto a second line.
Clear this option if you prefer not to display these indicators.
Note: These reminder arrows are not added to your code, and do not print. They are for reference only.
Apply Cut or Copy commands to blank lines when there is no selection
This option sets the behavior of the editor when you place the insertion point on a blank line, select
nothing, and then Copy or Cut.
When this option is selected, the blank line is copied or cut. If you then Paste, a new, blank line is
inserted.
When this option is cleared, the Cut command removes blank lines. However, the data on the Clipboard
is preserved. Therefore, if you then use the Paste command, the content most recently copied onto the
Clipboard is pasted. If nothing has been copied previously, nothing is pasted.
This setting has no effect on Copy or Cut when a line is not blank. If nothing is selected, the entire line is
copied or cut. If you then Paste, the text of the entire line and its endline character are pasted.
Tip:
To display indicators for spaces, tabs, and line ends, and thus distinguish indented lines from
lines that are entirely blank, select Advanced from the Edit menu and choose View White
Space.
Display
Line numbers
When selected, a line number appears next to each line of code.
Note: These line numbers are not added to your code, and do not print. They are for reference only.
Enable single-click URL navigation
When selected, the mouse cursor changes to a pointing hand as it passes over a URL in the editor. You
can click the URL to display the indicated page in your Web browser.
Navigation bar
When selected, displays the Navigation bar at the top of the code editor. Its drop-down Objects and
Members lists allow you to choose a particular object in your code, select from its members, and
navigates to the declaration of the selected member in the Code Editor.
9.3.4.6.2 Tabs Dialog
This dialog box allows you to change the default behavior of the Code Editor. These settings also apply to
other editors based upon the Code Editor, such as the HTML Designer's Source view. To display these
options, select Options from the Tools menu. Within the Text Editor folder expand the All Languages
subfolder and then choose Tabs.
CAUTION
This page sets default options for all development languages. Remember that resetting an
option in this dialog will reset the Tabs options in all languages to whatever choices are selected
here. To change Text Editor options for just one language, expand the subfolder for that
language and select its option pages.
If different settings are selected on the Tabs options pages for particular programming
languages, then the message 'The indentation settings for individual text formats conflict with
each other,' is displayed for differing Indenting options; and the message 'The tab settings for
individual text formats conflict with each other,' is displayed for differing Tab options.
Note: The dialog boxes and menu commands you see might differ from those described in Help
depending on your active settings or edition. To change your settings, choose Import and Export Settings
on the Tools menu.
Indenting
None
When selected, new lines are not indented. The insertion point is placed in the first column of a new line.
Block
When selected, new lines are automatically indented. The insertion point is placed at the same starting
point as the preceding line.
Smart
When selected, new lines are positioned to fit the code context, per other code formatting settings and
IntelliSense conventions for your development language. This option is not available for all development
languages.
For example, lines enclosed between an opening brace ( { ) and a closing brace ( } ) might automatically
be indented an extra tab stop from the position of the aligned braces.
Tab and indent size
Sets the distance in spaces between tab stops and for automatic indentation. The default is four spaces.
Tab characters, space characters, or both will be inserted to fill the specified size.
Insert spaces
When selected, indent operations insert only space characters, not TAB characters. If the Tab and Indent
size are set to 5, for example, then five space characters are inserted whenever you press the TAB key or
the Increase Indent button on the Formatting toolbar.
Keep tabs
When selected, each indent operation inserts one TAB character.
9.3.4.7 Plain Text Settings
9.3.4.7.1 General Language Options
This dialog box allows you to change the default behavior of the Code Editor. These settings also apply to
other editors based upon the Code Editor, such as the HTML Designer's Source view. To open this dialog
box, select Options from the Tools menu. Within the Text Editor folder, expand the All Languages
subfolder and then choose General.
CAUTION
This page sets default options for all development languages. Remember that resetting an
option in this dialog will reset the General options in all languages to whatever choices are
selected here. To change Text Editor options for just one language, expand the subfolder for
that language and select its option pages.
A grayed checkmark is displayed when an option has been selected on the General options pages for
some programming languages, but not for others.
Note: The dialog boxes and menu commands you see might differ from those described in Help
depending on your active settings or edition. To change your settings, choose Import and Export Settings
on the Tools menu.
Statement Completion
Auto list members
When selected, pop-up lists of available members, properties, values, or methods are displayed by
IntelliSense as you type in the editor. Choose any item from the pop-up list to insert the item into your
code. Selecting this option enables the Hide advanced members option.
Hide advanced members
When selected, it shortens the pop-up statement completion lists by displaying only those items most
commonly used. Other items are filtered from the list.
Parameter information
When selected, the complete syntax for the current declaration or procedure is displayed under the
insertion point in the editor, with all of its available parameters. The next parameter you can assign is
displayed in bold.
Settings
Enable virtual space
When this option is selected and Word wrap is cleared, you can click anywhere beyond the end of a line
in the Code Editor and type. This feature can be used to position comments at a consistent point next to
your code.
Word wrap
When selected, any portion of a line that extends horizontally beyond the viewable editor area is
automatically displayed on the next line. Selecting this option enables the Show visual glyphs for word
wrap option.
Note: The Virtual Space feature is turned OFF while Word Wrap is ON.
Show visual glyphs for word wrap
When selected, a return-arrow indicator is displayed where a long line wraps onto a second line.
Clear this option if you prefer not to display these indicators.
Note: These reminder arrows are not added to your code, and do not print. They are for reference only.
Apply Cut or Copy commands to blank lines when there is no selection
This option sets the behavior of the editor when you place the insertion point on a blank line, select
nothing, and then Copy or Cut.
When this option is selected, the blank line is copied or cut. If you then Paste, a new, blank line is
inserted.
When this option is cleared, the Cut command removes blank lines. However, the data on the Clipboard
is preserved. Therefore, if you then use the Paste command, the content most recently copied onto the
Clipboard is pasted. If nothing has been copied previously, nothing is pasted.
This setting has no effect on Copy or Cut when a line is not blank. If nothing is selected, the entire line is
copied or cut. If you then Paste, the text of the entire line and its endline character are pasted.
Tip:
To display indicators for spaces, tabs, and line ends, and thus distinguish indented lines from
lines that are entirely blank, select Advanced from the Edit menu and choose View White
Space.
Display
Line numbers
When selected, a line number appears next to each line of code.
Note: These line numbers are not added to your code, and do not print. They are for reference only.
Enable single-click URL navigation
When selected, the mouse cursor changes to a pointing hand as it passes over a URL in the editor. You
can click the URL to display the indicated page in your Web browser.
Navigation bar
When selected, displays the Navigation bar at the top of the code editor. Its drop-down Objects and
Members lists allow you to choose a particular object in your code, select from its members, and
navigates to the declaration of the selected member in the Code Editor.
9.3.4.7.2 Tabs Dialog
This dialog box allows you to change the default behavior of the Code Editor. These settings also apply to
other editors based upon the Code Editor, such as the HTML Designer's Source view. To display these
options, select Options from the Tools menu. Within the Text Editor folder expand the All Languages
subfolder and then choose Tabs.
CAUTION
This page sets default options for all development languages. Remember that resetting an
option in this dialog will reset the Tabs options in all languages to whatever choices are selected
here. To change Text Editor options for just one language, expand the subfolder for that
language and select its option pages.
If different settings are selected on the Tabs options pages for particular programming
languages, then the message 'The indentation settings for individual text formats conflict with
each other,' is displayed for differing Indenting options; and the message 'The tab settings for
individual text formats conflict with each other,' is displayed for differing Tab options.
Note: The dialog boxes and menu commands you see might differ from those described in Help
depending on your active settings or edition. To change your settings, choose Import and Export Settings
on the Tools menu.
Indenting
None
When selected, new lines are not indented. The insertion point is placed in the first column of a new line.
Block
When selected, new lines are automatically indented. The insertion point is placed at the same starting
point as the preceding line.
Smart
When selected, new lines are positioned to fit the code context, per other code formatting settings and
IntelliSense conventions for your development language. This option is not available for all development
languages.
For example, lines enclosed between an opening brace ( { ) and a closing brace ( } ) might automatically
be indented an extra tab stop from the position of the aligned braces.
Tab and indent size
Sets the distance in spaces between tab stops and for automatic indentation. The default is four spaces.
Tab characters, space characters, or both will be inserted to fill the specified size.
Insert spaces
When selected, indent operations insert only space characters, not TAB characters. If the Tab and Indent
size are set to 5, for example, then five space characters are inserted whenever you press the TAB key or
the Increase Indent button on the Formatting toolbar.
Keep tabs
When selected, each indent operation inserts one TAB character.
9.3.4.8 XML Settings
9.3.4.8.1 General Language Options
This dialog box allows you to change the default behavior of the Code Editor. These settings also apply to
other editors based upon the Code Editor, such as the HTML Designer's Source view. To open this dialog
box, select Options from the Tools menu. Within the Text Editor folder, expand the All Languages
subfolder and then choose General.
CAUTION
This page sets default options for all development languages. Remember that resetting an
option in this dialog will reset the General options in all languages to whatever choices are
selected here. To change Text Editor options for just one language, expand the subfolder for
that language and select its option pages.
A grayed checkmark is displayed when an option has been selected on the General options pages for
some programming languages, but not for others.
Note: The dialog boxes and menu commands you see might differ from those described in Help
depending on your active settings or edition. To change your settings, choose Import and Export Settings
on the Tools menu.
Statement Completion
Auto list members
When selected, pop-up lists of available members, properties, values, or methods are displayed by
IntelliSense as you type in the editor. Choose any item from the pop-up list to insert the item into your
code. Selecting this option enables the Hide advanced members option.
Hide advanced members
When selected, shortens pop-up statement completion lists by displaying only those items most
commonly used. Other items are filtered from the list.
Parameter information
When selected, the complete syntax for the current declaration or procedure is displayed under the
insertion point in the editor, with all of its available parameters. The next parameter you can assign is
displayed in bold.
Settings
Enable virtual space
When this option is selected and Word wrap is cleared, you can click anywhere beyond the end of a line
in the Code Editor and type. This feature can be used to position comments at a consistent point next to
your code.
Word wrap
When selected, any portion of a line that extends horizontally beyond the viewable editor area is
automatically displayed on the next line. Selecting this option enables the Show visual glyphs for word
wrap option.
Note: The Virtual Space feature is turned off while Word Wrap is on.
Show visual glyphs for word wrap
When selected, a return-arrow indicator is displayed where a long line wraps onto a second line.
Clear this option if you prefer not to display these indicators.
Note: These reminder arrows are not added to your code, and do not print. They are for reference only.
Apply Cut or Copy commands to blank lines when there is no selection
This option sets the behavior of the editor when you place the insertion point on a blank line, select
nothing, and then Copy or Cut.
When this option is selected, the blank line is copied or cut. If you then Paste, a new, blank line is
inserted.
When this option is cleared, the Cut command removes blank lines. However, the data on the Clipboard
is preserved. Therefore, if you then use the Paste command, the content most recently copied onto the
Clipboard is pasted. If nothing has been copied previously, nothing is pasted.
This setting has no effect on Copy or Cut when a line is not blank. If nothing is selected, the entire line is
copied or cut. If you then Paste, the text of the entire line and its endline character are pasted.
Tip:
To display indicators for spaces, tabs, and line ends, and thus distinguish indented lines from
lines that are entirely blank, select Advanced from the Edit menu and choose View White
Space.
Display
Line numbers
When selected, a line number appears next to each line of code.
Note: These line numbers are not added to your code, and do not print. They are for reference only.
Enable single-click URL navigation
When selected, the mouse cursor changes to a pointing hand as it passes over a URL in the editor. You
can click the URL to display the indicated page in your Web browser.
Navigation bar
When selected, displays the Navigation bar at the top of the code editor. Its drop-down Objects and
Members lists allow you to choose a particular object in your code, select from its members, and
navigates to the declaration of the selected member in the Code Editor.
9.3.4.8.2 Tabs Dialog
This dialog box allows you to change the default behavior of the Code Editor. These settings also apply to
other editors based upon the Code Editor, such as the HTML Designer's Source view. To display these
options, select Options from the Tools menu. Within the Text Editor folder expand the All Languages
subfolder and then choose Tabs.
CAUTION
This page sets default options for all development languages. Remember that resetting an
option in this dialog will reset the Tabs options in all languages to whatever choices are selected
here. To change Text Editor options for just one language, expand the subfolder for that
language and select its option pages.
If different settings are selected on the Tabs options pages for particular programming
languages, then the message 'The indentation settings for individual text formats conflict with
each other,' is displayed for differing Indenting options; and the message 'The tab settings for
individual text formats conflict with each other,' is displayed for differing Tab options.
Note: The dialog boxes and menu commands you see might differ from those described in Help
depending on your active settings or edition. To change your settings, choose Import and Export Settings
on the Tools menu.
Indenting
None
When selected, new lines are not indented. The insertion point is placed in the first column of a new line.
Block
When selected, new lines are automatically indented. The insertion point is placed at the same starting
point as the preceding line.
Smart
When selected, new lines are positioned to fit the code context, per other code formatting settings and
IntelliSense conventions for your development language. This option is not available for all development
languages.
For example, lines enclosed between an opening brace ( { ) and a closing brace ( } ) might automatically
be indented an extra tab stop from the position of the aligned braces.
Tab and indent size
Sets the distance in spaces between tab stops and for automatic indentation. The default is four spaces.
Tab characters, space characters, or both will be inserted to fill the specified size.
Insert spaces
When selected, indent operations insert only space characters, not TAB characters. If the Tab and Indent
size are set to 5, for example, then five space characters are inserted whenever you press the TAB key or
the Increase Indent button on the Formatting toolbar.
Keep tabs
When selected, each indent operation inserts one TAB character.
9.3.4.8.3 XML Formatting Options
This dialog box allows you to specify the formatting settings for the XML Editor. You can access the
Options dialog box from the Tools menu.
Note: These settings are available when you select the Text Editor folder, the XML folder, and then the
Formatting option from the Options dialog box.
Attributes
Preserve manual attribute formatting Attributes are not reformatted. This is the default.
Note: If the attributes are on multiple lines, the editor indents each line of attributes to match the
indentation of the parent element.
Align attributes each on their own line
Aligns the second and subsequent attributes vertically to match the indentation of the first attribute. The
following XML text is an example of how the attributes would be aligned.
<item id = "123-A"
name = "hammer"
price = "9.95">
</item>
Auto Reformat
On paste from the Clipboard
Reformats XML text pasted from the Clipboard.
On completion of end tag
Reformats the element when the end tag is completed.
Mixed Content
Preserve mixed content by default
Determines whether the editor reformats mixed content. By default, the editor attempts to reformat mixed
content, except when the content is found in an xml:space="preserve" scope.
If an element contains a mix of text and markup, the contents are considered to be mixed content. The
following is an example of an element with mixed content.
<dir>c:\data\AlphaProject\
<file readOnly="false">test1.txt</file>
<file readOnly="false">test2.txt</file>
</dir>
9.3.4.8.4 XML Miscellaneous Options
This dialog box allows you to change the autocompletion and schema settings for the XML Editor. You
can access the Options dialog box from the Tools menu.
Note: These settings are available when you select the Text Editor folder, the XML folder, and then the
Miscellaneous option from the Options dialog box.
Auto Insert
Close tags
If the autocompletion setting is checked, the editor automatically adds an end tag when you type a right
angle bracket (>) to close a start tag, if the tag is not already closed. This is the default behavior.
The completion of an empty element does not depend on the autocompletion setting. You can always
autocomplete an empty element by typing a backslash (/).
Attribute quotes
When authoring XML attributes, the editor inserts the =" " characters and positions the caret (^) inside the
double quotes.
Selected by default.
Namespace declarations
The editor automatically inserts namespace declarations wherever they are needed.
Selected by default.
Other markup (Comments, CDATA)
Comments, CDATA, DOCTYPE, processing instructions, and other markup are auto-completed.
Selected by default.
Network
Automatically download DTDs and schemas
Schemas and document type definitions (DTDs) are automatically downloaded from HTTP locations. This
feature uses System.Net with auto-proxy server detection enabled.
Selected by default.
Outlining
Enter outlining mode when files open
Turns on the outlining feature when a file is opened.
Selected by default.
Caching
Schemas
Specifies the location of the schema cache. The browse button ( ...) opens the Directory Browse dialog
box at the current schema cache location. You can select a different directory, or you can select a folder
in the dialog, right-click, and choose Open to see what is in the directory.
9.3.5 Debugger
9.3.5.1 Usage
In Atmel Studio, you can specify various settings for debugger behavior, including how variables are
displayed, whether certain warnings are presented, how breakpoints are set, and how breaking affects
running programs. You specify debugger settings in the Options dialog box.
To set debugger options
On the Tools menu, click Options.
In the Options dialog box, open the Debugging folder.
In the Debugging folder, choose the category of options you want.
Indicates the Windows Comm API Port number, used by the AVR debugger. 0 by default.
RPC transaction times
Filename to put statistic logging in. This is log data from the communication with the back-end. Empty
means no logging. Note that the file must be written to a directory where the user has write permission.
E.g. C:/tmp/transactionlog.csv
User Tool polling
Use internal port polling method for hardware tool discovery, instead of relying on Windows Comm
Framework. Must restart Atmel Studio if activated, it may slow down your PC considerably, so use it only
if you have errors related to Windows Comm Framework. Disabled by default.
9.3.7 Builder
Figure 9-1. Builder
ShellUtils Packages
It will list Default, Custom, and installed Shell Utility extensions.
ShellUtils Path
Based on the package selected the ShellUtils Path will point to the corresponding utilities folder. If you
select a custom ShellUtil package then you can configure a custom Shell utilities folder by clicking on the
select file( ...) button. If you select default or installed shell extension package then the path will be read-
only and point to the package path.
Make Configuration
You can configure the path to the Make executable by clicking on the select file( ...) button by default it
points to INSTALLDIR\shellUtils\make.exe and you can enable parallel build of projects by checking the
box.
How severe the incident must be in order to generate a log entry. You can choose whether you want to
have an output when all operations are successful - OK level, when some unorthodox code is present -
Info level, when some operations have been canceled - Cancel setting. If you want to generate output
only in the case when the code is potentially unstable or erroneous, choose either Warning or Error
setting.
Component filter
Filter messages coming from the source code for standard or custom components in your design.
Severity threshold
Meaning identical to the Severity threshold for your source code log generation.
Use filter
Whether the logging process should use a filter to separate components output from your code output.
9.3.11 Toolchain
Figure 9-2. Toolchain Flavor Configuration
Toolchain
Toolchain is used to compile, link, and transform the source code to an executable form targeting the AVR
devices. By default, AVR Studio has the following Toolchain Type extensions.
C++
C++
C++
9.3.11.1 Flavor
Flavor identifies a particular version of Toolchain extension of a desired Toolchain type. You could have
different flavors of same Toolchain type extensions installed for Atmel Studio.
9.3.11.1.1 Add Flavor
1. Select a Toolchain type for which the new Flavor is to be added.
Figure 9-3. Add Toolchain Flavor
2. Copy the path of the code snippet to the clipboard and click OK.
3. On the File menu, click Open, and click File.
4. Paste the snippet path into the File location box and click OK.
5. Modify the snippet.
6. On the File menu, click Save. You must have write access to the file to save it.
The dialog contains a list box where all previously defined external tools are listed. If you have not
defined any tool, the list box will be empty.
• On the Tools menu, choose External Tools
• In the External Tools dialog box, choose Add, and enter a name for the menu option in the Title box
Tip:
Type an ampersand before one of the letters in the tool name to create an accelerator key
for the command when it appears on the Tools menu. For example, if you use M&y
External Tool, the letter 'y' will be the accelerator key. See 9.5.5 Assign a Keyboard
Shortcut for more information.
• In the Command box, enter the path to the file you intend to launch or choose Browse (...) to
navigate to the file. File types that you can launch include .exe, .bat, .com, .cmd, and .pif.
Note: If the file resides on the system path, you can enter just the file name. If not, enter the full
path to the file.
• Select Use output window and Close on exit, as appropriate, and then choose OK
Fill in the Arguments box with the necessary launch arguments, either manually or using the auto-fill
button.
The auto-fill argument button can provide you with the macros described in the table below.
Table 9-3. External Tools Macros
Item Path $(ItemPath) The complete filename of the current source (defined as
drive + path + filename); blank if a non-source window is
active.
Item Directory $(ItemDir) The directory of the current source (defined as drive +
path); blank if a non-source window is active.
Item File Name $(ItemFilename) The filename of the current source (defined as filename);
blank if a non-source window is active.
Current Line $(CurLine) The current line position of the cursor in the editor.
Current Column $(CurCol) The current column position of the cursor in the editor.
Target Path $(TargetPath) The complete filename of the item to be built, (defined as
drive + path + filename).
Binary Directory $(BinDir) The final location of the binary that is being built (defined
as drive + path).
Project Directory $(ProjectDir) The directory of the current project (defined as drive +
path).
Project filename $(ProjectFileName) The filename of the current project (defined as drive +
path + filename).
Solution Directory $(SolutionDir) The directory of the current solution (defined as drive +
path).
Solution filename $(SolutionFileName) The filename of the current solution (defined as drive +
path + filename).
• Put the cursor in the Press shortcut keys box, and then press the keys you want to assign to the
external tool
Note: If the keyboard shortcut is already assigned to another command, the Shortcut currently
assigned to list will display that information.
• Click Assign
Edit.Cut Deletes the selected item from the file and CTRL+X or SHIFT
copies it to the Clipboard. +DELETE
Edit.Find Displays the Quick tab of the Find and Replace CTRL+F
dialog box.
Edit.FindinFiles Displays the In Files tab of the Find and Replace CTRL+SHIFT+F
dialog box.
Edit.FindSymbol Displays the Find Symbol pane of the Find and ALT+F12
Replace dialog box.
Text Navigation
These shortcuts are for moving around in an open document.
Edit.CharLeft Moves the cursor one character to the left. LEFT ARROW
Edit.CharRight Moves the cursor one character to the right. RIGHT ARROW
Edit.DocumentEnd Moves the cursor to the last line of the document. CTRL+END
Edit.DocumentStart Moves the cursor to the first line of the document. CTRL+HOME
Edit.LineEnd Moves the cursor to the end of the current line. END
Edit.PageDown Scrolls down one screen in the editor window. PAGE DOWN
Edit.PreviousBookmark Moves the cursor to the location of the previous CTRL+K, CTRL
bookmark. +P
Edit.ScrollLineDown Scrolls text down one line. Available in text editors CTRL+DOWN
only. ARROW
Edit.ViewBottom Moves to the last visible line of the active window. CTRL+PAGE
DOWN
Edit.ViewTop Moves to the first visible line of the active window. CTRL+PAGE UP
View.NextError Moves to the next error entry in the Error List CTRL+SHIFT
window, which automatically scrolls to the affected +F12
section of text in the editor.
VAssistX.ListMethodsInCurrentFile Opens the list of all methods in the current file. ALT+M
VAssistX.OpenCorrespondingFile Opens the corresponding file (i.e. .h/.c). ALT+O
VAssistX.OpenFileInSolutionDialog Displays a list of all files in the solution. SHIFT+ALT+O
VAssistX.Paste Shows the paste history menu. CTRL+SHIFT+V
VAssistX.RefactorContextMenu Shows the refactor context menu. SHIFT+ALT+Q
VAssistX.RefactorRename Shows the rename dialog. SHIFT+ALT+R
VAssistX.ScopeNext Jump to next scope. ALT+Down Arrow
VAssitX.ScopePrevious Jump to previous scope. ALT+Up Arrow
Text Selection
These shortcuts are for selecting text in an open document.
Edit.CharLeftExtend Moves the cursor one character to the left and SHIFT+LEFT
extends the current selection. ARROW
Edit.DocumentEndExtend Selects the text from the cursor to the last line CTRL+SHIFT+END
of the document.
Edit.DocumentStartExtend Selects the text from the cursor to the first line CTRL+SHIFT
of the document. +HOME
Edit.LineEndExtend Selects text from the cursor to the end of the SHIFT+END
current line.
Edit.LineStartExtend Selects text from the cursor to the start of the SHIFT+HOME
line.
Edit.LineUpExtend Selects text up, line by line, starting from the SHIFT+UP ARROW
location of the cursor.
Text Viewing
These shortcuts are for changing how text is displayed without changing the text itself, for example, by
hiding a selected area or by outlining methods.
Edit.CollapseAllOutlining Collapses all regions on the page to show just the CTRL+M, CTRL+A
outermost groups in the hierarchy; typically the
Edit.CollapseCurrentRegion Collapses the region that contains the cursor to CTRL+M, CTRL+S
show just the top line of the region, followed by an
ellipsis. Regions are indicated by triangles on the
left edge of the document window.
Edit.CollapseTag Hides the selected HTML tag and displays an CTRL+M, CTRL+T
ellipsis (. . .) instead. You can view the complete
tag as a tooltip by putting the mouse pointer over
the ellipsis.
Edit.ExpandCurrentRegion Expands the current region. Put the cursor on a CTRL+M, CTRL+E
collapsed region to use this command.
Edit.HideSelection Hides the selected text. A signal icon marks the CTRL+M, CTRL+H
location of the hidden text in the file.
Edit.StopHidingCurrent Removes the outlining information for the currently CTRL+M, CTRL+U
selected region.
Edit.StopOutlining Removes all outlining information from the whole CTRL+M, CTRL+P
document.
Text Manipulation
These shortcuts are for deleting, moving, or formatting text in an open document.
Edit.InsertSnippet Displays the Code Snippet Picker. The selected CTRL+K, CTRL+X
code snippet will be inserted at the cursor
position.
Edit.LineTranspose Moves the line that contains the cursor below the SHIFT+ALT+T
next line.
Edit.SurroundWith Displays the Code Snippet Picker. The selected CTRL+K, CTRL+S
code snippet will be wrapped around the
selected text.
Edit.TabLeft Moves selected lines to the left one tab stop. SHIFT+TAB
Edit.UncommentSelection Removes the comment syntax from the current CTRL+K, CTRL+U
line of code.
Build.Compile Creates an object file that contains machine code, linker CTRL+F7
directives, sections, external references, and function/
data names for the selected file.
File.NewFile Displays the New File dialog box so that you can add a CTRL+N
new file to the current project.
File.OpenProject Displays the Open Project dialog box so that you can add CTRL+SHIFT+O
existing projects to your solution.
File.Print Displays the Print dialog box so that you can select CTRL+P
printer settings.
File.Rename Lets you modify the name of the item selected in Solution F2
Explorer.
File.SaveAll Saves all documents in the current solution and all files in CTRL+SHIFT+S
the external files project.
File.SaveSelectedItemsAs Displays the Save File As dialog box when items are
selected in the editor.
Project.AddExistingItem Displays the Add Existing Item dialog box, which lets you
add an existing file to the current project.
Project.AddNewItem Displays the Add New Item dialog box, which lets you add
a new file to the current project.
Project.Properties Displays the Project Properties dialog box for the current
project in the editing frame.
Window Management
These shortcuts are for moving, closing, or navigating in tool windows and document windows.
Tool Windows
These shortcuts are for opening tool windows anywhere in the IDE.
Bookmark Window
These shortcuts are for working with bookmarks, either in the Bookmarks window or in the editor.
Edit.PreviousBookmark Moves the cursor to the location of the previous CTRL+K, CTRL+P
bookmark.
Debugging
These shortcuts are for debugging code.
Debug.Breakpoints Displays the Breakpoints dialog box, where you ALT+F9 or CTRL
can add, remove, and modify breakpoints. +ALT+B
Debug.CallStack Displays the Call Stack window, which displays a ALT+7 or CTRL
list of all active methods or stack frames for the +ALT+C
current thread of execution.
Debug.Locals Displays the Locals window, which displays the ALT+4 or CTRL
local variables and their values for each method in +ALT+V, L
the current stack frame.
Debug.Modules Displays the Modules window, which lets you view CTRL+ALT+U
the .dll or .exe files that are used by the program.
In multiprocess debugging, you can right click and
then click Show Modules for all Programs.
Debug.QuickWatch Displays the QuickWatch dialog box that has the CTRL+ALT+Q or
current value of the selected expression. Available SHIFT+F9
only in Break mode. Use this command to
examine the current value of a variable, property,
or another expression for which you have not
defined a watch expression.
Debug.StepOver Sets the execution point to the line of code you F10
select.
Help
These shortcuts are for viewing topics in Help and moving among them.
Help.WindowHelp Displays a topic from Help that corresponds to the user SHIFT+F1
interface that has focus.
Tip:
You can start a command shell with the PATH set up to run atprogram by clicking on Start > All
Programs > Atmel AVR Tools > Atmel Studio 6.2 Command Prompt as shown in the figure
below.
6 The ELF production file format can hold the contents of both Flash, EEPROM, and User Signatures
(XMEGA devices only) as well as the Fuse- LockBit configuration in one single file. The format is
based on the Executable and Linkable Format (ELF).
The production file format is currently supported for tinyAVR, megaAVR, and XMEGA. See 3.2.7.7
Creating ELF Files with Other Memory Types for a description on how to configure the project in
order to generate such files.
What is the Atmel USB The Atmel USB Driver is a cumulative installer that bundles the required
Driver? USB drivers for all tools.
I get an error during During installation of the Atmel USB Driver Package, you might get the
installation of the Atmel error 0x800b010a - A certificate chain could not be built to a trusted root
USB Driver Package. authority. This means that the certificate that signs the installer could not
be validated using the certificate authority built into Windows.
The reason for not being able to validate the certificate is because the
certificate chain needs to be updated through Windows Update. Make
sure that you have received all updates so that Windows is able to
validate the certificate.
If you are not able to update your computer due to the computer being
offline or restricted in some way, then the root certificate update can be
downloaded from http://support2.microsoft.com/kb/931125.
Will Atmel Studio work in Yes, it will work side-by-side between major and minor versions. Side-
parallel with older versions by-side installation with different build numbers is not possible. If you are
of Atmel Studio, AVR uninstalling AVR Studio 4.0 or AVR32 Studio be careful when you
Studio, and AVR32 Studio? manually delete folders or registry entries after uninstall, as there might
be other keys and folders deployed by Atmel Studio inside the Atmel
folder and registry paths. Note that drivers may be incompatible between
versions.
Atmel Studio cannot find Atmel Studio might not show any connected tools if Norton AntiVirus is
any debuggers or running. To make it work make sure Norton AntiVirus allows
programmers when Norton atprogram.exe to communicate with Atmel Studio by adding
AntiVirus is running. atbackend.exe as an exception in the Norton AntiVirus allowed
programs. This is the same with any anti-virus program that by default
blocks ports.
Windows shows a message This might be caused by an anti-virus program blocking the installation
box with the following of the Atmel Studio. We have seen this with the Sophos antivirus
message when attempting package. Temporarily disable the Sophos service running on the
to run Atmel Studio machine (or any corresponding anti-virus service), and attempt
installer: 'Windows cannot installation.
access the specified
device, path or file. You
may not have the
appropriate permissions to
access the item.
Atmel Studio takes a very The Visual Studio shell (and thus Atmel Studio) does a considerable
long time to start but runs amount of processing during start-up. Parts of the operations are WPF
well in a VM environment. operations which benefit greatly from updated graphics libraries and
drivers. Installing the latest graphics driver may give a performance
boost both during normal operation and during start-up.
Verification and This is a known issue. Due to DPC latency, serial communication can
programming often fail with have buffer overruns on the UART chipset. A workaround which works
a serial port buffer overrun for most systems is to use a USB to serial adapter.
error message when using
STK500.
When launching from a Atmel Studio neither installs under a guest account nor runs under it.
guest account, the
following error is displayed
when starting Atmel Studio:
'Exception has been thrown
by the target of an
invocation'.
Can install and run Atmel Yes, with simulator there should be no issues. However, with physical
Studio from within a Virtual devices like debuggers and programmers, the VM must offer support for
Machine? physical USB and Serial port connections.
How can I reduce the start- • Make sure you have uninstalled unwanted extensions
up time of Atmel Studio? • Disable Allow Add-in components to load:
2.1. Go to Tools, Options, Add-in/Macro Security.
2.2. Then, uncheck the Allow Add-in components to load
option.
• Disable the start-up page:
3.1. Go to Tools, Options, Environment, Startup, At Startup.
3.2. Select the Show empty environment option.
How to improve studio • Make sure your system has the latest version of the Windows
performance for any Automation API
supported version of • Exclude the following directories and files from your antivirus
Windows? scanner:
– The Atmel Studio installation directory, and all files and
folders inside it
– %AppData%\Roaming\Atmel directory, and all files and
folders inside it
– %AppData%\Local\Atmel directory, and all files and folders
inside it
– Your project directories
• Visual Studio Shell requires a lot of swap space. Increase the
paging file. Also, put the system to maximize performance. Both
options are found in the System, Properties, Performance,
Settings menu.
Windows Automation API of the API. Find the UIAutomationCore.dll file in your system (normally
3.0? found in the windows folder) and compare the version number of that
file. The version should be 7.X.X.X. for the new API. The latest API can
be found at http://support.microsoft.com/kb/971513.
My Project is large and it Visual Assist X parses all the files when we open the existing project.
takes a long time to open. You could disable this option:
Is there any option to avoid 1. Go to VAssistX, Visual Assist X Options, Performance.
this delay? 2. Uncheck the Parse all files when opening the project.
I have a limited RAM size in Press Ctrl+Shift+Alt+F12 twice to force Atmel Studio to garbage collect.
my system and I work long
hours in the same instance
of Atmel Studio. After some
time, Atmel Studio
becomes slow on my
system.
How can I make my You can enable parallel build Option from Tools, Options, Builder, GNU
projects build faster? Make, Make Parallel Execution Of Build. This option will enable the
parallel execution feature in the GNU make utility. This option may cause
the build log to be displayed unordered.
11.1.2 How do I Reuse My AVR Studio 4 Projects with the New Atmel Studio?
1. Click the menu File→Import AVR Studio 4 project.
2. An 'Import AVR Studio 4 Project' dialog will appear.
3. Type in the name of your project or browse to the project location by clicking the Browse button of
the APFS File location Tab.
4. Name the new solution resulting from the conversion of your project in the Solution Folder Tab.
5. Click Next.
6. Atmel Studio will proceed with conversion. Depending on the complexity and specificity of your
project there might be some warnings and errors. They will be shown in the Summary window.
7. Click Finish to access your newly converted project.
11.2.1 How can I Start Debugging My Code? What is the Keyboard Shortcut for Debugging?
Unlike the AVR Studio 4 to build your project, without starting debugging, you should press F7.
If you need to rebuild your project after a change to the source files, press Ctrl+Alt+F7.
To Start debugging - press F5.
To open the Debugging Interface without running directly, press the Debug→Start Debugging and
Break menu button, or press F11.
To start a line-by-line debugging press F10, to start an instruction by instruction debugging session -
press F11.
To run your project without debugging, press the Debug→Start Without Debugging menu button.
The reason for a to be optimized away is obvious as the incrementation of a does not affect any other
part of our code. This example of a busy wait loop is a prime example of unexpected behavior if you are
unaware of this fact.
To fix this, either lower the optimization level used during compilation or preferably declare a as
volatile. Other situations where a variable should be declared volatile is if some variable is shared
between the code and an ISR7.
For a thorough walkthrough of this issue, have a look at Cliff Lawsons excellent tutorial on this issue.
11.2.6 When Starting a Debug Session, I get an Error Stating that Debug Tool is not Set
The reason for this message is that there is no tool capable to debug that is selected for your project. Go
to the Tool project pane and change the to a supported tool (Project Properties > Tool > Select debugger/
programmer).
If the tool you have selected does support debug, then check that the correct interface is chosen and that
the frequency is according to the specification. If the issue persists, try to lower the frequency to a
frequency where programming is stable, and then slowly increase the frequency as long as it keeps
stable.
11.3.1 Atmel Studio Takes a Very Long Time to Start on My PC but Runs Well in a VM Environment. Is
there Something I Can Do With This?
Visual Studio shell (and thus Atmel Studio) uses WPF as a graphics library and does a lot of processing
in the GUI thread. WPF has support for hardware acceleration. Some graphics card drivers does not
utilize this well and spend time in kernel space even when no graphics update is required. Installing the
latest graphics driver may give a performance boost.
11.3.2 Verification and Programming often Fails with a Serial Port Buffer Overrun Error Message when
using STK500
This is a known issue. Interrupt DPC latency for serial communication may be disrupted by other drivers,
thus causing buffer overruns on the UART chipset. A workaround which works for most systems is to use
a USB to serial adapter.
11.3.3 I've connected my Tool through a USB Hub, and now I get Error Messages and Inconsistent
Results while Programming and Debugging
Tools and devices should be connected directly to a USB port on your debugging PC. If this is not an
option, you may reduce/eliminate problems by:
• Disconnect any other USB devices connected to the hub
• Switch ports on the USB hub
• Set the tool clock frequency low. E.g. Set JTAG Clock < 600 kHz.
• If Use external reset is an option for your tool/device combination, enable this
Note: The AVR Dragon should be connected through a powered USB hub. This because the power
supply on the Dragon can be too weak if the motherboard does not provide enough power. If the Dragon
times out or freezes, then the hub might be of too low quality.
Normal virtualization software supports the idea of USB filters where you set a collection of USB devices
you want to automatically attach to a given guest operating system. Check the manual for your
virtualization solution to see how this is done, or see the 11.4.4 Firmware Upgrade Fails on VirtualBox.
Note that the example in the figure above is specific for the JTAGICE mkII. There is one entry for the tool,
here the JTAGICE mkII, and one for AVRBLDR, which is the firmware upgrade mode for the tool. The
name, serial, Vendor ID, and Product ID may be different for your tool, so change those values
accordingly.
Note: This section contains specifics to VirtualBox. The same logic applies to other virtualization
software, but the steps may differ.
Invoking the above command should output information about the memory layout, the supply voltage for
the chip, and the fuse settings. If it fails it is likely a driver issue, which is covered by 11.4 Driver and USB
Issues.
If atprogram is able to communicate with the device it means that the issue is most likely a wrong
version of JLinkArm.dll being loaded due to loader precedence. To check this, use the Procmon tool
to check what dll is being loaded.
Download the Procmon tool, open it, and configure the filter shown in the figure below. Then start Atmel
Studio. A couple of seconds after Atmel Studio has started, one line should become visible showing the
path to where the dll is being loaded from. It should be loaded from the atbackend folder inside the
Atmel Studio installation directory.
Figure 11-2. Procmon Filter Configuration
If the path of the dll is different it means that Atmel Studio has picked up the wrong dll, and this dll is
incompatible with the dll shipped with Atmel Studio. An example of this is shown in the figure below.
Figure 11-3. Procmon Filter Configuration
To solve the above issue, we recommend backing up the dll that is being loaded and then replacing it with
the JLinkARM.dll found in the atbackend directory inside the Atmel Studio installation directory. This
can be done given the assumption that the dll bundled with Atmel Studio is newer than the one that is
being loaded, and the dll is backward compatible.
Note: Remember to back up the offending JLinkARM.dll before replacing it, as it is not given that it
will be compatible with the program that deployed it.
C
Choose file 283
D
Device selection 100, 108
T
ToolchainOptions 3, 240, 250
Atmel Studio 7 User Guide
Customer Support
Users of Microchip products can receive assistance through several channels:
• Distributor or Representative
• Local Sales Office
• Field Application Engineer (FAE)
• Technical Support
Customers should contact their distributor, representative or Field Application Engineer (FAE) for support.
Local sales offices are also available to help customers. A listing of sales offices and locations is included
in the back of this document.
Technical support is available through the web site at: http://www.microchip.com/support
• Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their
code. Code protection does not mean that we are guaranteeing the product as “unbreakable.”
Code protection is constantly evolving. We at Microchip are committed to continuously improving the
code protection features of our products. Attempts to break Microchip’s code protection feature may be a
violation of the Digital Millennium Copyright Act. If such acts allow unauthorized access to your software
or other copyrighted work, you may have a right to sue for relief under that Act.
Legal Notice
Information contained in this publication regarding device applications and the like is provided only for
your convenience and may be superseded by updates. It is your responsibility to ensure that your
application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR
WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY
OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS
CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE.
Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life
support and/or safety applications is entirely at the buyer’s risk, and the buyer agrees to defend,
indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting
from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual
property rights unless otherwise stated.
Trademarks
The Microchip name and logo, the Microchip logo, AnyRate, AVR, AVR logo, AVR Freaks, BeaconThings,
BitCloud, CryptoMemory, CryptoRF, dsPIC, FlashFlex, flexPWR, Heldo, JukeBlox, KeeLoq, KeeLoq logo,
Kleer, LANCheck, LINK MD, maXStylus, maXTouch, MediaLB, megaAVR, MOST, MOST logo, MPLAB,
OptoLyzer, PIC, picoPower, PICSTART, PIC32 logo, Prochip Designer, QTouch, RightTouch, SAM-BA,
SpyNIC, SST, SST Logo, SuperFlash, tinyAVR, UNI/O, and XMEGA are registered trademarks of
Microchip Technology Incorporated in the U.S.A. and other countries.
ClockWorks, The Embedded Control Solutions Company, EtherSynch, Hyper Speed Control, HyperLight
Load, IntelliMOS, mTouch, Precision Edge, and Quiet-Wire are registered trademarks of Microchip
Technology Incorporated in the U.S.A.
Adjacent Key Suppression, AKS, Analog-for-the-Digital Age, Any Capacitor, AnyIn, AnyOut, BodyCom,
chipKIT, chipKIT logo, CodeGuard, CryptoAuthentication, CryptoCompanion, CryptoController,
dsPICDEM, dsPICDEM.net, Dynamic Average Matching, DAM, ECAN, EtherGREEN, In-Circuit Serial
Programming, ICSP, Inter-Chip Connectivity, JitterBlocker, KleerNet, KleerNet logo, Mindi, MiWi,
motorBench, MPASM, MPF, MPLAB Certified logo, MPLIB, MPLINK, MultiTRAK, NetDetach, Omniscient
Code Generation, PICDEM, PICDEM.net, PICkit, PICtail, PureSilicon, QMatrix, RightTouch logo, REAL
ICE, Ripple Blocker, SAM-ICE, Serial Quad I/O, SMART-I.S., SQI, SuperSwitcher, SuperSwitcher II, Total
Endurance, TSHARC, USBCheck, VariSense, ViewSpan, WiperLock, Wireless DNA, and ZENA are
trademarks of Microchip Technology Incorporated in the U.S.A. and other countries.
SQTP is a service mark of Microchip Technology Incorporated in the U.S.A.
Silicon Storage Technology is a registered trademark of Microchip Technology Inc. in other countries.
GestIC is a registered trademark of Microchip Technology Germany II GmbH & Co. KG, a subsidiary of
Microchip Technology Inc., in other countries.
All other trademarks mentioned herein are property of their respective companies.
© 2018, Microchip Technology Incorporated, Printed in the U.S.A., All Rights Reserved.
ISBN: 978-1-5224-2946-3
ISO/TS 16949
Microchip received ISO/TS-16949:2009 certification for its worldwide headquarters, design and wafer
fabrication facilities in Chandler and Tempe, Arizona; Gresham, Oregon and design centers in California
® ®
and India. The Company’s quality system processes and procedures are for its PIC MCUs and dsPIC
®
DSCs, KEELOQ code hopping devices, Serial EEPROMs, microperipherals, nonvolatile memory and
analog products. In addition, Microchip’s quality system for the design and manufacture of development
systems is ISO 9001:2000 certified.