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.

ccs3.3 map file

Hi

in source code, defined:
typedef struct {
  uint8_T field1;
  uint8_T field2;
} struct_type_a;
struct_type_a struct_var_a;

then I got a map file:
00009570    struct_var_a
00009572    varB

is that possible to get a map file like this? which list all the fields address of the struct.
00009570    struct_var_a.field1
00009571    struct_var_a.field2
00009572    varB


Thanks!

  • By default, the link map displays everything that it is capable of displaying.

    The symbol names shown in the map all have "external linkage", since that is all that the linker needs to deal with.  Your global variable "struct_var_a" has external linkage, but its members have names that are meaningful only within the stucture's name space.  "struct_var_a.field1" is not an externally visible symbol insofar as the compiler and linker are concerned.  (A debugger might be able to construct that name from the object code, if enough symbol information was generated at compiler time, e.g. the -g compiler option.)

  • Hi Douglas, thanks for the helpful reply. .

    But I still have some doubts.

    1. "A debugger might be able to construct that name from the object code",  do you mean like this?

    0000cc40   RTA_fromHost$pipe
    0000cc42   RTA_fromHost$pipe$rd
    0000cc44   RTA_fromHost$pipe$rdaddr

    (I get this from the map file generated by the demo: spra958i\CCSv3\F28335_examples_CCSv3_2010Aug10\F28335_example_BIOS_ram\)

    Could you please tell me more about the object code? As far I know, the "RTA_fromHost" is defined in DspBios.

    I don't know how to define such object code, is it come form C++?

    2. For C struct, it is impossible to display the member's address in the map file, even with the -g option. Am I right?

    3. In the Watch Window of CCS, I add "&(struct_var_a.field1)", and I can get the right address. Is this mechanism totally different from the one in compiler and linker? Can I use this mechanism in linker step? If so, any  API infomation?


  • The debugger operates after the compiler, assembler, and linker have completed their work.  It can obtain symbol names from the "symbol table" attached to the executable object file (and maybe the source code, if it knows where to find it).  Normally the symbol table embedded in the executable object file contains information about internal names such as "field1" as well as the external names used by the linker, so the debugger is able to show and use all those names in expressions.  However, the internal names are not used by the linker and (with a suitable compiler option) can be omitted from the relocatable object modules that it links together; all the linker cares about is the external symbols.  For the following C source code:

    static int foo; int bar;

    the link map should show the symbol "bar" but not the symbol "foo", since "bar" has external linkage but "foo" has internal linkage.  In the case of structures, even if a structure object has external linkage, its member names are of no interest to the linker and are therefore treated like internal names.

    Of course, if you know the run-time address for the beginning of a structure object and the byte offset (within the structure) for the structure member you're interested in, then you can figure out the run-time address for the member by adding the two numbers.