F29H85x-SDK  1.02.01.00
 
Makefile based Build

Introduction

All SDK examples and libraries can be built using makefiles via command line. This section provides basic instructions and tips on using makefiles.

Enabling "make" in Windows

Attention
This step needs to be done once on a Windows host machine. Nothing needs to be done for Linux.
  • Windows, unlike Linux, does not come pre-installed with GNU make. CCS provides a GNU make executable. However the path to this GNU make executable should be visible to the windows command prompt.
  • Add "make" to your path environment variable.
  • Edit the "Path" variable and add the path to C:/ti/ccs2001/ccs/utils/bin in the "Path" variable.
  • Confirm that you are able to see gmake in Windows by doing below
    C:\ti>gmake -v
  • The expected output is similar to that shown below
    GNU Make 4.1
    Built for Windows32
    Copyright (C) 1988-2014 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.

Building Driverilb with Makefiles

  • When SDK is installed the driverlib and other libraries are pre-built. However you can modify the library source code and rebuild all the libraries using makefiles.
  • To rebuild the libraries, do below from ${C29SDK_ROOT},
    gmake -s driverlib PROFILE=debug
  • To clean all library generated object files and libraries, do below from ${C29SDK_ROOT},
    gmake -s driverlib-clean PROFILE=debug
  • Initially, only PROFILE=debug is supported to build the driverlib with optimization O1. This helps when debugging code in CCS debugger.

Building examples with makefiles

  • You can build example applications using CCS projects as well as makefiles.
  • To build using makefiles, firstly navigate to the example to build.
  • All examples are arranged as below
    examples/{component or module}/{optional sub-module or sub-component}/{example name}
  • To build a given example,
    • from ${C29SDK_ROOT}, do
      gmake -s {example_name}
    • from the respective example folder, {example name}/ccs
      gmake -s all
  • To clean a given example,
    • from ${C29SDK_ROOT}, do
      gmake -s {example_name}_clean
    • from the respective example folder, {example name}/ccs
      gmake -s clean
  • By default, the examples are built using PROFILE=debug with O1 optimization and in RAM configuration CONFIG=RAM.
  • To build with the optimization O0, use PROFILE=debug_O0 as shown below
    gmake -s {example_name} PROFILE=debug_O0
  • To build with FLASH configuration, use CONFIG=FLASH as shown below
    gmake -s {example_name} CONFIG=FLASH
  • To simply build all examples, do below from ${C29SDK_ROOT}
    gmake -s examples-all
  • To clean all examples, do below from ${C29SDK_ROOT}
    gmake -s examples-clean-all

Building the Whole SDK with Makefiles

  • The whole SDK can be built using makefiles by running below command from ${C29SDK_ROOT}
    gmake -s all
  • Similarly to clean the whole SDK, do below
    gmake -s clean

Load and Run Executables Built with Makefiles

  • The generated binary from makefile is located at the below path
    examples/{component or module}/{optional sub-module or sub-component}/{example_name}/ccs/{example_name}.out
  • Simply load and run binary .out on EVM using CCS (see Build, Load and Run)
  • The same folder also has .map files which have more information about the binary size and memory section used, and so on.

Tips and Tricks when working with Makefiles

  • In general, the makefiles are written to be simple and use very basic GNU make syntax and options. You can simply open the makefile located within a example or library folder to see the different compile options, include paths, files, include directory, pre-processor defines etc that are used to build that example or library.
  • The only common file included by all makefiles is the top level ${C29SDK_ROOT}/imports.mak. This file defines paths to common tools like compiler, syscfg, CCS that are used by all examples. If you have installed the tools like CCS, SysConfig, Compiler at non-default paths, then modify the paths defined in this file.
  • You can pass -s to build in "silent" mode. This will suppress the actual command that is executed. So if you dont pass -s then the console will show the exact command that is executed by make. This can be useful in debugging error, if any.