To get help about AVR GNU toolchain, you can do the following:
For information about avr32-gcc usage in Atmel Studio and general parameters, consult the GCC Project Options and Configuration section
The API reference for the AVR libc implementation can be found here
The API Alphabetical index can be consulted here
For general information about GCC, visit the official GNU GCC web site
Alternatively, you can write avr32-gcc --help and see explanations on some of the parameters in the command output
This section illustrates the GUI options that are available for the AVR GNU toolchain from the Atmel Studio frontend.
AVR GNU C Compiler Options
Option | Description |
---|---|
General options | |
-mcall-prologues |
Use subroutines for functions prologues and epilogues |
-mno-interrupts |
Change stack pointer without disabling interrupts |
-funsigned-char |
Default char type is unsigned |
-funsigned-bitfield |
Default bit field is unsigned |
Preprocessor options |
|
-nostdinc |
Do not search system directories |
-E |
Preprocess only |
Symbols options | |
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:
|
|
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, -O1, -O2, -O3, -Os |
No optimization, optimize for speed (level 1 - 3), optimize for size |
Other optimization flags (manual input form) |
Here you should write optimization flags specific to the platform and your requirements |
-ffunction-sections |
Prepare functions for garbage collection, if a function is never used, its memory will be scrapped |
-fpack-struct |
Pack structure members together |
-fshort-enums |
Allocate only as many bytes needed by the enumerated types |
-mshort-calls |
Use rjmp/rcall limited range instructions on the >8K devices |
Debug options | |
Debug level (drop-down menu): none, -g1, -g2, -g3 |
Specifies the level of tracing and debugging code and headers left or inserted in the source code |
Other debug options (form field) |
Architecture-specific debug options |
Warning messages output options | |
-Wall |
All warnings |
-Werror |
Escalate warnings to errors |
-fsyntax-only |
Check syntax only |
-pedantic |
Check conformity to GNU, raise warnings on non-standard programming practice |
-pedantic-errors |
Same as above, plus escalate warnings to errors |
Miscellaneous options | |
Other flags (form field) |
Input other project-specific flags |
-v |
Verbose |
-ansi |
Support ANSI programs |
-save-temps |
Do not delete temporary files |
AVR GCC Linker Options
Option | Description |
---|---|
-Wl -nostartfiles |
Do not use standard files |
-Wl -nodefault |
Do not use default libraries |
-Wl -nostdlib |
No start-up or default libraries |
-Wl -s |
Omit all symbol information |
-Wl -static |
Link statically |
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 |
|
-Wl, -gc-sections |
Garbage collect unused sections |
--rodata-writable |
Put read-only data in writable spaces |
-mrelax |
Relax branches |
Miscellaneous options |
|
Other linker flags (form field) |
Input other project-specific flags |
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.
Notes about the AVR port of GCC
The AVR is a Harvard architecture CPU. This means that it separates instruction memory and data memory. The GCC was originally designed to support Von Neumann architectures which define a single storage structure to hold both instructions and data. This dichotomy is solved by a series of nifty tricks in the AVR port of GCC, of which three should be noted:
The .text segment starts at 0x0
The .data segment starts at 0x800000
The .eeprom segment starts at 0x810000
These peculiarities have been abstracted away by the GUI, but users will see the truth when building projects with relocated segments.
A relocation definition for flash will be passed to the GNU linker via avr-gcc as the option:
-Wl,-section-start=bootloader=0x1fc00
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
Option | Description |
---|---|
Optimization options |
|
Assembler flags (form field) |
Miscellaneous assembler flags |
Include path (form field) |
You can add, prioritize, or edit path to the architecture and platform specific included files here |
-v |
Announce version in the assembler output |
Debugging options |
|
Debugging (drop-down menu) None, -Wa -g |
Enables debugging symbol and debugging source insertion |