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.

obtaining address of fields withing a struct from dss

I am using the TI MSP430 C compiler on an embedded project.  I am writing test scripts in javascript for that code.  I need to be able to access the fields within a C struct.  How o I do this from DSS?  I am able to get the address of the struct as a whole, but I am unable to get the addresses of individual fields within the struct.  I do not want to hard code the offsets in javascript, as that would create a maintenence headache whenever the C code defining the struct changed.  Can anyone help me with this?

Thanks!

  • Hi Robert,

    Robert Brown said:
    I need to be able to access the fields within a C struct.  How o I do this from DSS?  I am able to get the address of the struct as a whole, but I am unable to get the addresses of individual fields within the struct.  I do not want to hard code the offsets in javascript, as that would create a maintenence headache whenever the C code defining the struct changed. 

    Unfortunately this is not supported, at least not in any way I am aware of. The use case I have seen always involved getting the base address of the struct and then using hard offsets.

    ki

  • So is there some way to get the C compiler to output what those offsets are for the fields in structs that are declared in a compilation unit?  I could parse compiler output to obtain the offsets, and then include them into the javascript test case.

  • Try global_types_gen from the cg_xml package.  This isn't exactly what you ask for.  But it is pretty close.

    Thanks and regards,

    -George

  • Thank you, George!  It appears thaat the xml file output by ofd430.exe -v -x -g --dwarf_display=all has all the information in it that I am looking for, but I need some documentation on the xml format -- what tags mean what, etc.  I have written a javascript function that will execute a bash shell script (I am running under cygwin), and function returns the stdout of the bash script as its return value.  What I need is the knowledge of the format of the xml file itself so that I can extract the information I require from the xml file using anything that I can do inside a bash shell script.  Where can I find documentation on the format of the xml file produced by ofd430.exe?