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.

Can I make the CCS indexer look at ".c" source files of libraries?

Other Parts Discussed in Thread: EK-TM4C123GXL

Hi,

I am using CCS v6.2 with a Tiva C MCU and the Tivaware driver library, by linking with "driverlib.lib". I often want to jump to the ".c" source file of various driverlib functions, and I found no way to make this happen, even though I have the sources of that library which TI supplies.

For my own functions, pressing F3 (Open Declaration) once jumps to the .h file and a second F3 jumps to the definition, i.e. to the .c file. However, with the library functions, jumping to the .h files works but jumping again to the .c files does not work. This makes sense, since the indexer is not aware of those files. This is what I want to change.

I already tried the following methods, without success:

- adding the driverlib as a project in CCS and making sure it is open.

- adding the above project as a dependency to my own project, by Project --> Properties --> Project References --> adding a check-mark near "driverlib".

- Windows --> Preferences --> C/C++ --> Indexer --> Index source files not included in the build.

- rebuilding the index for both my project and the driverlib project.

The only thing that DOES work, but I don't want to do, is actually adding the various library ".c" files to the project by adding them as linked sources. However, this causes them to actually compile, and I don't want that - there's no reason for their binaries to end up in the flash memory of my MCU as the library binary is already linked and loaded there! It doesn't sound right, to actually change the end result of the build process just to make the IDE more helpful when I code...

p.s. this leads me to another thing I tried - linking library source files in the project but excluding them from the build. I briefly thought I succeeded but the indexer probably just noted the file before I managed to excluded it. once I excluded it and rebuilt the index, it no longer works.

I think this must be a rather common situation, both for CCS even for Eclipse users in general, so I expect there is SOME way to do that... anyone?

thanks,

Guy.

  • Guy,

    I was able to get this to work simply by adding the "driverlib" project as a dependency to the main project. After doing this when I debug the main project, I can click on a library function (such as UARTClockSourceSet) and it opens to the definition of the function in uart.c which is a driverlib source file.

    Could you provide an example project and details where this does not work for you?

  • Thank you for your quick answer. You say you are debugging the main project, that is you run the code on some hardware platform? because what I'm asking about is pressing "F3" when editing the code, not during debugging. it only brings me to the .h file of the drivelib, never to a .c file. as noted, I tried adding the driverlib as a dependency which didn't help.


    how can I send my project details?


    thanks,

    Guy.

  • Guy Ovadia said:
    because what I'm asking about is pressing "F3" when editing the code, not during debugging

    This also works for me. I tried it out the "interrupts" example project included with TivaWare. The function UARTClockSourceSet that is called in the interrupts project is defined in uart.c within the driverlib, and hitting F3 on the function call takes me to the definition in uart.c. Can you give this example a try and let me know if it works for you?

    I haven't tried too many other scenarios. Perhaps there are some specific functions that do not work because they are not indexed for some reason.

  • OK, I tried a couple of example projects ("interrupts" and "blinky" from C:\ti\TivaWare_C_Series-2.1.3.156\examples\boards\ek-tm4c123gxl) and they DO work, although only after I add "driverlib" as dependency (Project Properties --> CCS Build --> Dependencies tab --> Add). However, for my own project, it does not work. There seems to be something incorrect in my project's definitions (for more than one project). any idea where to look?


    I tried a new, clean workspace, and imported both my project and the example project, as well as the driverlib project. after adding dependencies on driverlib to both, only the example project has F3 going to the .c files (i.e. same behaviour, new workspace didn't help).

    what else can I try?

    thanks,

    Guy.

  • Guy Ovadia said:
    OK, I tried a couple of example projects ("interrupts" and "blinky" from C:\ti\TivaWare_C_Series-2.1.3.156\examples\boards\ek-tm4c123gxl) and they DO work, although only after I add "driverlib" as dependency (Project Properties --> CCS Build --> Dependencies tab --> Add).

    Yes adding it as a dependency is required for it to work.

    Guy Ovadia said:

    I tried a new, clean workspace, and imported both my project and the example project, as well as the driverlib project. after adding dependencies on driverlib to both, only the example project has F3 going to the .c files (i.e. same behaviour, new workspace didn't help). 

    I'm not sure what else is missing. I assume you already made sure to rebuild the main project, which would also trigger the build of dependent project driverlib.
    Also, for which specific function are you trying to find definition? Is it the same function that works in the example project but not in your project? The reason I ask is that in driverlib not all function calls have .c files associated with them. Some of them only exist as #define in header files.

  • I spent quite a while just now trying to understand this, and I think I finally isolated the problem: I am using C++ (.cpp) files in my projects rather than C files. For some reason this seems to confuse the indexer, even though my cpp code calls the driverlib functions and works perfectly.


    steps to reproduce the problem:

    - create a new workspace

    - import the blinky example project from "TivaWare_C_Series-2.1.3.156\examples\boards\ek-tm4c123gxl\blinky"

    - import the driverlib project from "TivaWare_C_Series-2.1.3.156\driverlib"

    - add a dependency of the blinky project on the driverlib project

    - rebuild the blinky project

    - click on "GPIOPinWrite" and press F3. At this point gpio.c opens so now it works as it should (that was the "control experiment").

    - close gpio.c

    - rename blinky.c to blinky.cpp

    - rebuild the blinky project

    - make sure all files except blinky.cpp are closed

    - click on "GPIOPinWrite" and press F3. probably only gpio.h opens. if gpio.c still opens as it's supposed to, close all files except blinky.cpp, rebuild the index, and/or restart CCS. The index may still have some remains from before or something like that, but in my experience even if it works a few seconds after the rename to .cpp, it stops very soon afterwards when I continue working.


    can you confirm this is reproducible? any idea why this happens or how to fix it?

    thanks,

    Guy.

  • I can reproduce this after renaming the source file as .cpp. I'm not sure of the reason for this behavior, it might be a bug. I will file a bug report for this so it can be analyzed, and then update the thread with the tracking number.
  • thanks! glad to hear it's not just in my system. looking forward to updates.

  • The tracking # for this issue is CCSIDE-2968.