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.

Linking file from outside a project

Other Parts Discussed in Thread: EK-TM4C123GXL

I’m working through lab3 of the TM4C123_Launchpad_Workshop_Workbook. I completed through the entire lab sort of understanding what I’ve been doing in creating links to files outside of the project directory.

The homework idea was to incorporate the ButtonsPoll() API, as also demonstrated in the qs-rgb.c example in the TivaWare_C_Series-1.1 example folder. So far I’ve:

  1. Created a path variable named SW_ROOT with the value of ${ORIGINAL_PROJECT_ROOT}\..\..\..\..\.. in Project Properties/Resource/Linked Resources/[Path Variables tab]
  2. Created linked resource to buttons.c and buttons.h in Project Properties/Resource/Linked Resources/[Linked Resources tab]. If I click on the edit button, it shows the location as: SW_ROOT\examples\boards\ek-tm4c123gxl\drivers\buttons.c and the resolved location to the correct folder.
  3. Added the #include search path in Project Properties/Build/ARM Compiler/Include Options. The two search paths I’ve included were “${SW_ROOT}” and “${SW_ROOT}/examples/boards/ek-tm4c123gxl”.
  4. Created Build Variables in Project Properties/Build/[Variables tab]. The two build variables I created were ORIGINAL_PROJECT_ROOT (type Directory and value C:/ti/TivaWare_C_Series-1.1/examples/boards/ek-tm4c123gxl/qs-rgb/ccs) and SW_ROOT (type Directory and value ${ORIGINAL_PROJECT_ROOT}/../../../../..).

I feel like I’ve followed the steps of the lab in: 1. Adding a path variable; 2. Adding a build variable, 3. Linking the file to the project, and 4. Adding the include search paths. I’ve even tried to make it simple by copying the steps directly from the qs-rgb project.

The problems that occur are:

  1. A small yellow triangle with an exclamation mark appears on the icon of buttons.c in my project explorer.
  2. When I build, errors occurring. One example of the error appearing is: unresolved symbol ROM_SysCtlPeripheralEnable, first referenced in ./buttons.obj lab3

