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.

CCS/TM4C123GH6PM: Missing DriverLib and include files, how to include/install DriverLib in CCS7

Part Number: TM4C123GH6PM

Tool/software: Code Composer Studio

Hi

I am new to TI MCU's/CSS (and fairly new to MCU's in general).

I tried to build an old project for the MCU but get errors because include files and DriverLib are not accessible, the files I try to include are:

I am trying to modify the Slave part of the attached project, the changes I made are not included, this is the project copied of GitHub, I assume the project was ok when it was uploaded.

#include <stdint.h>
#include <stdbool.h>

#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "inc/hw_can.h"
#include "inc/hw_ints.h"
#include "driverlib/can.h"
#include "driverlib/interrupt.h"
#include "driverlib/sysctl.h"
#include "driverlib/gpio.h"
#include "driverlib/uart.h"
#include "driverlib/pin_map.h"

#include "utils/uartstdio.h"

It seems that the files from memmap.h and below are not available, I assume all of these files can somehow be added to the tools by downloading some "package" to CCS, is this correct ?

How can I get it ?

Please remember I am NEW to this so please bare with me and explain "For dummies".

Thanks for any help, Petertiva-can-bus-master.zip

  • Peter,

    The software package that you need is called TivaWare.  There are a couple ways to get it.  You can download it and install it from here:

    http://www.ti.com/tool/sw-tm4c

    Or if you are using a newer version of CCSv7 you can go to the View menu.  Select Resource Explorer.  Browse under software and select the package shown below.

    Once you have the package installed you will need to check the search paths setup in your project.  If you right click on the project in the Project Explorer and select properties.  Then see the capture below for where to setup the paths.  

    In my project I had imported the project from Resource Explorer and this example has the include paths setup automatically with a variable that gets defined by the location of where TivaWare is installed.  You could make use of that or just specify the path where you have it installed.

    I would also suggest checking out this workshop.  It can be helpful for learning CCS.

    downloads.ti.com/.../

    Regards,

    John

  • Hi John

    Thank, I was expecting it was a missing "package" or file path, I had downloaded the package and it was also present in the resource explorer but it was not included in the file paths.

    So far so good, I will study the workshop you link to.

    Now I am left with another issue, maybe you can explain why I get these undefined symbols ?

    This is my main.c, the only file in my project:

    /*
    * CAN bus LED controller slave firmware
    * Written for TI Tiva TM4C123GH6PM
    */

    #include <stdint.h>
    #include <stdbool.h>

    #include "inc/hw_memmap.h"
    #include "inc/hw_types.h"
    #include "inc/hw_can.h"
    #include "inc/hw_ints.h"
    #include "driverlib/can.h"
    #include "driverlib/interrupt.h"
    #include "driverlib/sysctl.h"
    #include "driverlib/gpio.h"
    #include "driverlib/uart.h"
    #include "driverlib/pin_map.h"

    #include "utils/uartstdio.h"
    //#include "drivers/rgb.h"

    volatile bool rxFlag = 0; // msg recieved flag
    volatile bool errFlag = 0; // error flag
    //PJvolatile int LEN =0; //PJ CAN message length

    // CAN interrupt handler
    void CANIntHandler(void) {

    unsigned long status = CANIntStatus(CAN0_BASE, CAN_INT_STS_CAUSE); // read interrupt status

    if(status == CAN_INT_INTID_STATUS) { // controller status interrupt
    status = CANStatusGet(CAN0_BASE, CAN_STS_CONTROL);
    errFlag = 1;
    } else if(status == 1) { // msg object 1
    CANIntClear(CAN0_BASE, 1); // clear interrupt
    rxFlag = 1; // set rx flag
    errFlag = 0; // clear any error flags
    } else { // should never happen
    UARTprintf("Unexpected CAN bus interrupt\n");
    }
    }

    int main(void) {

    tCANMsgObject msg; // the CAN msg object
    unsigned char msgData[8]; // 8 byte buffer for rx message data

    // Run from crystal at 50Mhz
    SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ | SYSCTL_OSC_MAIN);

    // Set up debugging UART
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
    GPIOPinConfigure(GPIO_PA0_U0RX);
    GPIOPinConfigure(GPIO_PA1_U0TX);
    GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
    UARTStdioConfig(0, 115200, SysCtlClockGet());

    // Set up CAN0
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
    GPIOPinConfigure(GPIO_PE4_CAN0RX);
    GPIOPinConfigure(GPIO_PE5_CAN0TX);
    GPIOPinTypeCAN(GPIO_PORTE_BASE, GPIO_PIN_4 | GPIO_PIN_5);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_CAN0);
    CANInit(CAN0_BASE);
    CANBitRateSet(CAN0_BASE, SysCtlClockGet(), 500000);
    CANIntRegister(CAN0_BASE, CANIntHandler); // use dynamic vector table allocation
    CANIntEnable(CAN0_BASE, CAN_INT_MASTER | CAN_INT_ERROR | CAN_INT_STATUS);
    IntEnable(INT_CAN0);
    CANEnable(CAN0_BASE);

    // Set up LED driver
    //PJRGBInit(1);

    // Use ID and mask 0 to recieved messages with any CAN ID
    msg.ui32MsgID = 0;
    msg.ui32MsgIDMask = 0;
    msg.ui32Flags = MSG_OBJ_RX_INT_ENABLE | MSG_OBJ_USE_ID_FILTER;
    msg.ui32MsgLen = 8; // allow up to 8 bytes

    // Load msg into CAN peripheral message object 1 so it can trigger interrupts on any matched rx messages
    CANMessageSet(CAN0_BASE, 1, &msg, MSG_OBJ_TYPE_RX);

    //PJ unsigned int colour[3];
    //PJ float intensity;

    while(1) {

    if(rxFlag) { // rx interrupt has occured

    msg.pui8MsgData = msgData; // set pointer to rx buffer
    CANMessageGet(CAN0_BASE, 1, &msg, 0); // read CAN message object 1 from CAN peripheral

    rxFlag = 0; // clear rx flag

    if(msg.ui32Flags & MSG_OBJ_DATA_LOST) { // check msg flags for any lost messages
    UARTprintf("CAN message loss detected\n");
    }

    // read in colour data from rx buffer (scale from 0-255 to 0-0xFFFF for LED driver)
    //PJcolour[0] = msgData[0] * 0xFF;
    //PJcolour[1] = msgData[1] * 0xFF;
    //PJcolour[2] = msgData[2] * 0xFF;
    //PJintensity = msgData[3] / 255.0f; // scale from 0-255 to float 0-1

    // write to UART for debugging
    //PJUARTprintf("Received colour\tr: %d\tg: %d\tb: %d\ti: %d\n", msgData[0], msgData[1], msgData[2], msgData[3]);
    UARTprintf("ID\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\n", msgData[0], msgData[1], msgData[2], msgData[3], msgData[4], msgData[5], msgData[6], msgData[7]);


    // set colour and intensity
    //PJRGBSet(colour, intensity);
    }
    }

    return 0;
    }

    Thanks in advance, Peter

  • Peter,

    This would be due to a similar issue but with the library paths.

    Here is a screen shot from one of the examples.  I actually don't like the way this one is setup.  The basic idea is that you list the libraries (.lib) in the top box and then the path to find them in the bottom.  I suspect in your project those paths will need to be adjusted.

    Regards,

    John

  • Hi John

    Thanks, unfortunately I am not able to find the lib file, is this a file/package I must download or how do I find it ?

    I do not have the file you have, I searched for "com_ti_tm4c_libraries", as you can see below, I have the DIR path set to the TivaC package but no file path.

    Is "com_ti_tm4c_libraries" the right filename or is it another file I should look for ?

    Do I need to download more or do I just need to find the right lib file ?

    Best regards

    Peter

  • I tried this:

    With this being the result:

    I am not sure it is right but only 2 errors remains ?

    Best regards, Peter

  • The paths to driverlib and grlib look ok to me.

    I searched through TivaWare. UARTprintf is defined in uartstdio.c. I found another example (gpio_jtag) that uses that function and it has the uartstdio.c file in the project.

    John