NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.

GCC - Create a project

From Texas Instruments Wiki
Jump to: navigation, search

Introduction[edit]

CCSv4 may be used to create a project that uses GCC compilers for building executables for Windows and even cross-compile to ARM targets.

Using GCC and Cygwin[edit]

Below are the steps on how to create a project that uses GCC that is part of cygwin distribution.

  • Download and install Cygwin from this page, and make sure either the entire Devel or the GCC packages are marked as Install in the setup screen:
Fig. 1: Cygwin setup packages
  • Open CCSv4 and create a new project: go to menu File --> New --> CCS Project
  • Give a name the project and click Next
  • On this next screen check the box Show All Project Types and select the Project Type: as Executable (Cygwin):
Fig. 2: New project
  • Click Next if you want to add additional dependent projects, or Finish to finish creating the project.
  • Add source files and build.

Note: It is assumed that GCC is already installed on the machine. If cygwin distribution is used, then cygwin installation automatically configures environment variables that are used by the project build system. In other cases further tweaks may be required in project properties to find gcc executables.

Using Codesourcery G++ Lite for ARM cross-compile[edit]

The process is very similar to the steps above if you wish to use the Codesourcery G++ Lite compilers.

  • Download and install the desired version of Codesourcery G++ Lite from their page. The example below assumes you are using Codesourcery G++ Lite 2009q1-203 GNU/Linux commonly used with TI's SDKs and DVSDKs.
  • Once installed, the tool typically adds its bin\ installation directory to the system PATH:
Fig. 3: Codesourcery install dir and PATH
  • Open CCSv4 and create a new project using the instructions above for GCC for Cygwin, only selecting Executable (Gnu) as the Project Type. This will spawn a warning that you can ignore.
Fig. 4: Project warning
  • Click on Next, then Finish.
  • In order to use the tools one additional step must be performed; the CodeSourcery cross-compiler tools always have a prefix that designates the target and the type of the output binary format, changing the compiler/assembler/linker names from simply gcc or as to something like arm-none-linux-gnueabi-gcc or arm-none-linux-gnueabi-as. This must be configured on the project by right-clicking on the newly created project and selecting Build Properties...
  • Once there, add the tool prefix to the Command: box for each tool: GCC C++ Compiler, GCC C Compiler, GCC C++ Linker, GCC Assembler. For example, for the Codesourcery G++ Lite 2009q1-203 GNU/Linux, the prefix arm-none-linux-gnueabi- must be added to each box.
Fig. 5 (animated): Project Build Options

Notes:[edit]

  1. There is a CodeSourcery plug-in available at Source Forge that adds a new target called Executable (ARM) and modifies the project Build options by adding a few fields specific to CodeSourcery tools. The version that can be used with CCSv4 is 0.1.3.
  2. Important! The ability to debug your code within CCSv4 is highly dependent on the type of the GCC version and platform chosen. For example, although CCS can debug code generated with Codesourcery for GNU/Linux ARM, it does not mean you can simply load the target using the CCS debugger - such compiler generates code intented to be loaded from a Linux command prompt. That is not the case for MSP430 GCC, though.
  3. Because the project type is for the generic GCC compiler, all the target-related options typically used for ARM cross-compile (-march=armv5t, -mtune=arm9tdmi and others) must be specified manually in the project build options for each tool:
    GCC C++ Compiler or GCC C Compiler --> Miscellaneous --> Other flags
    GCC Assembler --> General --> Assembler Flags
  4. Since the cross compiler is not named <gcc.exe>, CCSv4 will spawn a warning for the newly created project that reflects the absence of the GCC program in the PATH:
    Error launching external scanner info generator (gcc -E -P -v -dD C:/user/workspace/.metadata/.plugins/org.eclipse.cdt.make.core/specs.cpp)
  5. If desired, the directory C:\Program Files\CodeSourcery\Sourcery G++ Lite\arm-none-linux-gnueabi\bin can be added to the PATH environment variable. By doing this two benefits can be achieved:
    • No need to change the prefix for the GCC tools on the project;
    • The warning mentioned above will disappear;
    However, please note that this may cause conflicts with other GCC tools installed in your system, like DJGPP, Cygwin or mspgcc.

Using mspgcc for MSP430 cross compile[edit]

Similarly to the Codesourcery tools, the steps to configure mspgcc are almost identical, just requiring a change of each tool under Project --> Build Properties... to its corresponding mspgcc name. For example, g++ becomes msp430-g++ and gcc becomes msp430-gcc.

Similarly to the Codesourcery case, make sure the mspgcc tools are in the PATH environment variable (its installer usually does that).

All the notes above are also applicable to mspgcc.

Important! At least one target-dependent compiler option is absolutely required for mspgcc: the -mmcu=msp430xxxx. It must be added to:

Project --> Build Options... --> GCC C++ Compiler or GCC C Compiler --> Miscellaneous --> Other flags

To date CCSv4 cannot debug code generated with mspgcc version 3.x. The new version 4.x is still under testing. Check back soon!

E2e.jpg {{
  1. switchcategory:MultiCore=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article GCC - Create a project here.

Keystone=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article GCC - Create a project here.

C2000=For technical support on the C2000 please post your questions on The C2000 Forum. Please post only comments about the article GCC - Create a project here. DaVinci=For technical support on DaVincoplease post your questions on The DaVinci Forum. Please post only comments about the article GCC - Create a project here. MSP430=For technical support on MSP430 please post your questions on The MSP430 Forum. Please post only comments about the article GCC - Create a project here. OMAP35x=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article GCC - Create a project here. OMAPL1=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article GCC - Create a project here. MAVRK=For technical support on MAVRK please post your questions on The MAVRK Toolbox Forum. Please post only comments about the article GCC - Create a project here. For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article GCC - Create a project here.

}}

Hyperlink blue.png Links

Amplifiers & Linear
Audio
Broadband RF/IF & Digital Radio
Clocks & Timers
Data Converters

DLP & MEMS
High-Reliability
Interface
Logic
Power Management

Processors

Switches & Multiplexers
Temperature Sensors & Control ICs
Wireless Connectivity