CODECOMPOSER: Go to Function Definition and not Declaration

Part Number: CODECOMPOSER

Tool/software:

Hello CCS team,

I'm facing the same issue mentioned below but in the latest CCS 20.3.0 version. 

(6) Go To Function Declaration in Header File - Code Composer Studio forum - Code Composer StudioTm︎ - TI E2E support forums

Could you let me know if there is any setting to go to the function definition and not the declaration?

  • Hello,

    The behavior of this feature can vary depending on structure of the code and if all the relevant source is applicable. It will always try to open the definition if possible, otherwise it will resort to opening the declaration.

    Can you provide more details on the environment? Maybe a small test case?

    Thanks

    ki

  • Hi Ki,

    I just imported a hello world example from AM263px and built the same in CCS v20 in debug mode.

    In this what I see is that the functions (whose .c in part of the project) will jump into the definitions, whereas the functions from the libraries will jump to the declaration as shown in the video attached below

    /cfs-file/__key/communityserver-discussions-components-files/81/CCS-issue.mp4

  • I tried the below option at my end

    1. Add Files/Folder to the project 

    Pros: When I add the driver source folder from the SDK, I'm able to navigate but only if I open that file atleast once in CCS in that session.

    Con: This added source folder also starts building when building the project and when I do "exclude from build" to this folder, then I'm not able to navigate to the .c file. It takes me to the declaration in .h


    Is there a better way to do this?

    Thanks and Regards,

    Nikhil Dasan

  • Is the driver code coming from a library that is linked to the project? If that is the case, then clangd would only know of the header files unless the source files were explicitly added to the project. Is this the scenario you are describing?

  • yes

    How can we link the source as well but not build it along with the project?

    What I see is that when I include the source folder using "Add Files/Folder to the project" option, I'm only able to navigate the function into the .c file only if it is opened in the CCS at least once.

    Attached video of this scenario

    So in short

    from the current scenario

    1. Add Files/Folder to the project - good, able to add source file

    2. Exclude from build - good, able to build the project without building the added driver source file

    3. Navigating to .c - need help, no able to navigate to .c unless the file is open in CCS (as shown in the attached video)

    Can you help with 3 or provide a better way to achieve this for the customers?

  • You should be able to add additional source lookup paths to the command_compiler.json (in build config subfolder uder the .clangd folder) directly or the.clangd file in the root location of the project. The former seems to work but we don't recommend people modify that file. I could not get the latter to work for some reason. I'll need to investigate that.

  • Hi Ki,

    In that case, I think we should go with the suggested way, and this is going to a customer. 
    Please investigate the suggested/recommended way and share the steps for the same, so that the same could be shared with customer.

    Thank you

  • In that case, I think we should go with the suggested way, and this is going to a customer. 

    Agreed. Once I find a good solution I'll provide and update.