What exactly am I doing wrong? Why won’t my project build? It seems like the project cannot find the buttons.c file even though I’ve linked it as well as buttons.h file. 

  • Hi Trung,

    Please include the rom.h header file in your file.
    #include "driverlib/rom.h"

    Regards,
    QJ
  • QJ, thanks for your suggestion. I've tried that, and I get the same errors. Here is my source code:

    #include <stdint.h>
    #include <stdbool.h>
    #include "inc/hw_memmap.h"
    #include "inc/hw_types.h"
    #include "driverlib/sysctl.h"
    #include "driverlib/gpio.h"
    #include "drivers/buttons.h"
    #include "driverlib/rom.h"

    uint8_t ui8PinData=14;

    int main(void)
    {
    SysCtlClockSet(SYSCTL_SYSDIV_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);

    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
    GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3);

    ButtonsInit();

    while(1)
    {
    GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3, ui8PinData);
    SysCtlDelay(4000000);
    GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3, 0x00);
    SysCtlDelay(4000000);
    }
    }
  • Hi Trung,

    right click your CCS project and select "New->Folder". Go to "Advanced" and then select "Link to Alternate Location". Set the location to your "drivers" folder.

    - kel
  • Trung Mai said:

    The problems that occur are:

    1. A small yellow triangle with an exclamation mark appears on the icon of buttons.c in my project explorer.
    2. When I build, errors occurring. One example of the error appearing is: unresolved symbol ROM_SysCtlPeripheralEnable, first referenced in ./buttons.obj lab3

    For the ROM_* functions to be resolved, a predefined macro of the form TARGET_IS_* needs to be defined before ROM.h is included, which identifies the type and revision of the device.

    If you look at a TivaWare example for the EK-TM4C123GXL, e.g. uart_echo, the TARGET_IS_TM4C123_RB1 pre-defined name is set in the CCS project properties:

    If you add the pre-defined symbol TARGET_IS_TM4C123_RB the error about the undefined symbol ROM_SysCtlPeripheralEnable should be fixed.

    I think the "small yellow triangle with an exclamation mark appears on the icon of buttons.c" probably means the compiler generated a warning that there was no function prototype for the ROM_SysCtlPeripheralEnable function, and adding the pre-defined symbol TARGET_IS_TM4C123_RB should also remove the warning.

  • Markel,

    I did just that, and I get the same errors. 

  • Chester,


    That's really interesting, but why did the workshop pdf not add this information? In any regards, it didn't work.

  • Trung Mai said:
    In any regards, it didn't work.

    I can't see what is causing the error.

    Can you zip-up and post your entire project, or failing that post the complete output from the CCS CDT build console?

  • Hi Trung,

    I made the same to work using my Tiva Connected Launchpad. For Tiva Launchpad I suggest to start fresh so delete your lab03 CCS Project and follow the lab03 steps from the workbook link below.

    software-dl.ti.com/.../TM4C123G_LaunchPad_Workshop_Workbook.pdf

    After the lab03 blinky works follow these steps below. Add the ButtonsInit(); before the while loop.

    1. Right click your CCS project and select "New->Folder". Go to "Advanced" and then select "Link to Alternate Location". Set the location to your "drivers" folder. Example drivers folder location "C:\EK-TM4C123GXL-KEIL-753\examples\boards\ek-tm4c123gxl\drivers".
    2. As suggested by Chester add TARGET_IS_BLIZZARD_RB1 at CCS Project Settings->Predefined Symbols.
    3. Go to CCS Project Properties->Include Options and add this search path "C:\EK-TM4C123GXL-KEIL-753\examples\boards\ek-tm4c123gxl". Change that to your folder location equivalent.

    - kel
  • Hi,

    From your posted pictures I can see the driverlib.lib is in Linked resources tab. It shouldn't be there. Remove that path and go to Project Properties ->Build->ARM Linker and you will find out a special location where to add libraries, and on the same tab, the path to be added.

    Take into account the Eclipse is not perfect, has problems with paths and is recommended to insert relative paths instead absolute ones. Can be done easy - right click on the path and choose to transform it to relative one.

  • Petrei said:
    From your posted pictures I can see the driverlib.lib is in Linked resources tab. It shouldn't be there. Remove that path and go to Project Properties ->Build->ARM Linker and you will find out a special location where to add libraries, and on the same tab, the path to be added.

    Adding a library as a linked resource isn't a problem. e.g. the MSPware emptyProject example references the MSP432 msp432p4xx_driverlib.lib as a linked resource rather than under CCS Build -> MSP432 Linker -> File Search Path -> Include library file and that example builds without error.

    The problem in this thread is that the ROM_* functions are being reported as unresolved. The ROM_* functions aren't in a library, but use macros in the rom.h file to generate code which calls functions pointers in a ROM look-up table. i.e. the ROM_* functions should be "resolved" by including rom.h with the appropriate macro names defined to set the device type and revision.

  • Chester and Markel,

    First of all, I really appreciate your help!

    I've finally gotten it to work. The step that got it to work was to predefine symbol TARGET_IS_BLIZZARD_RB1. My question to you guys is: What is this, and why did it required?
  • Trung Mai said:
    The step that got it to work was to predefine symbol TARGET_IS_BLIZZARD_RB1. My question to you guys is: What is this, and why did it required?

    TARGET_IS_BLIZZARD_RB1 is a old name from StellarisWare, which in the later TivaWare releases was renamed to TARGET_IS_TM4C123_RB1.

    Looking back at your original post I now see that you are using TivaWare 1.1. I don't have that version of TivaWare installed, but expect that in that version the name TARGET_IS_TM4C123_RB1 isn't recognized and therefore you had to use TARGET_IS_BLIZZARD_RB1 instead.

    [This is a hang-over from when the Stellaris parts were "rebranded" to Tiva parts]