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/TMS570LS3137: How to get the directory in which a debug script resides

Part Number: TMS570LS3137

Tool/software: Code Composer Studio

I am writing a Debug Initialization Script to be used in a debug configuration.  In this script, I want to reference my load (.out) file using a path designation relative to where my project is located.  It appears that the default directory while executing the script is the location of CCS itself (C:\ti\ccsv7\eclipse).  How can I have the script determine the location of my project, and not the location of where CCS is installed?

  • Specifically, when I run getCurrentDirectory() on the scripting environment, it returns C:\ti\ccsv7\eclipse.
  • Hi Steven

    Steven Strauss said:
    How can I have the script determine the location of my project, and not the location of where CCS is installed?

    This is a known limitation. There is not a good way to get the location from your running javascript. Other than using absolute paths, others will use environment variables which can be read by the script

    ki

  • Ki,

    Thank you for your response.  How would I access an environment variable from within the script?  I have not done much java scripting.

    Steve

  • Steven Strauss said:
    How would I access an environment variable from within the script?

    You can actually use a Java System API from your javascript.

    Make sure you import the necessary package:

    importPackage(Packages.java.lang);

    Then you can access an environment variable like so (example for reading the BIOS_INSTALL_DIR environment variable):

    var envVarBios = System.getenv("BIOS_INSTALL_DIR");

    Thanks

    ki