Setting the Environment — Tiva C
- Eslam El Hefny
- Tutorials, Tiva c
- April 1, 2025
Prerequisites
Before we begin, make sure you have:
- A TM4C123GXL LaunchPad board
- A Windows / Linux PC
- USB cable (Micro-USB)
- Internet connection for downloads
Step 1 — Install Code Composer Studio (CCS)
Code Composer Studio is Texas Instruments’ official IDE based on Eclipse.
- Go to ti.com/tool/CCSTUDIO
- Download the free version
- During installation, select Tiva C Series support
- Complete the installation (takes ~10 minutes)
# On Linux, make the installer executable first:
chmod +x CCS_setup_*.run
./CCS_setup_*.run
Step 2 — Install TivaWare SDK
TivaWare is TI’s peripheral driver library for Tiva C microcontrollers.
- Download from ti.com/tool/SW-TM4C
- Run the installer — default path is
C:\ti\TivaWare_C_Series-2.x.x.x - On Linux: extract to
~/ti/TivaWare
Step 3 — Create Your First Project
- Open CCS → File → New → CCS Project
- Select:
- Target: Tiva C Series → TM4C123GH6PM
- Connection: Stellaris In-Circuit Debug Interface
- Template: Empty Project
- Name the project
blinky
Step 4 — Write the Blinky Example
#include <stdint.h>
#include <stdbool.h>
#include "inc/hw_memmap.h"
#include "driverlib/sysctl.h"
#include "driverlib/gpio.h"
int main(void) {
// Set system clock to 80 MHz
SysCtlClockSet(SYSCTL_SYSDIV_2_5 | SYSCTL_USE_PLL |
SYSCTL_OSC_MAIN | SYSCTL_XTAL_16MHZ);
// Enable Port F clock
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
while (!SysCtlPeripheralReady(SYSCTL_PERIPH_GPIOF));
// Configure PF1 (Red LED) as output
GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1);
while (1) {
// LED ON
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1, GPIO_PIN_1);
SysCtlDelay(SysCtlClockGet() / 3); // ~1 second delay
// LED OFF
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1, 0);
SysCtlDelay(SysCtlClockGet() / 3);
}
}
Step 5 — Link TivaWare
In CCS, right-click the project → Properties → Build → ARM Compiler → Include Options:
Add the TivaWare path:
C:/ti/TivaWare_C_Series-2.2.0.295
Then add the linker library:
driverlib/ccs/Debug/driverlib.lib
Step 6 — Flash and Run
- Connect your LaunchPad via USB
- Press the Debug button (bug icon) in CCS
- CCS will flash the firmware and halt at
main() - Press Resume (▶) — the red LED should blink!
Summary
| Tool | Version | Purpose |
|---|---|---|
| CCS | 12.x | IDE + Debugger |
| TivaWare | 2.2.x | Peripheral drivers |
| TM4C123GXL | Rev D | LaunchPad board |
Next tutorial → Introduction to TivaWare