This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TiVa TM4C123GH6PM interrupt.c

Hello people from TI.

I´m new to TIVA C. I´m using the TM4C123G_LaunchPad  to learn how to program and use the peripherals.

I´m trying to build the exemple where the UART uses interrupts.

//*****************************************************************************
//
// The processor vector table.
//
// This contains a list of the handlers for the various interrupt sources in
// the system. The layout of this list is defined by the hardware; assertion
// of an interrupt causes the processor to start executing directly at the
// address given in the corresponding location in this list.
//
//*****************************************************************************
//
// Set the size of the vector table to the largest number of interrupts of
// any device
//
#undef NUM_INTERRUPTS
#define NUM_INTERRUPTS 155
#if defined(ewarm)
#pragma data_alignment=1024
static __no_init void (*g_pfnRAMVectors[NUM_INTERRUPTS])(void) @ "VTABLE";
#elif defined(sourcerygxx)
static __attribute__((section(".cs3.region-head.ram")))
void (*g_pfnRAMVectors[NUM_INTERRUPTS])(void) __attribute__ ((aligned(1024)));
#elif defined(ccs) || defined(DOXYGEN)
#pragma DATA_ALIGN(g_pfnRAMVectors, 1024)
#pragma DATA_SECTION(g_pfnRAMVectors, ".vtable")
void (*g_pfnRAMVectors[NUM_INTERRUPTS])(void);
#else
static __attribute__((section("vtable")))
void (*g_pfnRAMVectors[NUM_INTERRUPTS])(void) __attribute__((aligned(1024)));
#endif

____________________________________________________________________

interrupt.c
Error[Pe079]: expected a type specifier C:\Users\abc\Desktop\test\driverlib\interrupt.c 185
Error[Pe260]: explicit type is missing ("int" assumed) C:\Users\abc\Desktop\test\driverlib\interrupt.c 185
Error[Pe141]: unnamed prototyped parameters not allowed when body is present C:\Users\abc\Desktop\test\driverlib\interrupt.c 185
Error[Pe130]: expected a "{" C:\Users\abc\Desktop\test\driverlib\interrupt.c 186
Warning[Pe012]: parsing restarts here after previous syntax error C:\Users\abc\Desktop\test\driverlib\interrupt.c 209
Error[Pe020]: identifier "g_pfnRAMVectors" is undefined C:\Users\abc\Desktop\test\driverlib\interrupt.c 289
Error[Pe020]: identifier "g_pfnRAMVectors" is undefined C:\Users\abc\Desktop\test\driverlib\interrupt.c 311
Error[Pe020]: identifier "g_pfnRAMVectors" is undefined C:\Users\abc\Desktop\test\driverlib\interrupt.c 341
Warning[Pe177]: function "__attribute__" was declared but never referenced C:\Users\abc\Desktop\test\driverlib\interrupt.c 185
Error while running C/C++ Compiler

Total number of errors: 7
Total number of warnings: 2

Can anybody help me?

Thanks a lot.

  • Hi Xiang,

        Are you referring to the interrupt example program or the uart_echo example program?

        I was able to compile both the interrupt example program and uart_echo example program using Keil Uvision without errors.

        Are you using the Tivaware for your Tiva Launchpad?

    -kel

  • Hi  Markel,

       Yes, i am using the Tivaware for my Tiva Launchpad. I am referring to the example programs and the example programs can work well on my Launchpad.

      I was able to compile the interrupt example program using IAR without errors. But ,when i add the driver( interrupt.c) to my project , it makes errors .

  • Hi Xiang,

         I don't have IAR to properly advice you regarding that. For the other readers, detail your procedure on how you are adding \\driverlib\interrupt.c to your project.

         I was able to add \\driverlib\interrupt.c to my project at Keil Uvision and was able to compile without errors.

    -kel

  • Thanks a lot ,  Markel.

  • Typically you do not need to add driverlib\interrupt.c to your project.  The best way for beginners is to use add the entire driverlib library to the project and let the linker find the functions it needs.  Only functions you use from the library will be in the binary image created.

    Which example are you using, what is the folder name?

    Which version of TivaWare are you using.

    What modification are you making to the example?

    For beginners i suggest studying the Tiva C LaunchPad workshop http://www.ti.com/TM4C123G-Launchpad-Workshop  This has hundreds of pages of tutorials and lessons as well as videos of professional instructor covering the material.  Chapter 4 covers interrupts.  Usually simple modifications like adding your interrupt function name to the existing vector table in startup_ewarm.c and enabling the interrupt are what is needed.

    Dexter

  • xiang zhang1 said:
    when i add the driver( interrupt.c) to my project , it makes errors .

    And that is understandable!  You should provide a path to the proper driverlib - but never to a specific .c file.  Instead - insure that,  #include "driverlib/interrupt.h" appears in your source file and that your IAR > Project > Options screen appears similar to that below:  Note: our MCU is different than yours...