CICD with Code Composer Studio
Running automatic builds and tests of your firmware whenever you make git pushes is a great way to catch bugs before they get to production. This page describes how to set up a CICD pipeline for your Code Composer Studio (CCS) projects.
Unfortunately, given the GUI-by-default nature of CCS, it does not make it easy to set up a CICD pipeline.
Installing Code Composer Studio
Code Composer Studio can be downloaded from the internet using wget
. This example will download version 20.2.0, update this to match the version you want to download.
wget https://dr-download.ti.com/software-development/ide-configuration-compiler-or-debugger/MD-J1VdearkvK/20.2.0/CCS_20.2.0.00012_linux.zip
Unzip the file:
unzip CCS_20.2.0.00012_linux.zip
cd
into the directory and run the installer:
cd CCS_20.2.0.00012_linux./ccs_setup_20.2.0.00012.run
Note that by default this loads up a GUI in where you can select which components you want to install. If you want to install it directly from the command line (useful in headless environments, e.g. CICD), you can provide the --mode unattended
flag:
./ccs_setup_20.2.0.00012.run --mode unattended
The default installation location is:
- For regular user:
$HOME/ti/ccs<version>
- For root user:
/opt/ti/ccs<version>
When using the --mode unattended
flag, by default all components will be installed. This can result in quite a large installation (approx. 7GB when I tested it). You can reduce the installation size by selecting the components you want to install. For example, to just install support for the MSP430:
./ccs_setup_20.2.0.00012.run --mode unattended --enable-components PF_MSP430
In my testing, just installing MSP430 support reduced the installation size from 7GB to 5.8G (not as much as I hoped).
Installing msp430
Alas, one thing that I could not work out how to install via the command line was the msp430. But, as along as you can install it once using a GUI, you can zip up the entire ti
folder and use that in your CICD pipeline.
To do that, install msp430ware software via the CCS GUI (go to the Resource Explorer within CCS to install it). It will install it to the same directory that CSS was installed to. On my Linux machine, this was `~/ti/
Zipping up the CCS Installation
Now zip up the entire ti
directory:
zip -r ti.zip ~/ti
Create a Docker Image
Now that we have all the build dependencies in a zip file, we can create a Docker image that the build job will use. You don’t really want to save the huge (2.5GB or so in my case) ti
directory to the repository, so we’ll upload it to Google Drive and get the Docker image build process to download it via a tool called gdown
.
Here is the Dockerfile:
FROM ubuntu:24.04
WORKDIR /root
RUN apt-get update
# Unzip is needed for extracting the TI dependenciesRUN apt install -y unzip
## Install git, needed for pulling submodules (if present)RUN apt install -y git
# Install Python/pip, needed for gdownRUN apt install -y python3 python3-pipRUN apt install -y python3.12-venv
# Create a virtual environment for the projectRUN python3 -m venv /root/.venv
# Install gdown so we can download the TI dependencies from Google DriveRUN /root/.venv/bin/pip install gdown
# Verify gdown is installedRUN /root/.venv/bin/gdown --help
RUN /root/.venv/bin/gdown -O /root/ti-deps.zip <your-public-gdrive-url-goes-here>
# Extract the ti-deps.zip file to where it expects to be# (creates a /root/ti directory)RUN unzip /root/ti-deps.zip -d /root/
Building via the Command Line
CCS provides a command line interface to build projects. The command line interface executable was installed for me at ~/ti/ccs2020/ccs/eclipse/ccs-server-cli.sh
.
I thought I’d be able to be able to call this directly from anywhere with ccs-server-cli
by installing the following symlink:
sudo ln -s ~/ti/ccs2020/ccs/eclipse/ccs-server-cli.sh /usr/local/bin/ccs-server-cli
Unfortunately, while the symlink works fine, it seems that the script expects the CWD (current working directory) to be the directory it is installed in. So no bueno.
Ok, so let’s run all the commands from within the CCS directory. Within your CICD pipeline, you should run the following steps to build your project from the GUI. This assumed this job is running inside a Docker container created from the image above. I didn’t find a way to have the cloned repo location to act as a valid TI CCS workspace, so there is a step below to import the repo into a new workspace before running the build command.
cd /root/ti/ccs2020/ccs/eclipse./ccs-server-cli.sh -noSplash -workspace /root/workspace/ -application com.ti.ccs.apps.importProject -ccs.location <where your CI clones your repo to>./ccs-server-cli.sh -noSplash -workspace /root/workspace/ -application com.ti.ccs.apps.buildProject -ccs.workspace
All done!
Uninstalling CCS
You can uninstall CSS using the uninstall_ccs.run
script that is placed in the CCS installation directory. For example:
~/ti/ccs2020/ccs$ ./uninstall_ccs.run
This will provide a GUI to uninstall the components.
Old Attempt
When installing CCS inside Docker, I got an install error due to the init.d
directory not being found (CCS copies udev
rules into that directory). To fix this, I created /etc/init.d/
directory and a dummy udev
executable inside this directory.
RUN echo "Creating dummy udev script..." && \ mkdir -p /etc/init.d && \ printf '#!/bin/sh\nexit 0\n' > /etc/init.d/udev && \ chmod +x /etc/init.d/udev