Whether you’re in a team sharing code or just delivering the latest revision of the code to your customer, its important that the code compiles and runs immediately. But, when absolute paths are used in any project you will need to painstakingly resolve location issues. Making a project portable can make it easy to share a project.

In order to make a project portable so it can be placed anywhere, the path of the include files and the path of the source files must be relative, not absolute. We are going to walk though creating a portable project in Code Composer Studio.

Creating a Portable Project

Open Code Composer Studio with a workspace (it can be any name). Then go to Project-> New CCS Project. Create a new MSP430 empty MSP430 project in a directory called ccs. We are going to place the files in D:\msp430_project\ as shown in the next figure:

Dialog for Creating a new MSP430 Project in Code Composer Studio

Note that we do not create the project in the workspace. The workspace is a separate entity that can contain many projects and does not need to be delivered with code. Minor changes in the workspace do not need to be committed to a code repository, so this avoid having unneeded changes show up.

Once the project is created, open the folder D:\msp430_project\ and create another folder called src at the same level as the ccs folder

In order to add the source files, click on the src folder in Windows explorer, then press CTRL+SHIFT and drag and drop it the src on top of the project name in the navigator while holding down ctrl+shift. A new dialog box will show up in CCS will ask you whether to copy or to add the folder as relative. In order to have a portable project we want to create a relative link.

Linking Source Folder in TI CCS for MSP430

After pressing ok, the src folder is added to the project. You can see a small arrow on the icon of the src folder indicating it is linked. The src folder remains in the same location, but its files are accessible by the project.

Linking folders in TI CCS

Now that this is done, the files are separated from the source and we can add the actual files for the project

Add main.c to the folder by right clicking on src and selecting New-> Source File

Adding new source file in TI CCS

Put the following code in main.c:

[code lang=”c” title=”Basic Application”]
#include <msp430.h>

int main(void)

Try building the project. It should compile without issues.

Now Create another folder in the src folder called uart. You can do this again by right clicking on src and selecting New->Folder. In the src folder, create config.h, while in the uart folder create a file called uart.c. Note that CCS automatically scans the folder and these folders and files will show up in the project browser. Now lets add a simple function to uart.c that does a simple calculation using a configuration define.

Put the following code in main.c:

[code lang=”c” title=”UART External File”]
#include <msp430.h>

void init_uart(void)


You project should like like the following:

Compile Error in CCS using MSP430

You’ll notice that uart.c includes config.h. However, how does uart.c know where to get config.h? Although config.h is in the system, it will not be found. Try to compile and as you can see above, CCS will complain that it cannot find the header file. We therefore need to add an include path for the config folder and to do so using a relative path. Adding the path using the CCS dialog will create an absolute path. Right click on the project, select properties and then include options. Then add the following “${ProjDirPath}\..\config”

MSP430 Code Composer Studio adding relative path

o lets understand why we’re adding this. The ${ProjDirPath} is a environment variable supplied by the IDE. It is available in CCS versions 4 and 5. This environment variables contains the current path to the folder which contains the project. Since our .project file is in the ccs folder, this variable will point to the complete path. So, the IDE is taking care of this for us. Had we used the CCS dialog, it would have given us the full path. Once we would have moved this to another machine, unless the user placed it in the exact ame location, the path would have been wrong and the compiler wouldn’t have found the header file. But, since we use an environment variable, the IDE gives the compiler the right path and we never have to change this again.

We use the backward traversal .. in the path because the config folder is at the same level as the ccs project folder. So, we have to go one folder back and then to the config folder. With this, the config.h file would be found if you included it in any file in the project. Try to compile and you will see that the project compiles successfully.

How to go from here

In your own projects, you can copy files and folders to the src folder and they will be detected by Code Composer Studio. However, you will need to add include paths as needed for new folders you will create and src.