DMBS - Dean's Makefile Build System =================================== Module: GCC ----------------- The GCC module provides build targets to compile a user application, using a variant of GCC for a specific target architecture (such as `avr-gcc`). ## Importing This Module into a Makefile: To use this module in your application makefile, add the following code to your makefile: include $(DMBS_PATH)/gcc.mk ## Prerequisites: This module requires the GCC compiler to be installed and available in the system's `PATH` variable for the desired target architecture. ## Build Targets: The following targets are supported by this module:
size Show the compiled binary size for the various memory segments.
symbol-sizes Show the size of each symbol in the compiled binary (useful to find large functions to optimize further).
all Build application and generate all binary (BIN, ELF, HEX) and auxiliary (LSS, MAP, SYM, etc.) output files.
lib Generate a static `.a` library from the application code, containing the flash region's data.
elf Generate an ELF debug file from the application code, containing all region's data.
bin Generate a flat BIN binary file from the application code, containing the flash region's data.
hex Generate a pair of Intel HEX files from the application code, containing the flash region's data (HEX) and EEPROM data (EEP).
lss Generate a LSS listing file showing the disassembly of the compiled application.
clean Remove all generated project intermediary and binary output files.
mostlyclean Remove all generated project intermediary output files, but preserve the binary output files.
## Mandatory Variables: The following variables must be defined (with a `NAME = VALUE` syntax, one variable per line) in the user makefile to be able to use this module:
MCU Name of the Atmel processor model (e.g. `at90usb1287`).
TARGET Name of the application output file prefix (e.g. `TestApplication`).
ARCH Target device architecture (e.g. `AVR8`).
SRC List of all project source files (C, C++, ASM).
## Optional Variables: The following variables may be defined (with a `NAME = VALUE` syntax, one variable per line) in the user makefile. If not specified, a default value will be assumed.
COMPILER_PATH Path to the compiler to use, in case a specific compiler should be substituted for the one in the system's `PATH` variable. Default is blank (use `PATH` provided compiler).
OPTIMIZATION Optimization level to use when compiling C and C++ source files. Default is `s` (optimize for smallest size).
C_STANDARD C language standard used when compiling C language source files. Default is `gnu99` (C99 standard with GNU extensions)./td>
CPP_STANDARD C++ language standard used when compiling C++ language source files. Default is `gnu++98` (C++98 standard with GNU extensions)./td>
F_CPU Processor core clock frequency, in Hz. This is used by some architectures for functions such as software spin-loop delays. Default is blank (no value defined).
C_FLAGS Common GCC flags passed to the compiler for C language (C) input files. Default is blank (no additional flags).
CPP_FLAGS Common GCC flags passed to the compiler for C++ language (CPP) input files. Default is blank (no additional flags).
ASM_FLAGS Common GCC flags passed to the assembler for assembly language (S) input files. Default is blank (no additional flags).
CC_FLAGS Common GCC flags passed to the compiler for all source file types. Default is blank (no additional flags).
LD_FLAGS Extra flags to pass to the GNU linker when linking the compiled object files into the resulting binary. Default is blank (no additional flags).
LINKER_RELAXATIONS Boolean, if `Y` linker relaxations will be enabled to slightly reduce the resulting binary's size. Default is `Y`.
JUMP_TABLES Boolean, if `Y` jump tables will be enabled to slightly reduce the resulting binary's size - note that this can cause incorrect jumps if the binary is relocated after compilation, such as for a bootloader. Default is `N`.
LTO Boolean, if `Y` link time optimization will be enabled to reduce the resulting binary's size. For larger projects you might also want to add `-mcall-prologues` to the `CC_FLAGS`. Default is `N`.
OBJDIR Directory to store the intermediate object files, as they are generated from the source files. Default is `obj`.
OBJECT_FILES List of additional `.o` object files to link into the final binary. Default is blank (no additional objects).
DEBUG_FORMAT Debug ELF file format to generate. Default is `dwarf-2`.
DEBUG_LEVEL Level of the debugging information to generate in the compiled object files. Debug is 2 (medium level debugging information).
## Provided Variables: The following variables may be referenced in a user makefile (via `$(NAME)` syntax) if desired, as they are provided by this module.
N/A This module provides no variables.
## Provided Macros: The following macros may be referenced in a user makefile (via `$(call NAME, ARG1, ARG2, ...)` syntax) if desired, as they are provided by this module.
N/A This module provides no macros.
## Module Changelog: The changes to this module since its initial release are listed below, as of the DMBS version where the change was made. ### 20170426 Added `JUMP_TABLES` optional variable. ### 20160403 Initial release.