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.

C6678 variable address

Ti guy:

  I am trying to write a program on PC to serve my own board by analyzing the global variable's address in DSP so I can use EMAC port to get the value of the variable, like what  CCS5 view->expression or view->variables do on EVM board. The difference is that CCS5 communicates with EVM via JTAG , and can only work when DSP suspends. I am wondering after CCS5 compiles the program, does it keep some kind of symbol name to address table,or anything that links variable's name to its address? If there are something like that, how can I make use of them to get address use only variable's name? Thank you!

 Best regards

 David Yang                                                                                                                                                                                                         

                                              

  • Hi David,

    maybe you can use the .map file. I usually compile my projects using a makefile (no CCS involved) and in this case, I need to pass the -m"filename.map" option to the linker so that I can get this .map file. I suppose that the option is also available in CCS. This file has a lot of information. The part that may interest you, is the one having global variable names and their addresses. It is something like this:

    ...

    0080a948   giMyGlobalVar1
    0080d540   giAnotherGlobalVar

    ...

    So, if you want to know the value of giMyGlobalVar1, you could go to the file, see that it is on address 0080a948, and transmit this value to the DSP via Ethernet. Then, you DSP code can read this value (0x0080a948) into a variable int iAddress and make something like:

    int iValue = *((int*)iAddress);

    to get its value. Then, just transmit back to PC the value iValue.

    I hope it helps!

  • Hi,

    I suppose CCS use the DWARF debug information contained in the .out file. So You have to parse the .out file. In the simple cases you can parse the linker map text file or the xml linker report. If You look at these files, You can see that it is easy to retrive the address of a global symbols. In the xml report you can find also the size, but no info about the type

    I wonder if exist a dbg stub port on C6678, so to make the target accessible via gdbg protocol over serial or ethernet line without the emulator.

  • Hi, Alejandro

    Thanks, your answer is of great help! I used to read .map file for stack&section information, but never bothered to check it thoroughly. The sorted global name&address information is really a saver.Thanks again!

    Best regards,

    David Yang