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.

Compiler/TMS320F28335: Detailed information command for indirect function when creating call graph using ofd tool

Part Number: TMS320F28335
Other Parts Discussed in Thread: TMDSDOCK28335

Tool/software: TI C/C++ Compiler

Hello,

When creating a call graph using ofd tool, what command should be used to view detailed information about the indirect function?

I would like to show you the code that gives me an example.

The following is what was mentioned in the generated call graph.

"

The following functions are known to contain indirect function calls, but
do not contain any information about those indirect calls in the configuration
file specified with --i_cfg=file. Run "perldoc call_graph.pl" for more
information.

"

Thanks, Regards

Han

  • You are using the utility call_graph from the cg_xml package.  To see the documentation, please use your favorite web browser to open the file cg_xml_install_directory/index.htm.  Click the link for the script call_graph.pl.

    The utility call_graph tells you which functions make indirect function calls.  But it cannot tell you which functions are indirectly called.  You supply that information in the form of configuration files that are supplied to call_graph with the option --i_cfg=name_of_configuration_file.  More information is in the documentation for call_graph.  Please search for the sub-chapter titled CONFIGURATION FILE FOR INDIRECT FUNCTION CALLS.

    Thanks and regards,

    -George


  • Thank you for the reply, George

    As you told me, I looked at the documentation for call_graph.pl.
    However, I am having trouble using the command.

    usage: ofdXX -g -x file | perl call_graph.pl [options]

    The option I will use is --i_cfg=<file> : Configuration file for indirect function calls

    What file should be entered in <file>?

    C:\ti\ccs910\ccs\tools\compiler\ti-cgt-c2000_18.12.2.LTS\bin\ofd2000.exe -x -g "C:\Users\Hans\Desktop\PLC2-3\TI\Testbed\Micrium\Examples\TI\TMDSDOCK28335\OS2\CCS\Debug\Testbed.out" | perl "C:\Program Files (x86)\ti\cgxml-2.61.00\ofd\call_graph.pl --i_cfg=<file>" > "C:\Users\Hans\Desktop\PLC2-3\TI_bin\CFG\Testbed_cg.txt

    Can you show me the command as an example?

    Thanks, Regards

    Han

  • Han SeungJae said:
    What file should be entered in <file>?

    Some example files for the call_graph option --i_cfg are in the cg_xml installation.  Look for these files in the directory cg_xml_install_directory\ofd ...

    • arm_rts_indirect.txt
    • c2000_rts_indirect.txt
    • c55_rts_indirect.txt
    • c60_rts_indirect.txt
    • msp430_rts_indirect.txt
    • ti_rts_indirect.txt

    These files are explained in the call_graph documentation I describe in my first post.  Search for the sub-chapter titled CONFIGURATION FILES FOR COMPILER RTS FUNCTIONS.

    Thanks and regards,

    -George

  • I do not understand exactly, so I will contact you again.

    If there is an indirect function in the cg file created with call_graph.pl, do you define what the indirect function is through --i_cfg=<configuration file>?

    In other words, should I create the configuration file by defining the indirect function directly from the cg file?

    Best Regards,

    Han

  • Please consider this very simple example.  Here is a C function that makes an indirect function call.

    typedef void (* FP)();
    void child1();
    void child2();
    
    void parent(int arg)
    {
       FP function_pointer;
    
       function_pointer = (arg) ? child1 : child2;
       (*function_pointer)();
    }

    The utility call_graph can tell that parent makes an indirect function call.  It tells you with this output ...

    The following functions are known to contain indirect function calls, but
    do not contain any information about those indirect calls in the configuration
    file specified with --i_cfg=file.  Run "perldoc call_graph.pl" for more
    information.
    ======================================================================
    
    _parent

    Furthermore, in the graph, the function parent is shown as making no calls.

    So, create a text file with these contents ...

    # indirect_calls.txt
    
    _parent : _child1 _child2

    This configuration file says that the function _parent indirectly calls both _child1 and _child2.  Always list all the functions that ever get called indirectly.

    A note on the leading underscores ... These underscores are needed when you build for COFF ABI.  If you build for any TI device other than C28x, then EABI is used, and these leading underscores are not needed.  The same is true whenever you use --abi=eabi with the C28x compiler.

    When you invoke call_graph, add the option --i_cfg=indirect_calls.txt.  Here is a part of the call graph for parent ...

    |  |  |  _parent : wcs = 8
    |  |  |  |  _child1 : wcs = 2
    |  |  |  |  _child2 : wcs = 2

    Because of the configuration file, the graph now shows that parent calls both child1 and child2.

    Thanks and regards,

    -George

  • Now I understand.


    Thank you for giving detailed explanations to my frustrating question.

    Best Regards,

    Han