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.

Scripting Console: How to load multiple processors on C6472



Hi

I'm trying to develop a console script that would load all the C6472 cores sequentially. I've reviewed the info at

http://tiexpressdsp.com/index.php/Scripting_Console

and found some of the basic scripts that I need:

js:> activeDS.memory.loadProgram("myApp.out"); 

or loadProg myApp.out


But what script would I use to select next core, connect to it, then load it. I'd like to run this in a loop to load all cores.

Any idea where I can find this information?

Cheers

 

  • Almost figured it out form here

    http://tiexpressdsp.com/index.php/Debug_Server_Scripting#Examples

    I got stuck on the last function.

    debugSession1A = ds.openSession("Spectrum Digital DSK-EVM-eZdsp onboard USB Emulator_0/C64XP_1A");
    debugSession1A.target.connect();
    debugSession1A.memory.loadProgram("C:\Work\CCSv4\swi_eg\Debug\swi_eg.out");

    The loadProgram returns the error

    Error loading "C:WorkCCSv4swi_egDebugswi_eg.out": Encountered a problem loading file: C:\Program Files\Texas Instruments\ccsv4\eclipse\C:WorkCCSv4swi_egDebugswi_eg.out
    Could not open file

    How do I change the default path from

    C:\Program Files\Texas Instruments\ccsv4\eclipse\

    to my directory?

    Cheers

     

  • Hi Eddie,

    activeDS would represent the debug session for the core that is the current debug context. To access the other cores you will need to open a debug session for them like you would do for a DSS script for multicore

    Thanks

    ki

  • Hi Ki-Soo

    Sorry for my previous email not being specific enough, the problem is the default directory.

    Eddie said:

    The loadProgram returns the error

    Error loading "C:WorkCCSv4swi_egDebugswi_eg.out": Encountered a problem loading file: C:\Program Files\Texas Instruments\ccsv4\eclipse\C:WorkCCSv4swi_egDebugswi_eg.out
    Could not open file

    How do I change the default path from

    C:\Program Files\Texas Instruments\ccsv4\eclipse\

    I see from the error field it is appending my directory

    C:WorkCCSv4swi_egDebugswi_eg.out

    to the default directory

    C:\Program Files\Texas Instruments\ccsv4\eclipse\

    which causes the error because it cannot find the file.

    Maybe this is easier to see if I do not specify the directory in my command

    js:> debugSession1A.memory.loadProgram("swi_eg.out");
    Error loading "swi_eg.out": Encountered a problem loading file: C:\Program Files\Texas Instruments\ccsv4\eclipse\swi_eg.out
    Could not open fil
    e

    You can see from the bold red that its using a default directory. Is there a way to specify an absolute address and not have the loadProgram command use the default search path?

    (I'm reluctant to try addSrcSearchPath because I don't see a deleteSrcSearchPath to use in case I'm wrong)

    Cheers

     

  • Hi Eddie,

    Sorry, I totally did not see your second post after your original. I don't know how I missed it.

    Anyway can you specify try using forward slashes?

    loadProgram("C:/Work/CCSv4/swi_eg/Debug/swi_eg.out");

    I think it is appending to the current directory because it doesn't recognize that you passed in a full path. If you use forward or double backslashes, I think that would work.

    Thanks

    ki

  • Hi

    Forward slashes didn't work (my bad for trying the old DOS way). This java is taking a bit of getting used to.

    I got it to work using

    env.setCurrentDirectory("C:/Work/CCSv4/swi_eg/Debug/");
    debugSession1A.memory.loadProgram("swi_eg.out");

    Now onto figuring out how to use loadJSFile now that I know how to load the cores using the scripting language.

    Here is the complete console script for those who are in the dark about Java as much as I am.

    **** Set your directory ****
    env.setCurrentDirectory("C:/Work/CCSv4/swi_eg/Debug/");

    **** Shows what emulation devices it sees ****
    debugSession = ds.openSession(".*");

    **** Now copy the string you see into the openSession() string field. ****
    debugSession1A = ds.openSession("Spectrum Digital DSK-EVM-eZdsp onboard USB Emulator_0/C64XP_1A");
    debugSession1A.target.connect();
    debugSession1A.memory.loadProgram("swi_eg.out");

    FYI, I found the information about setCurrentDirectory under memory -> loadProgram in

    C:\Program Files\Texas Instruments\ccsv4\scripting\docs\DS_API\index.html

    And you can't use their command "ScripingEnvironment.setCurrentDirectory(String)", you have to replace ScripingEnvironment with "env" as discussed in

    http://tiexpressdsp.com/index.php/Scripting_Console

    In the "Services" section they talk about available services (yup, "services" is new to me too)

    • env: Scripting Environment
    • ds: Debug Server
    • gss_0: GUI Scripting Server
    • ps: Profile Server (deprecated, do not use)
    • hotmenu: add and remove GEL and JavaScript hotmenu items

    Happy Scripting!

    Cheers

  • Hey Ki-Soo

    Any idea how to get scripting to output to the console?

    1. s:> env.traceWrite("Loading program to first TCI6488 CPU..."); 
    2. js:> env.traceSetConsoleLevel(TraceLevel.ALL); ReferenceError: "TraceLevel" is not defined.

    I tried the above but nothing comes out on the console.

    I found the scripting info in C:\Program Files\Texas Instruments\ccsv4\scripting\docs\DS_API\index.html then select ScriptingEnvironment -> traceSetConsoleLevel

    Cheers

  • So much for LoadJSFile working!

    js:> addSrcSearchPath "C:/Work/CCSv4/JavaScripts" false

    js:> loadJSFile C:/Work/CCSv4/JavaScripts/Load2Cores
    TypeError: Cannot find function addJsFunction. (C:\Work\CCSv4\JavaScripts\Load2Cores#25)
    js:>

    This is a painful learning curve.

     

  • traceSetConsoleLevel refers to the the command line console (dos window) and not the Scripting Console.  What are you trying to pass to the Scripting Console? Javascript print messages? Or other messages like diagnostics? The former should go to the Scripting Console, but not the latter. You can stream all messages to logs however

     

  • Eddie said:
    TypeError: Cannot find function addJsFunction. (C:\Work\CCSv4\JavaScripts\Load2Cores#25)

    Are youc alling it like: 

    hotmenu.addJSFunction

    without the hotmenu, you'll will get the above error

  • Hi

    I'd like to put both java script print messages to the Scripting Console.

    But I'd also like to output the diagnostics too. Where do diagnostics go to?

    One BIG problem I'm having with learning this is the lack of a method to search the documentation at

    C:\Program Files\Texas Instruments\ccsv4\scripting\docs\DS_API\index.html

    For example, if I want to search for "print", how would I do that other than use IE to search the text in the displayed page?

    I tried window.print() (something I found by googling), but that didn't work.

    Cheers

  • Remember that the Scripting Console is basically a javascript (Rhino) shell. The print command is a javascript function, hence it would not be in the DSS documentation.

    You would not do a "window.print()" because you are not printing to a specific window but just the console. Just use "print()".

  • Hi Ki-Soo

    Thanks for having patience for the java illiterate.

    I think I understand now that the diagnostics (i.e. like "File is not available") is output on the Console.

    But I can output messages on the Scripting Console using print().

    My script works now. Its below to help other Scripting Console newbies.

    Thanks.

     

    ///////////////////////////////////////////////////////
    // This is how you load this file into the console
    //
    //     loadJSFile C:/Work/CCSv4/JavaScripts/Open2CoresAndConnect false
    //          (auto reload is off - see loadJSFile /?)
    //     loadJSFile C:/Work/CCSv4/JavaScripts/Open2CoresAndConnect true
    //          (auto reload is on)
    //
    // Now you should see this under the scripting tab.
    //
    ///////////////////////////////////////////////////////
    function Open2CoresAndConnect()
    {


    //**** Shows what emulation devices it sees ****
    //debugSession = ds.openSession(".*");

    //**** Now copy the string you see into the openSession() string field. ****
    print("\t Opening core A");
    debugSession1A = ds.openSession("Spectrum Digital DSK-EVM-eZdsp onboard USB Emulator_0/C64XP_1A");
    print("\t Connecting core A");
    debugSession1A.target.connect();
    print("\t Opening core B");
    debugSession2A = ds.openSession("Spectrum Digital DSK-EVM-eZdsp onboard USB Emulator_0/C64XP_2A");
    print("\t Connecting core B");
    debugSession2A.target.connect();

    // **** UNCOMMENT TO LOAD YOUR CORES ****
    //**** Set your directory and load****
    //env.setCurrentDirectory("C:/Work/CCSv4/");

    //**** Load your program ****
    //print("\n");
    //loadAFile = "./testDIO_preFramework_bios6/Debug/testDIO_preFramework_bios6.out";
    //print("\t Loading Core A with ", loadAFile);
    //loadAFile = "./testDIO_preFramework_bios6/Debug/testDIO_preFramework_bios6.out";
    //debugSession1A.memory.loadProgram(loadAFile);
    //loadBFile = "./testDIO_dbell_slave/Debug_C6474/testDIO_dbell_slave.out";
    //print("\t Loading Core B with ", loadBFile);
    //debugSession2A.memory.loadProgram( loadBFile);

    //**** Can't get this info to output on console for some reason ****
    //env.traceSetConsoleLevel(TraceLevel.ALL)
    //env.traceWrite("Loading program to first CPU...");

    }

    hotmenu.addJSFunction("Open 2 cores and connect.", "Open2CoresAndConnect()");

  • Hi Ki-Soo

    Thanks for having patience for the java illiterate.

    I think I understand now that the diagnostics (i.e. like "File is not available") is output on the Console.

    But I can output messages on the Scripting Console using print().

    My script works now. Its below to help other Scripting Console newbies.

    Thanks.

     

    ///////////////////////////////////////////////////////
    // This is how you load this file into the console
    //
    //     loadJSFile C:/Work/CCSv4/JavaScripts/Open2CoresAndConnect false
    //          (auto reload is off - see loadJSFile /?)
    //     loadJSFile C:/Work/CCSv4/JavaScripts/Open2CoresAndConnect true
    //          (auto reload is on)
    //
    // Now you should see this under the scripting tab.
    //
    ///////////////////////////////////////////////////////
    function Open2CoresAndConnect()
    {


    //**** Shows what emulation devices it sees ****
    //debugSession = ds.openSession(".*");

    //**** Now copy the string you see into the openSession() string field. ****
    print("\t Opening core A");
    debugSession1A = ds.openSession("Spectrum Digital DSK-EVM-eZdsp onboard USB Emulator_0/C64XP_1A");
    print("\t Connecting core A");
    debugSession1A.target.connect();
    print("\t Opening core B");
    debugSession2A = ds.openSession("Spectrum Digital DSK-EVM-eZdsp onboard USB Emulator_0/C64XP_2A");
    print("\t Connecting core B");
    debugSession2A.target.connect();

    // **** UNCOMMENT TO LOAD YOUR CORES ****
    //**** Set your directory and load****
    //env.setCurrentDirectory("C:/Work/CCSv4/");

    //**** Load your program ****
    //print("\n");
    //loadAFile = "./testDIO_preFramework_bios6/Debug/testDIO_preFramework_bios6.out";
    //print("\t Loading Core A with ", loadAFile);
    //loadAFile = "./testDIO_preFramework_bios6/Debug/testDIO_preFramework_bios6.out";
    //debugSession1A.memory.loadProgram(loadAFile);
    //loadBFile = "./testDIO_dbell_slave/Debug_C6474/testDIO_dbell_slave.out";
    //print("\t Loading Core B with ", loadBFile);
    //debugSession2A.memory.loadProgram( loadBFile);

    //**** Can't get this info to output on console for some reason ****
    //env.traceSetConsoleLevel(TraceLevel.ALL)
    //env.traceWrite("Loading program to first CPU...");

    }

    hotmenu.addJSFunction("Open 2 cores and connect.", "Open2CoresAndConnect()");