NOTICE: The Processors Wiki will End-of-Life in December of 2020. 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.
How to create GCC projects in CCSv5
Linux applications are usually built on command line using makefiles, but CCSv5 can also be used to create and build a project that uses a GCC toolset (such as CodeSourcery). After the project is built, the executable can be copied/made available to the target file system, and then it can be debugged using a cross-platform GDB debugger.
CCS and the GCC toolchain can also be used to build bare-metal applications which are loaded and run directly on the ARM target in the absence of a high-level OS like Linux.
The following steps document the process of creating and building Linux as well as bare-metal projects in CCSv5.
Creating a Linux GCC project in Linux hosted CCSv5
Below are the steps to create a C/C++ project in CCSv5 that uses Linux GCC to build the executable. The toolchain used for the build in this case is Sourcery G++ Lite 2009q1-203 for ARM GNU/Linux.
- Download and install Linux CCSv5
- Download and install a GCC toolchain
- Later versions of the Sitara Linux SDK (since 05.02.00.00) include a GCC toolchain within them in the linux-devkit directory. This toolchain should be used rather than CodeSourcery to ensure that the binaries produced in the CCS project are compatible with the pre-built binaries in the SDK.
- For early SDKs or SDKs that do not include a the GCC toolchain withing the SDK itself, the CodeSourcery GCC toolchain typically recommended for use with TI SDKs can be downloaded from here, but check your SDK download page to be sure (use the IA32 GNU/Linux Installer). If your SDK download page or installer requests a CodeSourcery toolchain you should use that toolchain instead.
- Optional! A CodeSourcery plugin for Eclipse is available here.
- Execute the installer on the Linux host with a .bin file extension as follows: ./arm-2009q1-203-arm-none-linux-gnueabi.bin
- Follow the installer instructions on the screen to do a Typical installation
- Start CCSv5 and create a new project by going to menu New->Project…
- Expand C/C++, and choose C Project (or C++ Project). Click Next
- Type in a project name. Select Project type as Executable->Cross-Compile Project. Note that Toolchains has Cross GCC. Click Next
- For Tool Command Prefix, enter the prefix for the CodeSourcery GCC tool: arm-none-linux-gnueabi- and for the Tool Command Path enter the path to the /bin folder within the CodeSourcery installation. This configures it to use the CodeSourcery cross-compiler tools and the prefix designates the target and the type of output binary format. Click Next
- Leave the default configurations of Debug and Release. Click Finish.
- This will create a project in your CCS workspace. Now you can add your source files to the project by right-clicking on the project and selecting Add Files.
- Right-click on the project, go to Properties. Go to C/C++ Build->Settings
- Since this project type is for the generic GCC compiler, all target-related options typically used for ARM cross-compile (-march=armv7-a, -mtune=cortex-a8 and others, which would be dependent on the processor you are using) must be specified manually in the project build options under: GCC C++ Compiler or GCC C Compiler --> Miscellaneous --> Other flags. Note that if you have multiple build configurations that you want these options to apply to, be sure to select All Configurations before setting the options.
- Similarly Library search path for the linker can be specified under: GCC C++ Linker --> Libraries --> Library search path
- Build project and check the console view for successful build.
- To debug a Linux application, take a look at the following pages:
Linux Debug in CCSv5
How to Run GDB on CCSv5
Creating a Linux GCC project in Windows hosted CCSv5
The procedure is same as above with some minor changes.
- Download and install Windows CCSv5
- Download and install Windows version of Sourcery G++ Lite 2009q1-203
- Follow steps 3 through 11 above
- After step 11, go to Project Properties->C/C++ Build, Builder Settings tab, and uncheck the box "Use default build command" and change the Build command to cs-make. This is necessary because the make utility in Sourcery G++ Lite's \bin directory is cs-make.
- This may be an optionally necessary step: The build may result in the following warnings:
- Error launching external scanner info generator (gcc -E -P -v -dD C:/user/workspace/.metadata/.plugins/org.eclipse.cdt.make.core/specs.c)
- Program 'gcc' is not found in $PATH
- To get rid of these warnings, go to Project Properties->C/C++ Build->Discovery Options, and change the Compiler Invocation command to point to the CodeSourcery gcc executable.
Creating a Bare-Metal GCC project in CCSv5
- Download and install CCSv5
- Download and install Sourcery G++ Lite for ARM EABI
- Follow steps 3 through 5 from How_to_create_GCC_projects_in_CCSv5#Creating_a_Linux_GCC_project_in_Linux_hosted_CCSv5
- In step 6, for Tool Command Prefix, enter the prefix for the bare-metal CodeSourcery GCC tool: arm-none-gnueabi- and for the Tool Command Path enter the path to the /bin folder within the CodeSourcery installation.
- Continue through steps 7 through 11, and then steps 4 and 5 under How_to_create_GCC_projects_in_CCSv5#Creating_a_Linux_GCC_project_in_Windows_hosted_CCSv5
Note: When working with bare-metal toolchains, it is the user's responsibility to take care of setting up interrupt vector tables, performing low level initialization, linking in appropriate linker scripts and libraries etc. This page does not get into those details and assumes the user already has the understanding of what is required to build and run bare-metal applications. The documentation included with the Code Sourcery toolchain should be helpful in getting started with this information.
If using a Makefile
If using a Makefile, simply select Makefile Project in step 5 above. You are given the choice of selecting native GCC, Autotools or a Cross compiler (common for building applications for ARM processors).