Setting up code composer studio for Tiva C-series(TM4C123GH6PM Launch Pad)
TM4C123Gx microcontrollers are the series of ARM Cortex-M4 family. The Tiva C-series Launch Pad consists of a TM4C123GH6PM micro controller with an on board ICDI Interface , with RGB LED and two switches(connected to PF0->SW2 and PF4->SW1). It's maximum operating frequency is 72MHz and it has 32KB SRAM and 256KB Flash Memorey.
Coming to the main point, there are many IDE's which are either free or paid versions of compilers to develop firmware for your Tiva C-Series Launch Pad. Some of them are:
1. Paid Version:
a. Keil MDK v5 for ARM.(free only with code size restrictions)
b.EWARM.
2.Open Source:
TI's Code Composer Studio.
Today we are going to install code composer studio on the pc and setup the libraries for building our projects on the launch pad.
Download latest version of Code Composer studio from this link : http://processors.wiki.ti.com/index.php/Download_CCS
After downloading the Zip file Extract the contents of the Folder and Run the ccs_setup_<version>.exe
When you launch the installer it initially warns you about the presence of antivirus as shown below
Select the Installation folder. In future all the other add-on SDK's and the product libraries also download in to same folder.
The on board debugger is Tiva/Stellaris ICDI Debug Probe, but you can select other debuggers also if you have any.
That's it now click on the "Finish" button and wait for the installation to complete. Depending on your system properties and the product you have selected it takes a while to get installed on your P.C
After installation run the code composer studio. Initially it asks you to create a workspace
Note: Your workspace is the folder where all your project folders will be created.
You can also create projects outside the workspace but you need to setup the path in compiler in case you need to add extra files which we will deal later.
Now that we have created our work space we are now ready to create project
To Create a new project go to File > New > CCS Project
Now a new window appears where you have to select device series, device name and the debugger. then mention project name and project folder(For now let us consider it is in default work space folder).
Now your project will be created with a main.c file and some other files and folders.
But there are some other parameters to be setup before you begin programming
As this is the first installation you need to download updated libraries. But it is very easy to do
Go to View > ResourceExplorer
It needs proper internet connection
Now in resource explorer go to Software > TM4C1 ARM Cortex-M4F MCU <version> > Libraries and select Driver Library as shown below
and click on the download button on the right side.
Now the library gets installed in the folder where your software is installed.
Now its time to setup the path for your newly downloaded libraries
Right Click on your project and select properties
Now a properties window will open with all the Options.
Go to Build > ARM Compiler > Include Options and select the add option as shown below
A small pop up widow appears with options to browse the path of library folder
Go to your software installation folder and you will find a folder with similar name as in the image
select the folder and click "OK" button.
Now you also need to add file search path to linker.
for this expand the ARM Linker Field in the options and select File Search Path field and again click on the little ADD button on the right
Again a popup appears with a field to browse the file
Go to the library folder and in that go to driverlib\ccs\Debug\driverlib.lib and select that .lib file
after browsing path select "OK" button to add that path
When both the "IncludeOptions" and "File Search Path" fields are set correctly click on "OK" button to successfully update the settings to the project.
After this, if you expand the Includes filed in your project you should be able to see the path of your library
Now you are all set to write code and program your launch pad.
For this time we will be building a simple Blink LED program in the IDE
}
// as the input.
//
SysCtlClockSet(SYSCTL_SYSDIV_2_5 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ | SYSCTL_OSC_MAIN);
}
}
The above code is to bink the green LED in RGB LED on launch pad which is connected to pin3 of PortF to blink with a delay of 200ms.
Press the little hammer button on the top and the IDE begins building the project.
After building Press the little green "Bug" button to load the program in to launch pad and debug the program.
The process of building binary files and using LM Flash Programmer will be covered in upcoming posts.
You need not use any other tools because your Launchpad has on board debugger and CCS IDE has installed those debugger drivers during installation. So just connect the launch pad to the computer with USB cable and just press the debug button and when debug window sets up press little green "Play" button to run program and press the red stop button to come out of Debug session.
If you create a new project you should always add those IncludePaths and File Search paths every time you create a new project.
The API's used in this code provided by the libraries and will elaborate the use of this functions in my next posts.
I hope that by this time you will be able to set up the project environment and build your project.
See you again in my next post describing about initialisation and using peripherals with launch pad.
Coming to the main point, there are many IDE's which are either free or paid versions of compilers to develop firmware for your Tiva C-Series Launch Pad. Some of them are:
1. Paid Version:
a. Keil MDK v5 for ARM.(free only with code size restrictions)
b.EWARM.
2.Open Source:
TI's Code Composer Studio.
Today we are going to install code composer studio on the pc and setup the libraries for building our projects on the launch pad.
Download latest version of Code Composer studio from this link : http://processors.wiki.ti.com/index.php/Download_CCS
After downloading the Zip file Extract the contents of the Folder and Run the ccs_setup_<version>.exe
When you launch the installer it initially warns you about the presence of antivirus as shown below
- Turn off your antivirus real time protection for successful installation of code composer studio temporarily. After installation you can turn it on again.
- If you continue to install software with yours antivirus turned on your installation will not complete successfully most of the time.
- But no need of concern as it does not contain any malicious software. Some antivirus softwares may stop the software from loading files correctly.
Select the Installation folder. In future all the other add-on SDK's and the product libraries also download in to same folder.
- During the product selection don't select all the products.
- Only select the products you require. More the products you select, more the time it takes to install.
- You can install other products when necessary.
- Here i selected TM4C12x and Simple Link WIFI cc32xx modules.
The on board debugger is Tiva/Stellaris ICDI Debug Probe, but you can select other debuggers also if you have any.
That's it now click on the "Finish" button and wait for the installation to complete. Depending on your system properties and the product you have selected it takes a while to get installed on your P.C
After installation run the code composer studio. Initially it asks you to create a workspace
Note: Your workspace is the folder where all your project folders will be created.
You can also create projects outside the workspace but you need to setup the path in compiler in case you need to add extra files which we will deal later.
Now that we have created our work space we are now ready to create project
To Create a new project go to File > New > CCS Project
Now a new window appears where you have to select device series, device name and the debugger. then mention project name and project folder(For now let us consider it is in default work space folder).
Now your project will be created with a main.c file and some other files and folders.
But there are some other parameters to be setup before you begin programming
As this is the first installation you need to download updated libraries. But it is very easy to do
Go to View > ResourceExplorer
It needs proper internet connection
Now in resource explorer go to Software > TM4C1 ARM Cortex-M4F MCU <version> > Libraries and select Driver Library as shown below
and click on the download button on the right side.
Now the library gets installed in the folder where your software is installed.
Now its time to setup the path for your newly downloaded libraries
Right Click on your project and select properties
Now a properties window will open with all the Options.
Go to Build > ARM Compiler > Include Options and select the add option as shown below
A small pop up widow appears with options to browse the path of library folder
Go to your software installation folder and you will find a folder with similar name as in the image
select the folder and click "OK" button.
Now you also need to add file search path to linker.
for this expand the ARM Linker Field in the options and select File Search Path field and again click on the little ADD button on the right
Again a popup appears with a field to browse the file
Go to the library folder and in that go to driverlib\ccs\Debug\driverlib.lib and select that .lib file
after browsing path select "OK" button to add that path
When both the "IncludeOptions" and "File Search Path" fields are set correctly click on "OK" button to successfully update the settings to the project.
After this, if you expand the Includes filed in your project you should be able to see the path of your library
Now you are all set to write code and program your launch pad.
For this time we will be building a simple Blink LED program in the IDE
#include <stdbool.h>
#include <stdint.h>
#include "inc/hw_gpio.h"
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "inc/hw_nvic.h"
#include "driverlib/gpio.h"
#include "driverlib/pin_map.h"
#include "driverlib/rom.h"
#include "driverlib/rom_map.h"
#include "driverlib/sysctl.h"
#include "driverlib/systick.h"
void _delay_ms(unsigned int ms){
int I;
for(i = 0; i < ms; i++){
SysTickPeriodSet(80000);
HWREG(NVIC_ST_CURRENT) = 0;
SysTickEnable();
while(!(HWREG(NVIC_ST_CTRL) & NVIC_ST_CTRL_COUNT));
SysTickDisable();
}}
int main(void)
{
//
// Configure the device to run at 80 MHz from the PLL using a 16 MHz crystal// as the input.
//
SysCtlClockSet(SYSCTL_SYSDIV_2_5 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ | SYSCTL_OSC_MAIN);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
while(!SysCtlPeripheralReady(SYSCTL_PERIPH_GPIOF)){} //Enable peripheral Clock for GPIOF
GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_3); //Set GPIOF Pin3 as output
while(1){
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_3, GPIO_PIN_3);
_delay_ms(200);
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_3, 0);
_delay_ms(200);}
}
The above code is to bink the green LED in RGB LED on launch pad which is connected to pin3 of PortF to blink with a delay of 200ms.
Press the little hammer button on the top and the IDE begins building the project.
After building Press the little green "Bug" button to load the program in to launch pad and debug the program.
The process of building binary files and using LM Flash Programmer will be covered in upcoming posts.
You need not use any other tools because your Launchpad has on board debugger and CCS IDE has installed those debugger drivers during installation. So just connect the launch pad to the computer with USB cable and just press the debug button and when debug window sets up press little green "Play" button to run program and press the red stop button to come out of Debug session.
If you create a new project you should always add those IncludePaths and File Search paths every time you create a new project.
The API's used in this code provided by the libraries and will elaborate the use of this functions in my next posts.
I hope that by this time you will be able to set up the project environment and build your project.
See you again in my next post describing about initialisation and using peripherals with launch pad.

Comments
Post a Comment