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.

CCS/CODECOMPOSER: Scripting Console get variable value

Part Number: CODECOMPOSER


Tool/software: Code Composer Studio

Hi! All 

I am using Code Composer 7.2

What I would like to achieve is the following:

I create an array at compile time, it's address might change every time I modify the system, lets call this variable arraydata.

During system runtime I fill up the array with debug data, the size of this is stored in a variable, which we shall call datalen

Now I would like to create a Scripting Console command which can read out the data from this array to a file.

I do know I can use the command saveRaw

Syntax: saveRaw(page,address,filename,length,typeSize,byteSwap)
Arguments: 
  page - the memory page, use one of PAGE_X constant.
  address - the first address in the block.
  filename - specifies the name of the file that store the target data.
  length - the number of bytes to save.
  typeSize - specifies the type size of the data.
  byteSwap - force a byte swap of the data before writing to target memory.

 

For this I need 2 things:

  1. Get the address of the arraydata
  2. Get the size of data written into that array, which is stored in datalen

How would I do this automatically with one or more commands in the Scripting Console?

  • Hi,

    I am not entirely sure what target are you using, but one way to do this is to use Debug Server direct access. In the example below I have a single core device, a running debug session, a program already loaded to the target and I am saving 32 bytes of 32 bits of a variable named "results1" to a directory on the C: drive. 

    scriptingConsole said:

    debugSession = ds.openSession(".*");
    saveRaw(PAGE_PROGRAM,debugSession.symbol.getAddress("results1"),"C:\\temp\\results_output.txt",0x20,32,false);

    Keep in mind that, for multi-core devices such as AM335x or AM572x, you will need to pass the correct core. To list all cores available and to select the correct one do the following:

    scriptingConsole said:

    js:> debugSession = ds.openSession(".*");
    Could not open session. Found 9 devices matching: .*
    Texas Instruments XDS100v2 USB Debug Probe_0/M3_wakeupSS_0
    Texas Instruments XDS100v2 USB Debug Probe_0/CortxA8
    Texas Instruments XDS100v2 USB Debug Probe_0/PRU_0
    Texas Instruments XDS100v2 USB Debug Probe_0/PRU_1
    Texas Instruments XDS100v2 USB Debug Probe_0/IcePick_D_0
    Texas Instruments XDS100v2 USB Debug Probe_0/CS_DAP_M3
    Texas Instruments XDS100v2 USB Debug Probe_0/CS_DAP_DebugSS
    Texas Instruments XDS100v2 USB Debug Probe_0/CSSTM_0
    Texas Instruments XDS100v2 USB Debug Probe_0/CSETB_0
    js:> debugSession = ds.openSession(".*/CortxA8");

    (edit) Reference: http://processors.wiki.ti.com/index.php/Scripting_Console#Services 

    Hope this helps,

    Rafael

  • Hi Rafael!

    Thanks a lot, this showed me the way.
    I was able to write a script which does what I wanted.