7.5 AVR® Compiler and Toolchain Options: GUI

To get help with the AVR GNU toolchain, you can do the following:

  • For information about avr32-gcc usage in Microchip 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 website
  • 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 available for the AVR GNU toolchain from the Microchip Studio frontend.

Figure 7-2. AVR® GNU Toolchain Options

AVR® GNU C Compiler Options

Table 7-6. AVR® GNU C Compiler Options
OptionDescription
General Options
-mcall-prologuesUse subroutines for functions prologues and epilogues
-mno-interruptsChange stack pointer without disabling interrupts
-funsigned-charDefault char type is unsigned
-funsigned-bitfieldDefault bit field is unsigned
Preprocessor Options
-nostdincDo not search system directories
-EPreprocess only
Symbols Options

One can define (-D) or undefine (-U) in-source symbols. New symbol declarations can be added, modified, or reordered, using the interface buttons below:

  • Add a new symbol. This symbol and all following icons are reused with the same meaning in other parts of the Microchip 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, -O1, -O2, -O3, -OsNo 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-sectionsPrepare functions for garbage collection, if a function is never used, its memory will be scrapped
-fpack-structPack structure members together
-fshort-enumsAllocate only as many bytes needed by the enumerated types
-mshort-callsUse rjmp/rcall limited range instructions on the >8K devices
Debug Options
Debug level (drop-down menu): none, -g1, -g2, -g3Specifies 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
-WallAll warnings
-WerrorEscalate warnings to errors
-fsyntax-onlyCheck syntax only
-pedanticCheck conformity to GNU, raise warnings on non-standard programming practice
-pedantic-errorsSame as above, plus escalate warnings to errors
Miscellaneous Options
Other flags (form field)Input other project-specific flags
-vVerbose
-ansiSupport ANSI programs
-save-tempsDo not delete temporary files

AVR® GCC Linker Options

Table 7-7. AVR® GCC Linker Options
OptionDescription
-Wl -nostartfilesDo not use standard files
-Wl -nodefaultDo not use default libraries
-Wl -nostdlibNo start-up or default libraries
-Wl -sOmit all symbol information
-Wl -staticLink statically
Libraries Options
Libraries -Wl, -l (form field)Add, prioritize, or edit library names here, using those buttons:
,
,
,
,
Library search path -Wl,-L (form field)Add, prioritize, or edit the path where the linker will search for dynamically linked libraries. The same interface as above.
Optimization Options
-Wl, -gc-sectionsGarbage collect unused sections
--rodata-writablePut read-only data in writable spaces
-mrelaxRelax 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.

Figure 7-3. Memory Settings

Notes About the AVR® Port of GCC

The AVR is a Harvard architecture CPU, which means that it separates instruction memory and data memory. Originally the GCC was designed to support Von Neumann architectures, defining 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

Table 7-8. AVR® Assembler Options
OptionDescription
Optimization Options
Assembler flags (form field) Miscellaneous assembler flags
Include path (form field)You can add, prioritize, or edit the path to the architecture and platform-specific included files here
-vAnnounce version in the assembler output
Debugging Options
Debugging (drop-down menu) None, -Wa -gEnables debugging symbol and debugging source insertion