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.

CODECOMPOSER: Scripting 'Load Program' followed by 'Load Symbols'

Part Number: CODECOMPOSER
Other Parts Discussed in Thread: AM2634

Hello,

Background:

I'm using AM2634.

We have a multicore project running a FreeRTOS kernel on each core. However, the way it was designed (not my choice I might add) means that the FreeRTOS tasks for Cores 1,2 and 3 (and therefore their dependent application code) is only linked into Core0.out. The FreeRTOS tasks for Cores 1,2 and 3 are executed by the intended cores by function pointer to functions (tasks) linked into Core0.out. The code on each core runs just fine, i.e. a task intended for Core 2 does indeed only execute on Core 2. However debugging Cores 1,2 and 3 is impossible without extra debug session steps.

I have to...

  • Load Program for Core0 from Core0.out
  • Load Program for Core1 from Core1.out
  • Load Program for Core2 from Core2.out
  • Load Program for Core3 from Core3.out

...as usual. But then I have to:

  • Load Symbols for Core1 from Core0.out
  • Load Symbols for Core2 from Core0.out
  • Load Symbols for Core3 from Core0.out

Of course, I can only select a single .out file for each Core in the debug configuration and select either Load Program OR Load Symbols so at the moment the above Load Symbols steps are all manual and impractical.

Question: Can I somehow script all above bullet steps please?

Thank you.

  • Think I found what I was looking for in this video: Customize Debugger Launch with Scripts (youtube.com)

    I made a script which seems to work:

    // Import the DSS packages
    importPackage(Packages.com.ti.debug.engine.scripting)
    importPackage(Packages.com.ti.ccstudio.scripting.environment)
    importPackage(Packages.java.lang)
    
    // Create our scripting environment object
    var script = ScriptingEnvironment.instance();
    
    // Create a debug server
    var debugServer = script.getServer( "DebugServer.1" );
    
    // Set the device ccxml 
    debugServer.setConfig( "AM263x_LockStep.ccxml" );
        
    // Open a debug session for each CPU
    var debugSession_R5_0 = debugServer.openSession("*","Cortex_R5_0");
    var debugSession_R5_1 = debugServer.openSession("*","Cortex_R5_1");
    var debugSession_R5_2 = debugServer.openSession("*","Cortex_R5_2");
    var debugSession_R5_3 = debugServer.openSession("*","Cortex_R5_3");
    
    // Connect the targets.
    debugSession_R5_0.target.connect();
    debugSession_R5_1.target.connect();
    debugSession_R5_2.target.connect();
    debugSession_R5_3.target.connect();
    
    // Load the programs for each core.
    debugSession_R5_0.memory.loadProgram("Core0.out");
    debugSession_R5_1.memory.loadProgram("Core1.out");
    debugSession_R5_2.memory.loadProgram("Core2.out");
    debugSession_R5_3.memory.loadProgram("Core3.out");
    
    // Run to main() on each core.
    debugSession_R5_0.breakpoint.add("main");
    debugSession_R5_0.target.run();
    
    debugSession_R5_1.breakpoint.add("main");
    debugSession_R5_1.target.run();
    
    debugSession_R5_2.breakpoint.add("main");
    debugSession_R5_2.target.run();
    
    debugSession_R5_3.breakpoint.add("main");
    debugSession_R5_3.target.run();
    
    // Load the symbols in Core0.out to the other cores
    debugSession_R5_1.symbol.load("Core0.out");
    debugSession_R5_2.symbol.load("Core0.out");
    debugSession_R5_3.symbol.load("Core0.out");
    

  • Yes the above script looks good.