SPMU373A March   2021  – August 2022 TM4C1230C3PM , TM4C1230D5PM , TM4C1230E6PM , TM4C1230H6PM , TM4C1231C3PM , TM4C1231D5PM , TM4C1231D5PZ , TM4C1231E6PM , TM4C1231E6PZ , TM4C1231H6PGE , TM4C1231H6PM , TM4C1231H6PZ , TM4C1232C3PM , TM4C1232D5PM , TM4C1232E6PM , TM4C1232H6PM , TM4C1233C3PM , TM4C1233D5PM , TM4C1233D5PZ , TM4C1233E6PM , TM4C1233E6PZ , TM4C1233H6PGE , TM4C1233H6PM , TM4C1233H6PZ , TM4C1236D5PM , TM4C1236E6PM , TM4C1236H6PM , TM4C1237D5PM , TM4C1237D5PZ , TM4C1237E6PM , TM4C1237E6PZ , TM4C1237H6PGE , TM4C1237H6PM , TM4C1237H6PZ , TM4C123AE6PM , TM4C123AH6PM , TM4C123BE6PM , TM4C123BE6PZ , TM4C123BH6PGE , TM4C123BH6PM , TM4C123BH6PZ , TM4C123FE6PM , TM4C123FH6PM , TM4C123GE6PM , TM4C123GE6PZ , TM4C123GH6PGE , TM4C123GH6PM , TM4C123GH6PZ , TM4C123GH6ZXR , TM4C1290NCPDT , TM4C1290NCZAD , TM4C1292NCPDT , TM4C1292NCZAD , TM4C1294KCPDT , TM4C1294NCPDT , TM4C1294NCZAD , TM4C1297NCZAD , TM4C1299KCZAD , TM4C1299NCZAD , TM4C129CNCPDT , TM4C129CNCZAD , TM4C129DNCPDT , TM4C129DNCZAD , TM4C129EKCPDT , TM4C129ENCPDT , TM4C129ENCZAD , TM4C129LNCZAD , TM4C129XKCZAD , TM4C129XNCZAD

 

  1.   Read This First
    1.     About This Manual
    2.     Glossary
    3.     Related Documentation From Texas Instruments
    4.     Support Resources
    5.     Trademarks
  2. 1Introduction to TivaWare SDK
    1. 1.1 TivaWare SDK Folder Breakdown
  3. 2TivaWare Example Projects
    1. 2.1 TivaWare Development Board Examples
    2. 2.2 TivaWare Peripheral Examples
    3. 2.3 How to Import an Example Project into CCS
  4. 3Linking Files and Libraries into a TivaWare Project in Code Composer Studio
    1. 3.1 Linking Files in CCS
    2. 3.2 Linking Libraries in CCS
  5. 4How to Debug a TivaWare Library
    1. 4.1 How to Direct Code Composer Studio to a Source File
    2. 4.2 How to Rebuild TivaWare Libraries
  6. 5How to Add TivaWare to an Existing CCS Project
    1. 5.1 Path Variables
    2. 5.2 Include Paths
    3. 5.3 Predefined Variables
    4. 5.4 Library Linking
  7. 6TivaWare Boot Loader
    1. 6.1 Modifying a TivaWare Project for Boot Loading in Code Composer Studio
    2. 6.2 How to Boot Load with LM Flash Programmer
  8. 7Software Best Practices
    1. 7.1 Stack / Heap Settings and Stack Overflow
    2. 7.2 Interrupt Service Routines
      1. 7.2.1 Best Practices
      2. 7.2.2 TivaWare Vector Tables and IntDefaultHandler
    3. 7.3 TivaWare Hardware Header Files
    4. 7.4 ROM and MAP TivaWare Prefixes
  9. 8TM4C Resources
  10. 9Revision History

TivaWare Vector Tables and IntDefaultHandler

Within the TivaWare startup file that is included in every project and for each compiler, there is a data section for the interrupt vector table for the microcontroller. The vector table entries are populated based on the interrupt provided within the device that can be found in the Exception Types section of the device data sheet. Comments in the startup file will indicate which line corresponds to which hardware interrupt. This vector table is then mapped within the device to link all ISR’s within the application to the Nested Vectored Interrupt Controller (NVIC) on the TM4C microcontroller.

The vector table is filled with default ISR handlers to begin with. Aside from the ResetISR, which is used to soft reset the device, each other default ISR handler contains an empty while(1) loop. The FaultISR indicates that a fault has occurred in the MCU and debug will be required to understand what went wrong. There is an application report offered by TI that is focused on Diagnosing Software Faults, which shows the debug process for system faults. The NmiSR will be entered when the processor receives an NMI. Every other interrupt is associated to the catch all IntDefaultHandler. A program getting stuck in the IntDefaultHandler would indicate that an interrupt has been enabled but that the ISR handler was not properly associated with the NVIC vector table.

There are two ways to associate an application ISR with the appropriate entry for the NVIC vector table. The first is to use the IntRegister API, which will copy the vector table stored in Flash to RAM and then add the new ISR association during code execution. This allows for a dynamic method to create a new ISR association and offers more flexibility. The second method is to manually add an extern call for the application’s ISR handler in the startup file and replace the IntDefaultHandler instance for the intended peripheral with the ISR handler. This is a static method that will make the association at compile time and provides the advantage of less memory usage and code execution that makes it generally preferred.

To add an application-defined ISR handler into the startup file, the extern keyword is used in front of the declaration. The following code is from the interrupts example on the EK-TM4C123GXL LaunchPad. As seen, each ISR handler is added with an extern keyword preceding the rest of the declaration.

//*****************************************************************************
//
// External declarations for the interrupt handlers used by the application.
//
//*****************************************************************************
extern void IntGPIOa(void);
extern void IntGPIOb(void);
extern void IntGPIOc(void);

Once the ISR handler has been properly added to the startup file, find the peripherals in the vector table that correspond to the ISR. For example, searching through the table to find the GPIO peripherals for Port A, B, and C will uncover the following segment in the vector map.

    IntDefaultHandler,                      // The PendSV handler
    IntDefaultHandler,                      // The SysTick handler
    IntDefaultHandler,                      // GPIO Port A
    IntDefaultHandler,                      // GPIO Port B
    IntDefaultHandler,                      // GPIO Port C
    IntDefaultHandler,                      // GPIO Port D
    IntDefaultHandler,                      // GPIO Port E
    IntDefaultHandler,                      // UART0 Rx and Tx
Tip:

Not all peripherals are grouped together sequentially. Searching the file with a Ctrl+F can be a quick way to skim through the whole table.

Replace IntDefaultHandler for each corresponding entry on the interrupt vector table with the function name for the desired application-defined ISR handler and save the file.

    IntDefaultHandler,                      // The PendSV handler
    IntDefaultHandler,                      // The SysTick handler
    IntGPIOa,                               // GPIO Port A
    IntGPIOb,                               // GPIO Port B
    IntGPIOc,                               // GPIO Port C
    IntDefaultHandler,                      // GPIO Port D
    IntDefaultHandler,                      // GPIO Port E
    IntDefaultHandler,                      // UART0 Rx and Tx