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.

Problems with interrupt.c in StellarisWare driver library

Other Parts Discussed in Thread: LM3S8962

Hi,

I am working on a project that needs the inclusion of the file interrupt.c which is located in the C:/StellarisWare/driverlib directory. I'm getting a few errors that I'm not quite understanding, as I have not modified the file at all from how it was originally packaged. I have attached my build log, the interrupt.c file, and a picture of what my workspace looks like. Any help is appreciated, thanks!

**** Build of configuration Release for project RTAHead ****

C:\ti\ccsv5\utils\bin\gmake -k all 
'Building file: ../uart_echo_bfr.c'
'Invoking: ARM Compiler'
"C:/ti/ccsv5/tools/compiler/tms470_4.9.1/bin/cl470" -mv7M3 --code_state=16 --abi=eabi -me -O2 --include_path="C:/ti/ccsv5/tools/compiler/tms470_4.9.1/include" --include_path="C:/StellarisWare" --diag_warning=225 --display_error_number --preproc_with_compile --preproc_dependency="uart_echo_bfr.pp"  "../uart_echo_bfr.c"
"C:/StellarisWare/driverlib\interrupt.c", line 161: error #80: expected a type specifier
"C:/StellarisWare/driverlib\interrupt.c", line 161: error #142: unnamed prototyped parameters not allowed when body is present
"C:/StellarisWare/driverlib\interrupt.c", line 162: error #131: expected a "{"
"C:/StellarisWare/driverlib\interrupt.c", line 185: warning #12-D: parsing restarts here after previous syntax error
"C:/StellarisWare/driverlib\interrupt.c", line 265: error #20: identifier "g_pfnRAMVectors" is undefined
"C:/StellarisWare/driverlib\interrupt.c", line 317: error #20: identifier "g_pfnRAMVectors" is undefined
"../uart_echo_bfr.c", line 497: warning #225-D: function declared implicitly
"../uart_echo_bfr.c", line 599: warning #169-D: argument of type "unsigned char *" is incompatible with parameter of type "const char *"
"../uart_echo_bfr.c", line 751: warning #169-D: argument of type "unsigned char *" is incompatible with parameter of type "const char *"
"../uart_echo_bfr.c", line 850: warning #169-D: argument of type "unsigned char *" is incompatible with parameter of type "const char *"
"../uart_echo_bfr.c", line 875: warning #169-D: argument of type "unsigned char *" is incompatible with parameter of type "const char *"
"../uart_echo_bfr.c", line 1083: warning #169-D: argument of type "unsigned char *" is incompatible with parameter of type "const char *"
"../uart_echo_bfr.c", line 1115: warning #169-D: argument of type "unsigned char *" is incompatible with parameter of type "const char *"
"../uart_echo_bfr.c", line 1135: warning #169-D: argument of type "unsigned char *" is incompatible with parameter of type "const char *"
"../uart_echo_bfr.c", line 1140: warning #169-D: argument of type "unsigned char *" is incompatible with parameter of type "const char *"
"../uart_echo_bfr.c", line 1145: warning #169-D: argument of type "unsigned char *" is incompatible with parameter of type "const char *"
"../uart_echo_bfr.c", line 1150: warning #169-D: argument of type "unsigned char *" is incompatible with parameter of type "const char *"
"../uart_echo_bfr.c", line 1158: warning #169-D: argument of type "unsigned char *" is incompatible with parameter of type "const char *"
"../uart_echo_bfr.c", line 1159: warning #169-D: argument of type "unsigned char *" is incompatible with parameter of type "const char *"
"../uart_echo_bfr.c", line 1160: warning #169-D: argument of type "unsigned char *" is incompatible with parameter of type "const char *"
"../uart_echo_bfr.c", line 1161: warning #169-D: argument of type "unsigned char *" is incompatible with parameter of type "const char *"
"../uart_echo_bfr.c", line 1184: warning #169-D: argument of type "unsigned char *" is incompatible with parameter of type "const char *"
"../uart_echo_bfr.c", line 1198: warning #169-D: argument of type "unsigned char *" is incompatible with parameter of type "const char *"
"../uart_echo_bfr.c", line 1212: warning #169-D: argument of type "unsigned char *" is incompatible with parameter of type "const char *"
"../uart_echo_bfr.c", line 1545: warning #169-D: argument of type "unsigned int *" is incompatible with parameter of type "int *"
"../uart_echo_bfr.c", line 1545: warning #169-D: argument of type "unsigned int *" is incompatible with parameter of type "int *"
"../uart_echo_bfr.c", line 1545: warning #169-D: argument of type "unsigned int *" is incompatible with parameter of type "int *"
"../uart_echo_bfr.c", line 1576: warning #225-D: function declared implicitly
"../uart_echo_bfr.c", line 1577: warning #112-D: statement is unreachable
"../uart_echo_bfr.c", line 1674: warning #169-D: argument of type "unsigned char *" is incompatible with parameter of type "const char *"
"../uart_echo_bfr.c", line 1679: warning #169-D: argument of type "unsigned char *" is incompatible with parameter of type "const char *"
"../uart_echo_bfr.c", line 1684: warning #169-D: argument of type "unsigned char *" is incompatible with parameter of type "const char *"
"../uart_echo_bfr.c", line 1689: warning #169-D: argument of type "unsigned char *" is incompatible with parameter of type "const char *"
"../uart_echo_bfr.c", line 1839: warning #169-D: argument of type "unsigned char *" is incompatible with parameter of type "const char *"

