Identifier undefined

tmwoods picture tmwoods · Nov 15, 2013 · Viewed 7.7k times · Source

This has happened to me a few times and I am trying to figure out the root cause of it. In a nutshell I get these errors saying that something is undefined but as near as I can tell it shouldn't be. As is shown below, I have included pin_map.h which, on line ~6580 defines all three errors I am getting (SSI1CLK, SS1RX and SS1TX being undefined).

In my project properties I have included C:\StellarisWare and have used defines from several other files. It only happens once in a while and for the life of me I cannot figure it out. Can someone please tell me what I am doing wrong?

Please note that I am using the LM3S2965 Evaluation board from TI with Code Composer Studio.

#include "inc/lm3s2965.h"
#include "inc/hw_ints.h"
#include "inc/hw_ssi.h"
#include "inc/hw_memmap.h"
#include "inc/hw_nvic.h"
#include "inc/hw_types.h"
#include "driverlib/gpio.h"
#include "driverlib/ssi.h"
#include "driverlib/pin_map.h"
#include "driverlib/sysctl.h"

void init_SPI(void){

    SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI1);
    GPIOPinConfigure(GPIO_PE0_SSI1CLK);
    GPIOPinTypeGPIOOutput(GPIO_PORTE_BASE,GPIO_PIN_1);
    GPIOPinConfigure(GPIO_PE2_SSI1RX);
    GPIOPinConfigure(GPIO_PE3_SSI1TX);

    GPIOPinWrite(GPIO_PORTE_BASE,GPIO_PIN_1,GPIO_PIN_1);

    SSIDisable(SSI1_BASE);
    GPIOPinTypeSSI(GPIO_PORTE_BASE, GPIO_PIN_3 | GPIO_PIN_2 |
                   GPIO_PIN_0);

    SSIConfigSetExpClk(SSI1_BASE, SysCtlClockGet(), SSI_FRF_MOTO_MODE_0,
                       SSI_MODE_MASTER, 1000000, 8);
    SSIEnable(SSI1_BASE);

}

The file pin_map.h is very, very long but the defines in question are:

#define GPIO_PE0_SSI1CLK        0x00040002
#define GPIO_PE0_CCP3           0x00040003
#define GPIO_PE0_EPI0S8         0x00040008

#define GPIO_PE1_SSI1FSS        0x00040402
#define GPIO_PE1_CCP2           0x00040404
#define GPIO_PE1_CCP6           0x00040405
#define GPIO_PE1_EPI0S9         0x00040408

#define GPIO_PE2_CCP4           0x00040801
#define GPIO_PE2_SSI1RX         0x00040802
#define GPIO_PE2_CCP2           0x00040805
#define GPIO_PE2_EPI0S24        0x00040808

#define GPIO_PE3_CCP1           0x00040C01
#define GPIO_PE3_SSI1TX         0x00040C02
#define GPIO_PE3_CCP7           0x00040C05
#define GPIO_PE3_EPI0S25        0x00040C08

The error itself is:

Description Resource    Path    Location    Type
#20 identifier "GPIO_PE0_SSI1CLK" is undefined  SPI.c   /Sandbox 1v1v1/SPI  line 23 C/C++ Problem

Answer

Fiddling Bits picture Fiddling Bits · Nov 15, 2013

Make sure that pin_map.h is actually in the driverlib directory. Also, are there macros wrapped around these definitions? For example:

#ifdef SOME_MACRO
    #define GPIO_PE0_SSI1CLK 0x00040002
#endif

You may have to #define "SOME_MACRO"