all
Chapter 1 of 20

Setting the Environment — Tiva C

Eslam El Hefny Apr 1, 2025 2 min read
5% done

Setting the Environment — Tiva C

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.

  1. Go to ti.com/tool/CCSTUDIO
  2. Download the free version
  3. During installation, select Tiva C Series support
  4. 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.

  1. Download from ti.com/tool/SW-TM4C
  2. Run the installer — default path is C:\ti\TivaWare_C_Series-2.x.x.x
  3. On Linux: extract to ~/ti/TivaWare

Step 3 — Create Your First Project

  1. Open CCS → File → New → CCS Project
  2. Select:
    • Target: Tiva C Series → TM4C123GH6PM
    • Connection: Stellaris In-Circuit Debug Interface
    • Template: Empty Project
  3. 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);
    }
}

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

  1. Connect your LaunchPad via USB
  2. Press the Debug button (bug icon) in CCS
  3. CCS will flash the firmware and halt at main()
  4. 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

Share: