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.

C2000 map files for STRUCT element

Hello everybody , 

please  I am using STRUCT like    this  for example

 signed int  typedef struct

{

                signed int op3;

                signed int op4;                

                signed int op5;              

is there a way to force the linker to give you  a complete MAP file  with all the  elemet position in memory ?

I mean Op2 address , Op3 address and so on .

as for now I can see the startinng address of the STRUCT but not every single element and  I have to do offset calculation if not connectd via emulator .  

reason behind  is  to provide  customer maintenance people with a  comeplete map file so they can ask the uC via a serial link and low level  proprietary sw  variable st a certain location without doing address calculation 

thank you 

bye

Carlo

  

  • There is no linker feature which does what you describe.  A partial solution to consider ... You can get a dump of the layout of all the structures, without any addresses, by using the utility global_type_gen in the cg_xml package.

    Thanks and regards,

    -George

  • I am also looking to do the same thing - that is get the specific address of a structure element - from something other than the CCS debugger - ideally in the build output.

    First, how does CCS resolve a structure element address? Does it use the cg_xml_package you mention above or does it do something else? 

    Second, can you give a little bit more detail about how to use the cg_xml_package to do this?

  • Jon Stevens said:
    how does CCS resolve a structure element address? Does it use the cg_xml_package you mention above or does it do something else? 

    The cg_xml package is not used.  Generally speaking, the compiler develops the address of a field in a structure.  Show the source to a specific example, and I'll tell you how it works.

    Jon Stevens said:
    can you give a little bit more detail about how to use the cg_xml_package to do this?

    The cg_xml package is a group of command line executables.  The root directory of the installation contains a file named index.htm.  Load that file into your favorite web browser to read the documentation.  In the specific case of global_types_gen, it would look like this ...

    % ofd2000 -xg --xml_indent=0 --obj_display=none --dwarf_display=none,dinfo,types final_executable.out > file.xml
    
    % global_types_gen file.xml > struct_layout.txt
    

    Then inspect the file struct_layout.txt to see the layout of the structures in that executable.

    Thanks and regards,

    -George

  • Hi George,

    Thanks for the quick reply - I installed cg_xml version 2.32.00. I did not find any script or executable "ofd2000", I did find and assumed "ofd6x" is the tool to use, is this correct?

    Second, when I run the "global_types_gen" executable I get this error

    global_types_gen test.xml > struct_layout.txt
    Did not find DIE for ID: 0x4f:0xe30e
    Use of uninitialized value $mem_type_str in printf at script/global_types_gen.pl
    line 742.

    Any thoughts on what is wrong?

    Thanks,

    Jon
  • Jon Stevens said:
    I did not find any script or executable "ofd2000"

    The utility ofd2000 is part of the compiler tools.  It is located in the same \bin directory as cl2000.  

    Jon Stevens said:
    global_types_gen test.xml > struct_layout.txt
    Did not find DIE for ID: 0x4f:0xe30e
    Use of uninitialized value $mem_type_str in printf at script/global_types_gen.pl
    line 742.

    When you created test.xml, you probably failed to use the -g option.  global_types_gen uses the debug information in the .out file to find the structure definitions.  This information is present in the XML output by default.  You have to use the ofd2000 option -g to include the debug information.

    Thanks and regards,

    -George

  • I made a typo in my last post.  This sentence is wrong ...

    George Mock said:
    This information is present in the XML output by default.

    It should say ...

    This information is not present in the XML output by default.

    Sorry!

    -George