SWRA446 February   2015 CC1310 , CC1310 , CC2620 , CC2620 , CC2630 , CC2630 , CC2640 , CC2640 , CC2640R2F , CC2640R2F , CC2640R2F-Q1 , CC2640R2F-Q1 , CC2650 , CC2650 , CC2650MODA , CC2650MODA

 

  1.   Using GCC/GDB With SimpleLink CC26xx/CC13xx
    1.     Trademarks
    2. 1 Introduction
    3. 2 Prerequisites
      1. 2.1 Platforms
      2. 2.2 Hardware
      3. 2.3 Software
    4. 3 Hardware Setup
    5. 4 Software Installation Instructions
      1. 4.1 Java Runtime Environment
      2. 4.2 Eclipse IDE (Windows)
      3. 4.3 Eclipse IDE (Linux)
      4. 4.4 GNU Toolchain (Windows)
      5. 4.5 GNU Toolchain (Linux)
      6. 4.6 Build Tools for Windows
      7. 4.7 TI Emupack and GDB Server (Windows)
      8. 4.8 Flash Programmer (Windows)
      9. 4.9 Flash Programmer (Linux)
    6. 5 Build the Software Example
      1. 5.1 Import Example Project Into the IDE
      2. 5.2 Build the Software Example
    7. 6 Load Binary Image to Target
      1. 6.1 Configure Flash Programmer Tool (Windows)
      2. 6.2 Configure Flash Programmer Tool (Linux)
      3. 6.3 Load the Image to Target (Windows)
      4. 6.4 Load the Image to Target (Linux)
    8. 7 Debug the Software Example
      1. 7.1 Launch the GDB Server (Windows)
      2. 7.2 Launch the GDB Server (Linux)
      3. 7.3 Configure Eclipse Debugger
      4. 7.4 Running the Software Example From Debugger
    9. 8 References
  2. AMakefile
    1. A.1 Makedefs
    2. A.2 Makefile
  3. BLinker and Startup Files
    1. B.1 Linker File
    2. B.2 Startup Files

Makefile

This section describes the elements included in the makefile.

Table 2. Variables

vpath Defines the list of directories that the make command should search. All directories containing source files for the project should be added to this variable. All directories are relative to the directory containing the makefile.
PROJECT Contains the name of the project to build. The variable will be used to name the output files of the build
OUT_DIR Defines the directory of where to place the generated output files.
OBJ_DIR Defines the directory of where to place the generated object files.
SOURCE_FILES This variable contains all the source files in the project. All CC26xx/CC13xx projects will require the startup files startup_gcc.c and ccfg.c. These files are again depended on several driverlib files. In this example, all driverlib files are included, by searching for every .c file in the driverlib source folder.
LINKERFILE Defines the linker file for the project. The path is relative to the directory containing the makefile.
INCLUDES Contains the include directories used by the compiler. The variable must include the source and inc folder in the driverlib package.
OBJGENOPTIONS This variable contains options for the compiler when building object files.
-Dgcc =1: Predefine gcc=1
-O0: Set optimization for compilation time
-mcpu=cortex-m3: specifies the ARM processor to be cortex-M3
-gdwarf-2: Produce debugging information in DWARF version 2 format.
-mthumb : Generate code for the Thumb instruction set
-fomit-frame-pointer: Don't keep the frame pointer in a register for functions that don't need one
-Wall: Enable all compiler’s warning messages
-Wstrict-prototypes: Warn if a function is declared or defined without specifying the argument types.
-D$(CHIP_ID)=1: Predefine symbol for chip ID.
OUTGENOPTIONS This variable contains options for the compiler when building output files
-mcpu=cortex-m3: specifies the ARM processor to be cortex-M3
-nostartfiles: Do not use the standard system startup files when linking
-T $(LINKERFILE): specifies the linker script.
-Wl,: pass the subsequent options to the linker.
-Map=$(PROJECT).map: print a link map to the file $(PROJECT).map
--cref: Output a cross reference table
--no-warn-mismatch: allow linking together input files that are mismatched.
OBJECTFILES This variable contains the name of all object files that will be generated from the source files. The variable content is created by replacing the .c in the sourcefiles with .o.

Table 3. Rules

.PHONY : all clean Tell make that the targets all and clean are not associated with any files.
clean : Rule for cleaning up after the build. All output files and all object files are deleted.
all: Rule for building the complete project.
$(OBJ_DIR): This rule creates the directory to place object files if it doesn’t exist.
$(OUT_DIR): This rule creates the directory to place output files if it doesn’t exist.
$(OBJECTFILES): Rule to make sure the object directory is created before any object files.
$(PROJECT).elf $(PROJECT).bin: Rule to make sure the output directory is created before any of the output files.
$(OBJ_DIR)/%.o: Rule for building the object files.
–o $@ places the output in a file with the same name as the target.
-c means that the source file should be compiled, but not linked.
$< sets the source file to be the first prerequisite.
$(PROJECT).elf: Rule for building the .elf file.
The option –o places the output in the directory passed as argument.
$(PROJECT).bin: Rule for building the .bin file.
$(OUT_DIR)/$< defines the input file. $< returns the first prerequisite.
$(OUT_DIR)/$@ defines the output file. $@ returns the target
--gap-fill 0xFF means that gaps between sections should be filled with 0xFF.
-O binary creates an output file in binary format.