"../uart_echo_bfr.c", line 1848: warning #169-D: argument of type "unsigned int *" is incompatible with parameter of type "int *"
"../uart_echo_bfr.c", line 1848: warning #169-D: argument of type "unsigned int *" is incompatible with parameter of type "int *"
>> Compilation failure
"../uart_echo_bfr.c", line 1871: warning #169-D: argument of type "unsigned char *" is incompatible with parameter of type "const char *"
"../uart_echo_bfr.c", line 1914: warning #169-D: argument of type "unsigned char *" is incompatible with parameter of type "const char *"
"../uart_echo_bfr.c", line 1985: warning #169-D: argument of type "unsigned int *" is incompatible with parameter of type "int *"
"../uart_echo_bfr.c", line 1985: warning #169-D: argument of type "unsigned int *" is incompatible with parameter of type "int *"
"../uart_echo_bfr.c", line 2332: warning #48-D: incompatible redefinition of macro "GPIO_O_LOCK" (declared at line 51 of "C:/StellarisWare/inc/hw_gpio.h")
"../uart_echo_bfr.c", line 2333: warning #48-D: incompatible redefinition of macro "GPIO_O_CR" (declared at line 52 of "C:/StellarisWare/inc/hw_gpio.h")
"../uart_echo_bfr.c", line 2334: warning #48-D: incompatible redefinition of macro "GPIO_O_AFSEL" (declared at line 42 of "C:/StellarisWare/inc/hw_gpio.h")
5 errors detected in the compilation of "../uart_echo_bfr.c".
gmake: *** [uart_echo_bfr.obj] Error 1
gmake: Target `all' not remade because of errors.

**** Build Finished ****

//*****************************************************************************
//
// interrupt.c - Driver for the NVIC Interrupt Controller.
//
// Copyright (c) 2005-2012 Texas Instruments Incorporated.  All rights reserved.
// Software License Agreement
// 
// Texas Instruments (TI) is supplying this software for use solely and
// exclusively on TI's microcontroller products. The software is owned by
// TI and/or its suppliers, and is protected under applicable copyright
// laws. You may not combine this software with "viral" open-source
// software in order to form a larger program.
// 
// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
// DAMAGES, FOR ANY REASON WHATSOEVER.
// 
// This is part of revision 8555 of the Stellaris Peripheral Driver Library.
//
//*****************************************************************************

//*****************************************************************************
//
//! \addtogroup interrupt_api
//! @{
//
//*****************************************************************************

#include "inc/hw_ints.h"
#include "inc/hw_nvic.h"
#include "inc/hw_types.h"
#include "driverlib/cpu.h"
#include "driverlib/debug.h"
#include "driverlib/interrupt.h"

//*****************************************************************************
//
// This is a mapping between priority grouping encodings and the number of
// preemption priority bits.
//
//*****************************************************************************
static const unsigned long g_pulPriority[] =
{
    NVIC_APINT_PRIGROUP_0_8, NVIC_APINT_PRIGROUP_1_7, NVIC_APINT_PRIGROUP_2_6,
    NVIC_APINT_PRIGROUP_3_5, NVIC_APINT_PRIGROUP_4_4, NVIC_APINT_PRIGROUP_5_3,
    NVIC_APINT_PRIGROUP_6_2, NVIC_APINT_PRIGROUP_7_1
};

//*****************************************************************************
//
// This is a mapping between interrupt number and the register that contains
// the priority encoding for that interrupt.
//
//*****************************************************************************
static const unsigned long g_pulRegs[] =
{
    0, NVIC_SYS_PRI1, NVIC_SYS_PRI2, NVIC_SYS_PRI3, NVIC_PRI0, NVIC_PRI1,
    NVIC_PRI2, NVIC_PRI3, NVIC_PRI4, NVIC_PRI5, NVIC_PRI6, NVIC_PRI7,
    NVIC_PRI8, NVIC_PRI9, NVIC_PRI10, NVIC_PRI11, NVIC_PRI12, NVIC_PRI13,
    NVIC_PRI14, NVIC_PRI15, NVIC_PRI16, NVIC_PRI17, NVIC_PRI18, NVIC_PRI19,
    NVIC_PRI20, NVIC_PRI21, NVIC_PRI22, NVIC_PRI23, NVIC_PRI24, NVIC_PRI25,
    NVIC_PRI26, NVIC_PRI27, NVIC_PRI28, NVIC_PRI29, NVIC_PRI30, NVIC_PRI31,
    NVIC_PRI32
};

//*****************************************************************************
//
// This is a mapping between interrupt number (for the peripheral interrupts
// only) and the register that contains the interrupt enable for that
// interrupt.
//
//*****************************************************************************
static const unsigned long g_pulEnRegs[] =
{
    NVIC_EN0, NVIC_EN1, NVIC_EN2, NVIC_EN3, NVIC_EN4
};

//*****************************************************************************
//
// This is a mapping between interrupt number (for the peripheral interrupts
// only) and the register that contains the interrupt disable for that
// interrupt.
//
//*****************************************************************************
static const unsigned long g_pulDisRegs[] =
{
    NVIC_DIS0, NVIC_DIS1, NVIC_DIS2, NVIC_DIS3, NVIC_DIS4
};

//*****************************************************************************
//
// This is a mapping between interrupt number (for the peripheral interrupts
// only) and the register that contains the interrupt pend for that interrupt.
//
//*****************************************************************************
static const unsigned long g_pulPendRegs[] =
{
    NVIC_PEND0, NVIC_PEND1, NVIC_PEND2, NVIC_PEND3, NVIC_PEND4
};

//*****************************************************************************
//
// This is a mapping between interrupt number (for the peripheral interrupts
// only) and the register that contains the interrupt unpend for that
// interrupt.
//
//*****************************************************************************
static const unsigned long g_pulUnpendRegs[] =
{
    NVIC_UNPEND0, NVIC_UNPEND1, NVIC_UNPEND2, NVIC_UNPEND3, NVIC_UNPEND4
};

//*****************************************************************************
//
//! \internal
//! The default interrupt handler.
//!
//! This is the default interrupt handler for all interrupts.  It simply loops
//! forever so that the system state is preserved for observation by a
//! debugger.  Since interrupts should be disabled before unregistering the
//! corresponding handler, this should never be called.
//!
//! \return None.
//
//*****************************************************************************
static void
IntDefaultHandler(void)
{
    //
    // Go into an infinite loop.
    //
    while(1)
    {
    }
}

//*****************************************************************************
//
// 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.
//
//*****************************************************************************
#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

//*****************************************************************************
//
//! Enables the processor interrupt.
//!
//! This function allows the processor to respond to interrupts.  This function
//! does not affect the set of interrupts enabled in the interrupt controller;
//! it just gates the single interrupt from the controller to the processor.
//!
//! \note Previously, this function had no return value.  As such, it was
//! possible to include <tt>interrupt.h</tt> and call this function without
//! having included <tt>hw_types.h</tt>.  Now that the return is a
//! <tt>tBoolean</tt>, a compiler error occurs in this case.  The solution
//! is to include <tt>hw_types.h</tt> before including <tt>interrupt.h</tt>.
//!
//! \return Returns \b true if interrupts were disabled when the function was
//! called or \b false if they were initially enabled.
//
//*****************************************************************************
tBoolean
IntMasterEnable(void)
{
    //
    // Enable processor interrupts.
    //
    return(CPUcpsie());
}

//*****************************************************************************
//
//! Disables the processor interrupt.
//!
//! This function prevents the processor from receiving interrupts.  This
//! function does not affect the set of interrupts enabled in the interrupt
//! controller; it just gates the single interrupt from the controller to the
//! processor.
//!
//! \note Previously, this function had no return value.  As such, it was
//! possible to include <tt>interrupt.h</tt> and call this function without
//! having included <tt>hw_types.h</tt>.  Now that the return is a
//! <tt>tBoolean</tt>, a compiler error occurs in this case.  The solution
//! is to include <tt>hw_types.h</tt> before including <tt>interrupt.h</tt>.
//!
//! \return Returns \b true if interrupts were already disabled when the
//! function was called or \b false if they were initially enabled.
//
//*****************************************************************************
tBoolean
IntMasterDisable(void)
{
    //
    // Disable processor interrupts.
    //
    return(CPUcpsid());
}

//*****************************************************************************
//
//! Registers a function to be called when an interrupt occurs.
//!
//! \param ulInterrupt specifies the interrupt in question.
//! \param pfnHandler is a pointer to the function to be called.
//!
//! This function is used to specify the handler function to be called when the
//! given interrupt is asserted to the processor.  When the interrupt occurs,
//! if it is enabled (via IntEnable()), the handler function is called in
//! interrupt context.  Because the handler function can preempt other code,
//! care must be taken to protect memory or peripherals that are accessed by
//! the handler and other non-handler code.
//!
//! \note The use of this function (directly or indirectly via a peripheral
//! driver interrupt register function) moves the interrupt vector table from
//! flash to SRAM.  Therefore, care must be taken when linking the application
//! to ensure that the SRAM vector table is located at the beginning of SRAM;
//! otherwise the NVIC does not look in the correct portion of memory for the
//! vector table (it requires the vector table be on a 1 kB memory alignment).
//! Normally, the SRAM vector table is so placed via the use of linker scripts.
//! See the discussion of compile-time versus run-time interrupt handler
//! registration in the introduction to this chapter.
//!
//! \return None.
//
//*****************************************************************************
void
IntRegister(unsigned long ulInterrupt, void (*pfnHandler)(void))
{
    unsigned long ulIdx, ulValue;

    //
    // Check the arguments.
    //
    ASSERT(ulInterrupt < NUM_INTERRUPTS);

    //
    // Make sure that the RAM vector table is correctly aligned.
    //
    ASSERT(((unsigned long)g_pfnRAMVectors & 0x000003ff) == 0);

    //
    // See if the RAM vector table has been initialized.
    //
    if(HWREG(NVIC_VTABLE) != (unsigned long)g_pfnRAMVectors)
    {
        //
        // Copy the vector table from the beginning of FLASH to the RAM vector
        // table.
        //
        ulValue = HWREG(NVIC_VTABLE);
        for(ulIdx = 0; ulIdx < NUM_INTERRUPTS; ulIdx++)
        {
            g_pfnRAMVectors[ulIdx] = (void (*)(void))HWREG((ulIdx * 4) +
                                                     ulValue);
        }

        //
        // Point the NVIC at the RAM vector table.
        //
        HWREG(NVIC_VTABLE) = (unsigned long)g_pfnRAMVectors;
    }

    //
    // Save the interrupt handler.
    //
    g_pfnRAMVectors[ulInterrupt] = pfnHandler;
}

//*****************************************************************************
//
//! Unregisters the function to be called when an interrupt occurs.
//!
//! \param ulInterrupt specifies the interrupt in question.
//!
//! This function is used to indicate that no handler should be called when the
//! given interrupt is asserted to the processor.  The interrupt source is
//! automatically disabled (via IntDisable()) if necessary.
//!
//! \sa IntRegister() for important information about registering interrupt
//! handlers.
//!
//! \return None.
//
//*****************************************************************************
void
IntUnregister(unsigned long ulInterrupt)
{
    //
    // Check the arguments.
    //
    ASSERT(ulInterrupt < NUM_INTERRUPTS);

    //
    // Reset the interrupt handler.
    //
    g_pfnRAMVectors[ulInterrupt] = IntDefaultHandler;
}

//*****************************************************************************
//
//! Sets the priority grouping of the interrupt controller.
//!
//! \param ulBits specifies the number of bits of preemptable priority.
//!
//! This function specifies the split between preemptable priority levels and
//! subpriority levels in the interrupt priority specification.  The range of
//! the grouping values are dependent upon the hardware implementation; on
//! the Stellaris family, three bits are available for hardware interrupt
//! prioritization and therefore priority grouping values of three through
//! seven have the same effect.
//!
//! \return None.
//
//*****************************************************************************
void
IntPriorityGroupingSet(unsigned long ulBits)
{
    //
    // Check the arguments.
    //
    ASSERT(ulBits < NUM_PRIORITY);

    //
    // Set the priority grouping.
    //
    HWREG(NVIC_APINT) = NVIC_APINT_VECTKEY | g_pulPriority[ulBits];
}

//*****************************************************************************
//
//! Gets the priority grouping of the interrupt controller.
//!
//! This function returns the split between preemptable priority levels and
//! subpriority levels in the interrupt priority specification.
//!
//! \return The number of bits of preemptable priority.
//
//*****************************************************************************
unsigned long
IntPriorityGroupingGet(void)
{
    unsigned long ulLoop, ulValue;

    //
    // Read the priority grouping.
    //
    ulValue = HWREG(NVIC_APINT) & NVIC_APINT_PRIGROUP_M;

    //
    // Loop through the priority grouping values.
    //
    for(ulLoop = 0; ulLoop < NUM_PRIORITY; ulLoop++)
    {
        //
        // Stop looping if this value matches.
        //
        if(ulValue == g_pulPriority[ulLoop])
        {
            break;
        }
    }

    //
    // Return the number of priority bits.
    //
    return(ulLoop);
}

//*****************************************************************************
//
//! Sets the priority of an interrupt.
//!
//! \param ulInterrupt specifies the interrupt in question.
//! \param ucPriority specifies the priority of the interrupt.
//!
//! This function is used to set the priority of an interrupt.  When multiple
//! interrupts are asserted simultaneously, the ones with the highest priority
//! are processed before the lower priority interrupts.  Smaller numbers
//! correspond to higher interrupt priorities; priority 0 is the highest
//! interrupt priority.
//!
//! The hardware priority mechanism only looks at the upper N bits of the
//! priority level (where N is 3 for the Stellaris family), so any
//! prioritization must be performed in those bits.  The remaining bits can be
//! used to sub-prioritize the interrupt sources, and may be used by the
//! hardware priority mechanism on a future part.  This arrangement allows
//! priorities to migrate to different NVIC implementations without changing
//! the gross prioritization of the interrupts.
//!
//! \return None.
//
//*****************************************************************************
void
IntPrioritySet(unsigned long ulInterrupt, unsigned char ucPriority)
{
    unsigned long ulTemp;

    //
    // Check the arguments.
    //
    ASSERT((ulInterrupt >= 4) && (ulInterrupt < NUM_INTERRUPTS));

    //
    // Set the interrupt priority.
    //
    ulTemp = HWREG(g_pulRegs[ulInterrupt >> 2]);
    ulTemp &= ~(0xFF << (8 * (ulInterrupt & 3)));
    ulTemp |= ucPriority << (8 * (ulInterrupt & 3));
    HWREG(g_pulRegs[ulInterrupt >> 2]) = ulTemp;
}

//*****************************************************************************
//
//! Gets the priority of an interrupt.
//!
//! \param ulInterrupt specifies the interrupt in question.
//!
//! This function gets the priority of an interrupt.  See IntPrioritySet() for
//! a definition of the priority value.
//!
//! \return Returns the interrupt priority, or -1 if an invalid interrupt was
//! specified.
//
//*****************************************************************************
long
IntPriorityGet(unsigned long ulInterrupt)
{
    //
    // Check the arguments.
    //
    ASSERT((ulInterrupt >= 4) && (ulInterrupt < NUM_INTERRUPTS));

    //
    // Return the interrupt priority.
    //
    return((HWREG(g_pulRegs[ulInterrupt >> 2]) >> (8 * (ulInterrupt & 3))) &
           0xFF);
}

//*****************************************************************************
//
//! Enables an interrupt.
//!
//! \param ulInterrupt specifies the interrupt to be enabled.
//!
//! The specified interrupt is enabled in the interrupt controller.  Other
//! enables for the interrupt (such as at the peripheral level) are unaffected
//! by this function.
//!
//! \return None.
//
//*****************************************************************************
void
IntEnable(unsigned long ulInterrupt)
{
    //
    // Check the arguments.
    //
    ASSERT(ulInterrupt < NUM_INTERRUPTS);

    //
    // Determine the interrupt to enable.
    //
    if(ulInterrupt == FAULT_MPU)
    {
        //
        // Enable the MemManage interrupt.
        //
        HWREG(NVIC_SYS_HND_CTRL) |= NVIC_SYS_HND_CTRL_MEM;
    }
    else if(ulInterrupt == FAULT_BUS)
    {
        //
        // Enable the bus fault interrupt.
        //
        HWREG(NVIC_SYS_HND_CTRL) |= NVIC_SYS_HND_CTRL_BUS;
    }
    else if(ulInterrupt == FAULT_USAGE)
    {
        //
        // Enable the usage fault interrupt.
        //
        HWREG(NVIC_SYS_HND_CTRL) |= NVIC_SYS_HND_CTRL_USAGE;
    }
    else if(ulInterrupt == FAULT_SYSTICK)
    {
        //
        // Enable the System Tick interrupt.
        //
        HWREG(NVIC_ST_CTRL) |= NVIC_ST_CTRL_INTEN;
    }
    else if(ulInterrupt >= 16)
    {
        //
        // Enable the general interrupt.
        //
        HWREG(g_pulEnRegs[(ulInterrupt - 16) / 32]) =
            1 << ((ulInterrupt - 16) & 31);
    }
}

//*****************************************************************************
//
//! Disables an interrupt.
//!
//! \param ulInterrupt specifies the interrupt to be disabled.
//!
//! The specified interrupt is disabled in the interrupt controller.  Other
//! enables for the interrupt (such as at the peripheral level) are unaffected
//! by this function.
//!
//! \return None.
//
//*****************************************************************************
void
IntDisable(unsigned long ulInterrupt)
{
    //
    // Check the arguments.
    //
    ASSERT(ulInterrupt < NUM_INTERRUPTS);

    //
    // Determine the interrupt to disable.
    //
    if(ulInterrupt == FAULT_MPU)
    {
        //
        // Disable the MemManage interrupt.
        //
        HWREG(NVIC_SYS_HND_CTRL) &= ~(NVIC_SYS_HND_CTRL_MEM);
    }
    else if(ulInterrupt == FAULT_BUS)
    {
        //
        // Disable the bus fault interrupt.
        //
        HWREG(NVIC_SYS_HND_CTRL) &= ~(NVIC_SYS_HND_CTRL_BUS);
    }
    else if(ulInterrupt == FAULT_USAGE)
    {
        //
        // Disable the usage fault interrupt.
        //
        HWREG(NVIC_SYS_HND_CTRL) &= ~(NVIC_SYS_HND_CTRL_USAGE);
    }
    else if(ulInterrupt == FAULT_SYSTICK)
    {
        //
        // Disable the System Tick interrupt.
        //
        HWREG(NVIC_ST_CTRL) &= ~(NVIC_ST_CTRL_INTEN);
    }
    else if(ulInterrupt >= 16)
    {
        //
        // Disable the general interrupt.
        //
        HWREG(g_pulDisRegs[(ulInterrupt - 16) / 32]) =
            1 << ((ulInterrupt - 16) & 31);
    }
}

//*****************************************************************************
//
//! Returns if a peripheral interrupt is enabled.
//!
//! \param ulInterrupt specifies the interrupt to check.
//!
//! This function checks if the specified interrupt is enabled in the interrupt
//! controller.
//!
//! \return A non-zero value if the interrupt is enabled.
//
//*****************************************************************************
unsigned long
IntIsEnabled(unsigned long ulInterrupt)
{
    unsigned long ulRet;

    //
    // Check the arguments.
    //
    ASSERT(ulInterrupt < NUM_INTERRUPTS);

    //
    // Initialize the return value.
    //
    ulRet = 0;

    //
    // Determine the interrupt to disable.
    //
    if(ulInterrupt == FAULT_MPU)
    {
        //
        // Check the MemManage interrupt.
        //
        ulRet = HWREG(NVIC_SYS_HND_CTRL) & NVIC_SYS_HND_CTRL_MEM;
    }
    else if(ulInterrupt == FAULT_BUS)
    {
        //
        // Check the bus fault interrupt.
        //
        ulRet = HWREG(NVIC_SYS_HND_CTRL) & NVIC_SYS_HND_CTRL_BUS;
    }
    else if(ulInterrupt == FAULT_USAGE)
    {
        //
        // Check the usage fault interrupt.
        //
        ulRet = HWREG(NVIC_SYS_HND_CTRL) & NVIC_SYS_HND_CTRL_USAGE;
    }
    else if(ulInterrupt == FAULT_SYSTICK)
    {
        //
        // Check the System Tick interrupt.
        //
        ulRet = HWREG(NVIC_ST_CTRL) & NVIC_ST_CTRL_INTEN;
    }
    else if(ulInterrupt >= 16)
    {
        //
        // Check the general interrupt.
        //
        ulRet = HWREG(g_pulEnRegs[(ulInterrupt - 16) / 32]) &
                (1 << ((ulInterrupt - 16) & 31));
    }
    return(ulRet);
}

//*****************************************************************************
//
//! Pends an interrupt.
//!
//! \param ulInterrupt specifies the interrupt to be pended.
//!
//! The specified interrupt is pended in the interrupt controller.  Pending an
//! interrupt causes the interrupt controller to execute the corresponding
//! interrupt handler at the next available time, based on the current
//! interrupt state priorities. For example, if called by a higher priority
//! interrupt handler, the specified interrupt handler is not called until
//! after the current interrupt handler has completed execution.  The interrupt
//! must have been enabled for it to be called.
//!
//! \return None.
//
//*****************************************************************************
void
IntPendSet(unsigned long ulInterrupt)
{
    //
    // Check the arguments.
    //
    ASSERT(ulInterrupt < NUM_INTERRUPTS);

    //
    // Determine the interrupt to pend.
    //
    if(ulInterrupt == FAULT_NMI)
    {
        //
        // Pend the NMI interrupt.
        //
        HWREG(NVIC_INT_CTRL) |= NVIC_INT_CTRL_NMI_SET;
    }
    else if(ulInterrupt == FAULT_PENDSV)
    {
        //
        // Pend the PendSV interrupt.
        //
        HWREG(NVIC_INT_CTRL) |= NVIC_INT_CTRL_PEND_SV;
    }
    else if(ulInterrupt == FAULT_SYSTICK)
    {
        //
        // Pend the SysTick interrupt.
        //
        HWREG(NVIC_INT_CTRL) |= NVIC_INT_CTRL_PENDSTSET;
    }
    else if(ulInterrupt >= 16)
    {
        //
        // Pend the general interrupt.
        //
        HWREG(g_pulPendRegs[(ulInterrupt - 16) / 32]) =
            1 << ((ulInterrupt - 16) & 31);
    }
}

//*****************************************************************************
//
//! Unpends an interrupt.
//!
//! \param ulInterrupt specifies the interrupt to be unpended.
//!
//! The specified interrupt is unpended in the interrupt controller.  Unpending
//! an interrupt causes any previously generated interrupts that have not been
//! handled yet (due to higher priority interrupts or the interrupt not having
//! been enabled yet) to be discarded.
//!
//! \return None.
//
//*****************************************************************************
void
IntPendClear(unsigned long ulInterrupt)
{
    //
    // Check the arguments.
    //
    ASSERT(ulInterrupt < NUM_INTERRUPTS);

    //
    // Determine the interrupt to unpend.
    //
    if(ulInterrupt == FAULT_PENDSV)
    {
        //
        // Unpend the PendSV interrupt.
        //
        HWREG(NVIC_INT_CTRL) |= NVIC_INT_CTRL_UNPEND_SV;
    }
    else if(ulInterrupt == FAULT_SYSTICK)
    {
        //
        // Unpend the SysTick interrupt.
        //
        HWREG(NVIC_INT_CTRL) |= NVIC_INT_CTRL_PENDSTCLR;
    }
    else if(ulInterrupt >= 16)
    {
        //
        // Unpend the general interrupt.
        //
        HWREG(g_pulUnpendRegs[(ulInterrupt - 16) / 32]) =
            1 << ((ulInterrupt - 16) & 31);
    }
}

//*****************************************************************************
//
//! Sets the priority masking level
//!
//! \param ulPriorityMask is the priority level that is masked.
//!
//! This function sets the interrupt priority masking level so that all
//! interrupts at the specified or lesser priority level are masked.  Masking
//! interrupts can be used to globally disable a set of interrupts with
//! priority below a predetermined threshold.  A value of 0 disables priority
//! masking.
//!
//! Smaller numbers correspond to higher interrupt priorities.  So for example
//! a priority level mask of 4 allows interrupts of priority level 0-3,
//! and interrupts with a numerical priority of 4 and greater are blocked.
//!
//! The hardware priority mechanism only looks at the upper N bits of the
//! priority level (where N is 3 for the Stellaris family), so any
//! prioritization must be performed in those bits.
//!
//! \return None.
//
//*****************************************************************************
void
IntPriorityMaskSet(unsigned long ulPriorityMask)
{
    CPUbasepriSet(ulPriorityMask);
}

//*****************************************************************************
//
//! Gets the priority masking level
//!
//! This function gets the current setting of the interrupt priority masking
//! level.  The value returned is the priority level such that all interrupts
//! of that and lesser priority are masked.  A value of 0 means that priority
//! masking is disabled.
//!
//! Smaller numbers correspond to higher interrupt priorities.  So for example
//! a priority level mask of 4 allows interrupts of priority level 0-3,
//! and interrupts with a numerical priority of 4 and greater are blocked.
//!
//! The hardware priority mechanism only looks at the upper N bits of the
//! priority level (where N is 3 for the Stellaris family), so any
//! prioritization must be performed in those bits.
//!
//! \return Returns the value of the interrupt priority level mask.
//
//*****************************************************************************
unsigned long
IntPriorityMaskGet(void)
{
    return(CPUbasepriGet());
}

//*****************************************************************************
//
// Close the Doxygen group.
//! @}
//
//*****************************************************************************

  • Hi Dru,

    first of all I would recommend either starting with an example or linking to the entire driver library rather than a single c file. 

    Have a look at this wiki topic. It shows how to include libraries and how to check/add/correct include paths and options.

    http://processors.wiki.ti.com/index.php/Include_paths_and_options

    Please keep us informed.
    Best Regards,
    Lisa

  • I am linking to the entire driver library. I have "C:/StellarisWare" in my includes paths. 

  • Hi Dru,

    what exact CCS version do you use?  How have you been linking in the library?  Which include paths did you add this to and did you add the exact path down into the driver library?  More details would help us.

    Best Regards,

    Lisa

  • I am using code composer Version: 5.2.0.00069. To add my include path I go to Project> Properties > Build > ARM Compiler > Include Options and add it under the "Add dir to #include search path (--include_path, -I)".

    The exact path that I added was "C:/StellarisWare", and in my c files if I need to include something from there I use for example: 

    #include "driverlib\interrupt.h"

    or

    #include "inc\hw_uart.h"

    When I include interrupt.c it gives me the errors that I described above. When I don't include it I get undefined symbol errors, most of them stemming from interrupt.c.

  • Hi Dru,

    please read the wiki link I sent you.  Libraries are added under the Linker File Search Path.   Please look at the wiki and give this a try and keep us informed. 

    Best Regards,

    Lisa

  • With all due respect I don't believe that linking the files is my problem here. I can add them directly to my project without any sort of linking and I still get the same errors that I described above. I tried a few of the methods in the wiki regardless and none of them fixed my issue. 

  • Dru,

    As you can see in the interrupt.c source file, there are #defines for different toolsets:
    #elif defined(ccs) || defined(DOXYGEN)  etc

    This requires "ccs" to be defined and if you take a look at the Stellarisware examples, it is set with the compiler option --define=ccs. In addition there is typically a define for the device being used and --gcc option for enabling gcc support (these may or may not be required depending on the application/code). It is best to add these options for all projects. I would suggest taking a look at one of the examples to confirm the options and set these for your custom projects as well. This should resolve the build errors with interrupt.c.

    Let us know it that helps.

  • Thanks, that helped my issue with interrupt.c, but now I'm having a linking issue that I've had before and haven't figured out yet. 

    I'm getting this: 

    undefined first referenced
    symbol in file 

    --------- ----------------
    CPUcpsid ./interrupt.obj
    CPUcpsie ./interrupt.obj
    CPUwfi ./sysctl.obj
    SysCtlDelay ./sysctl.obj

     the first 3 symbols are defined in cpu.c and the last one is in sysctl.c, both of which I have unmodified and included in my project. Below is my build console output:

    **** Build of configuration Debug for project RTAHead ****

    C:\ti\ccsv5\utils\bin\gmake -k all
    subdir_rules.mk:28: warning: overriding commands for target `cpu.obj'
    subdir_rules.mk:21: warning: ignoring old commands for target `cpu.obj'
    'Building target: RTAHead.out'
    'Invoking: ARM Linker'
    "C:/ti/ccsv5/tools/compiler/tms470_4.9.1/bin/cl470" -mv7M3 --code_state=16 --abi=eabi -me -g --gcc --define=css --define=PART_LM3S8962 --diag_warning=225 --display_error_number -z --stack_size=256 -m"RTAHead.map" --heap_size=0 -i"C:/ti/ccsv5/tools/compiler/tms470_4.9.1/lib" -i"C:/ti/ccsv5/tools/compiler/tms470_4.9.1/include" --reread_libs --warn_sections --display_error_number --rom_model -o "RTAHead.out" "./watchdog.obj" "./uart_echo_bfr.obj" "./uart.obj" "./timer.obj" "./systick.obj" "./sysctl.obj" "./startup_ccs.obj" "./ssi.obj" "./rit128x96x4.obj" "./pwm.obj" "./interrupt.obj" "./gpio.obj" "./cpu.obj" "./can_net.obj" "./can.obj" -l"libc.a"
    <Linking>
    warning #10247-D: creating output section "vtable" without a SECTIONS
    specification

    undefined first referenced
    symbol in file
    --------- ----------------
    CPUcpsid ./interrupt.obj

    CPUcpsie ./interrupt.obj
    CPUwfi ./sysctl.obj
    SysCtlDelay ./sysctl.obj

    error #10234-D: unresolved symbols remain
    >> Compilation failure
    error #10010: errors encountered during linking; "RTAHead.out" not built
    gmake: *** [RTAHead.out] Error 1
    gmake: Target `all' not remade because of errors.

    **** Build Finished ****


  • Dru Steeby said:
    'Invoking: ARM Linker'
    "C:/ti/ccsv5/tools/compiler/tms470_4.9.1/bin/cl470" -mv7M3 --code_state=16 --abi=eabi -me -g --gcc --define=css

    Looks like you have a typo: --define=css should be --define=ccs