Please note as of Wednesday, August 15th, 2018 this wiki has been set to read only. If you are a TI Employee and require Edit ability please contact x0211426 from the company directory.

Using GIT in CCS with SDK

From Texas Instruments Wiki
Jump to: navigation, search

This article will document the process to set up and use a GIT repository on a Windows PC in order to manage a microcontroller SDK. It will use as an example the Bluetooth Stack v2.2.1 for the CC2650 Sensortag which has a dependency on a TI-RTOS release v2.21.00.06. This was initially based on the following e2e user post.


Install GitHub

Download and install Windows version of GitHub.


Initialise local GIT repository

Create Clean Install of the sources

The original instructions for using GIT in CCS were based on the assumption that the code being built was to be cloned from an existing GIT repository. In the case of a TI microcontroller SDK this is not true as the code is delivered in a click wrap installer that then extracts the code to the local machine. This section explains how to create a local GIT repository and then import this code into it.

The first step is to install a clean version of the SDK and the TI-RTOS release. These are by default installed into C:\ti. In this example they are installed into C:\ti-git for the purposes of the documentation. This will result in the following directory structure.

Directory Structure after Installation


Create the Repositories

Start GitHub. Click on the plus sign at the top left of the GitHub window. Select the Create option and enter the name and local path for the repository.

The local path in the base directory for all the SDK packages. In this case it is C:\ti-git

The Name is the name of the directory which for the first repository (BLE SDK) is ble_sdk_2_02_01_18

Create Repository Dialogue box

Repeat the process to create a repository for TI-RTOS where the local name is tirtos_cc13xx_cc26xx_2_21_00_06.

As it is unusual to modify code within the XDC directory to configure the TI-RTOS build it is in this case not included in its own GIT repository.

This has now created two empty repositories.

Adding Files to the Repositories

There are two stages to get the repository ready to start working with. The first stage is to add the required files and the second is to commit them to the repository. In the list of repositories right click on the ble_sdk_2_02_01_18 entry and then select "Open in Git Shell".

This will open a BASH terminal which allows the command line GIT commands to be run in the same way as they would in a Linux environment.

Command Line Bash Interface

In the terminal issue the following commands

$git add *

This will add all the files in the SDK to the GIT repository. At this point the SDK has not been built and so it is only source and configuration files so it is safe to add all files.

$git commit -a -m"clean sdk 2.2.1"

This will commit all the added files (-a option) to the repository with the commit message "clean sdk 2.2.1" (-m option).

The process can then be repeated for TI-RTOS 2.21.

At this point the repositories are ready to be used.

Applying patches to GIT

If there are existing git patches that need to be applied to the repository the easiest way to do this is via the the git shell. Move the patches to the root directory of the repository. An example is shown below with the patches highlighted. The patches were created with git format-patch which creates files with the name format <patch number>-<commit message>.patch

Copy patch files into repository directory

In GitHub right click on repository and select "Open In Git Shell". The patches are applied using the git am <patch file> command. The examples used were:

$git am 0001-add-support-for-multiple-pdm-sample-rates.patch
$git am 0002-add-ti-rtos-RF-stability-patches-to-match-SDK-2.2.1-.patch

Apply patch files with git am


Using in CCS

Create a Workspace

Start a new workspace in CCS (7.1 used here) and import the following projects from the c:\ti-git\ble_sdk_2_02_01_18 path. Make sure the "Copy files into workspace" is NOT selected.

bim_extflash
sensortag_audio_cc2650stk_app
sensortag_audio_cc2650stk_stk

More generally to build a CC2650 STK image a bim, stack and app project are required.

Using GIT in CCS

CCS has native support for GIT so once a project repository is created it can be managed either through CCS or by the command line in the GitHub shell.

Native GIT

To enable GIT view in CCS select the other option for perspective as shown below

Ccs-enable-git-1.JPG

Then select GIT

Ccs-enable-git-2.JPG

This will provide a new set of Tabs to manage GIT. Once in this perspective the project explorer window can be added again with View->Project Explorer

Ccs-git-view.JPG

With native GIT support the GIT Staging tab can be used to select files to commit and the commit message to be used.


Command Line GIT

In command line mode files that have been edited in CCS and which have already been added and previously committed can be managed in GitHub bash shell.

Identify which committed files have been changed

$git status

then choose which ones to commit with a message

$git commit <file name 1> <file name N> -m"commit message"