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/RM48L952: Deployed Debug Server Script Application cannot openSession

Part Number: RM48L952
Other Parts Discussed in Thread: CCSTUDIO

Tool/software: Code Composer Studio

I have an end of line configuration utility that allows us to factory configure our modules before shipping. However, I cannot get the utility to run standlane as a package .jar or as a deployed windows installed using, for example, buildFx. The application is written in Java, has a JavaFX front end and works great when executed from the Eclipse IDE (i'm using Oxygen, and jdk 1,8,0).

I have read the DSS help files and I believe I have the correct path set up, but openSession always fails. I pass my connection and core as strings g_board = "Texas Instruments XDS2xx USB Debug Probe_0" and g_cpu = "CortexR4":

debugSession = debugServer.openSession(g_board,g_cpu);

The command works every time when ran from the IDE. 

If ran from the packaged Jar I get a connection error : "Could not start server: DebugServer.1: Can not connect to DebugServer. URI is not hierarchical "

I'm fairly sure the ScriptingEnvironment is successfully created and the debugServer is also successfully created, I just can't seem to start sessions from the deployed jar. Which confuses me as being able to do the initialization of other objects would surely indicate my libraries and paths are OK? Other online posts for the URI is not hierarchical error seem to indicate it is a referencing problem but I have no idea how to debug that on the DSS side of things.

I would very much like a solution to this, such that I can deploy the application as a jar file and remove any requirement for users to start via the IDE.

  • Hi Jaime,
    The DSS jars have dependencies on other files that come with CCS. And the jar files must be referenced from their original location in the CCS installation. If you are moving the files around or referencing copies that are not in the original location, that would cause issues similar to what you are seeing. Is that the case?

    Thanks
    ki
  • So for some more info on this, below is a shot of my classpath, from within the IDE my DSS connections and all actions through the scripting engine are successful. I cannot even get a connection when running an executable JAR.

    When exporting to executable Jar I have tried all options for packaging referenced libraries i.e. extract, package and copy to sub-folder. Nothing seems to work. 

    I am connecting to an RM48L952 target via Blackhawk USB200 JTAG Emulator. As shown by the classpath I use ccs v7, but my java application is developed in Eclipse Oxygen.

    The following methods are called to get things started and appear to be successful. eol_server is the constructor for my server object through which all dss commands are handled.

    	public eol_server() {
    		/* Create Scripting Environment */
    		env = ScriptingEnvironment.instance();
    		env.setScriptTimeout(60000);
    		try {
    			env.traceSetConsoleLevel(TraceLevel.OFF);
    		} catch (ScriptingException e) {
    			// TODO Auto-generated catch block
    			serverMessagesProperty().set("TraceLevel Could not be set");
    		}
    		connectedProperty().set(false);
    		serverMessagesProperty().set("waiting");
    		targetRunningProperty().set(false);
    		programLoadingProperty().set(false);
    	}	
    	
    
    
    	public boolean getdssserver() {
    		try {
    			debugServer = (DebugServer)env.getServer("DebugServer.1");
    			if (debugServer != null) {
    				serverMessagesProperty().set("DebugServer.1 Created");
    				return true;
    			}
    			else
    			{
    				serverMessagesProperty().set("Failed to create debug server");
    				return false;
    			}
    		} catch (ScriptingException e) {
    			serverMessagesProperty().set("Failed to create debug server");
    			return false;
    		}
    	}

    In my main function I set up my JavaFX stage, instantiate an eol_server object then call getdssserver and launch the GUI. In the GUI we choose when to connect via a Java FX menu command, this permits selecting software builds and target configuration files before connecting. The connection method is as follows:

    private class ConnectService extends Service<Void> {
    		private String g_ccxml;
    		private String g_board;
    		private String g_cpu;
    		private String g_build;
    		private boolean g_loadProgram;
    		
    		public ConnectService(String board, String cpu, String ccxml,String build, boolean loadProgram) {
    			g_ccxml = ccxml;
    			g_board = board;
    			g_cpu = cpu;
    			g_build = build;
    			g_loadProgram = loadProgram;
    		}
    		
    		@Override
            protected void succeeded() {
    			//thread will set appropriate status
    			serverMessagesProperty().set("idle");
            }
    
            @Override
            protected void failed() {
            	serverMessagesProperty().set("error - connect thread");
            	
            }
    
            @Override
            protected void cancelled() {
            	serverMessagesProperty().set("error - thread exit");
            }
    
            @Override
            protected Task<Void> createTask() {
                return new Task<Void>() {
                    @Override
                    protected Void call() throws Exception {
                    	
                    	if(debugServer != null && g_board != null )
                        {
                        	serverMessagesProperty().set("Configure CCXML file");
                        	debugServer.setConfig(g_ccxml);
                        	serverMessagesProperty().set("Opening Session");
                        	try {
                        		//debugSession = debugServer.openSession(String.format("%s/%s",g_board,g_cpu));
                        		//debugSession = debugServer.openSession(g_board,g_cpu);
                        		//debugSession = debugServer.openSession("Texas Instruments XDS2xx USB Debug Probe_0/CortexR4");
                        		debugSession = debugServer.openSession("*","*");
                        		serverMessagesProperty().set("Session Opened");
                        		Thread.sleep(250);
                        		debugSession.target.connect();
                                serverMessagesProperty().set("Target Connected");
                                Thread.sleep(250);
                                debugSession.symbol.load(g_build);
                                serverMessagesProperty().set("Symbols Loaded");
                                Thread.sleep(250);
                                debugSession.target.runAsynch();
                                serverMessagesProperty().set("Target Running");
                                Thread.sleep(250);
                                //debugSession.options.printOptions(".*");
                                //there is a problem with the auto run to main after a program load, so disable that option
                                debugSession.options.setBoolean("AutoRunToLabelOnRestart",false);
                                connectedProperty().set(true);
                                targetRunningProperty().set(true);
                                
                        	}
                        	catch(Exception e)
                        	{
                        		serverMessagesProperty().set("Session Closed : Error 1");
                        		serverMessagesProperty().set(e.getMessage());
                        	}
                        	
                        }
                        else
                        {
                        	serverMessagesProperty().set("Invalid Request");
                        }
                        Thread.sleep(250); 
                        return null;
                    }
                };
            }
    	}

    The connection request is made in a thread to ensure we don't get any crashes from the JavaFX GUI while all of this completes. I have connection properties to ensure the rest of the GUI does not permit any further actions until dss is connected to the target successfully, see connectedProperty() above. Again, this works well in the IDE. But the line at which it is failing when ran in the executable is openSession:

    ...
    //debugSession = debugServer.openSession(String.format("%s/%s",g_board,g_cpu));
    //debugSession = debugServer.openSession(g_board,g_cpu);
    //debugSession = debugServer.openSession("Texas Instruments XDS2xx USB Debug Probe_0/CortexR4");
    debugSession = debugServer.openSession("*","*");
    ...

    you can see in the code snapshot above I have tried all possible permutations of openSession, with strings passed from the GUI, hardcoded strings and also just a generic connect to anything available string "*". All these options  are successful from the IDE but never work from the executable Jar. 

    Typical output in my console is 

    [ DSS : Creating Server ]
    [ DSS : Configure CCXML file ]
    [ DSS : Opening Session ]
    [ DSS : Session Closed : Error 1 ]
    [ DSS : Could not start server: DebugServer.1: Can not connect to DebugServer. URI is not hierarchical ]

    As you can see above the try catch block of my connection thread is what outputs "[ DSS : Session Closed : Error 1 ]" so it is definitely openSession that is failing. 

    What can I do to debug this further? How do I ensure my openSession arguments are correctly resolved to avoid these "URI is not hierarchical" errors?

  • If I ramp up my scripting environment tracelevel to FINE my console output is as follows, so the exception for URI not Hierarchical must come from the openSession method


  • OK...so I pass my target xml file as a string that is the result of a file select dialog. I now suspect that it is the target xml file and passing of paths by string that is not correct. Here is some text output from a successful connection from within the IDE:

    getServer: ENTRY sServerName: DebugServer.1
    getServer: Getting definition for: DebugServer.1
    getServer: Constructing server
    getServer: RETURN com.ti.debug.engine.scripting.DebugServer@14292e8
    setConfig: ENTRY sConfigurationFile: C:\Users\jwardlaw\workspace_v7b\CTLI-163_C2_Released\targetConfigs\usb_200_rm48l952.ccxml
    setConfig: RETURN
    debuggerOpen: ENTRY sBoardName: * sCPUName: *
    start: ENTRY
    start: Firing: onServerStarting()
    start: Connecting to XPCOM DebugServer
    start: Initializing DebugServer using specified configuration: "C:\Users\jwardlaw\workspace_v7b\CTLI-163_C2_Released\targetConfigs\usb_200_rm48l952.ccxml"
    waitUntil: ENTRY com.ti.ccstudio.scripting.environment.ScriptingEnvironment@75d5d8 timeout: 60000 (ms)
    <init>: CPU Name: CortexR4
    <init>: PartNum: RM48L952
    <init>: Family: 470
    <init>: SubFamily/MajorISA: d
    <init>: Revision/MinorISA: 0
    <init>: Platform: EMULATOR
    <init>: Processor ID: 1971336192
    <init>: DBName: ArmAdvancedFeatures
    <init>: CPU Name: IcePick
    <init>: PartNum: RM48L952
    <init>: Family: 240
    <init>: SubFamily/MajorISA: 2
    <init>: Revision/MinorISA: 0
    <init>: Platform: NONE
    <init>: Processor ID: 1006635013
    <init>: CPU Name: Dap
    <init>: PartNum: RM48L952
    <init>: Family: 224
    <init>: SubFamily/MajorISA: 1
    <init>: Revision/MinorISA: 0
    <init>: Platform: NONE
    <init>: Processor ID: 939525125
    waitUntil: RETURN com.ti.ccstudio.scripting.environment.ScriptingEnvironment@75d5d8
    start: Firing: onServerStarted()
    start: Searching for devices
    listDevices: ENTRY
    listDevices: Found debuggable device: Texas Instruments XDS2xx USB Debug Probe_0/CortexR4
    listDevices: Found non-debuggable device: Texas Instruments XDS2xx USB Debug Probe_0/IcePick
    listDevices: Found non-debuggable device: Texas Instruments XDS2xx USB Debug Probe_0/Dap
    listDevices: RETURN
    start: RETURN
    debuggerOpen: RETURN Texas Instruments XDS2xx USB Debug Probe_0/CortexR4
    connect: ENTRY
    isConnected: ENTRY
    isConnected: Target is not connected
    isConnected: RETURN false
    connect: Requesting target connect
    waitUntil: ENTRY timeout: 60000 (ms)
    CortexR4: GEL Output:  Memory Map Setup for Flash @ Address 0x0
    log: Target is now connected
    waitUntil: RETURN
    isConnected: ENTRY
    isConnected: Target is connected
    isConnected: RETURN true

     

    Similar output from the server when running exactly the same from the executable Jar:

    getServer: ENTRY sServerName: DebugServer.1
    getServer: Getting definition for: DebugServer.1
    getServer: Constructing server
    getServer: RETURN com.ti.debug.engine.scripting.DebugServer@1cfd9ed
    setConfig: ENTRY sConfigurationFile: C:\Users\jwardlaw\workspace_v7b\CTLI-163_C2_Released\targetConfigs\usb_200_rm48l952.ccxml
    setConfig: RETURN
    debuggerOpen: ENTRY sBoardName: * sCPUName: *
    start: ENTRY
    start: Firing: onServerStarting()
    start: Connecting to XPCOM DebugServer
    SEVERE: Can not connect to DebugServer. URI is not hierarchical
    stop: ENTRY
    stop: RETURN
    SEVERE: Could not start server: DebugServer.1: Can not connect to DebugServer. URI is not hierarchical

     

    The above would indicate that it has nothing to do with the target debugger or CPU but rather the pre-configured target ccxml file that was set up for the server. I assume that the executable Jar is not able to resolve the file. How have other people passed the string in an executable DSS Application?

     

  • aboveHello Ki, please see above for more info on all this. I suspect that the file path for the target xml file is wrong when executing outside of the IDE. I also show below how my paths are set up for the referenced Jars.

  • I have tried to just export the jar of the application on it's own without extracting all the referenced packages etc. This is not an executable Jar but rather just a packaged jar to run from the command line.

    When I do this, the application does load but then shutsdown immediately with an exception trace that indicates I cannot create my server instance as I cannot find the ScriptingEnvironment class. Here is a screenshot of my command line execution and the classpath showing all the dss jars. I don't know why this does not work, any ideas?

  • Hi Jaime,
    I'm also running into a few issues where trying to run my simple automation as an executable jar. I can run the class file from the command line without issue. I'll keep you posted of my progress. Thank you for your patience.

    ki
  • Hello Ki,

    So I seem to have also got the application running from the command line after the usual hassles fighting with classpaths, resource files etc. But it is definitely functional. This may be an option for my first deployment but it clearly it is a clunky approach. Understanding why I can't deploy in an executable Jar would be worth knowing.

    For reference my compile command was as follows, pushing the class files to a cmdbin directory to keep things separate from the eclipse directory

    javac -d .\cmdbin -cp ".";"c:\ti7\ccsv7\ccs_base\DebugServer\packages\ti\dss\java\*";"c:\users\jwardlaw\eclipse-workspace\eol\libraries\xstream-1.4.10\lib\*" <list all .java files>

    Then to execute, I copied resource files (images etc) to my .\cmdbin directory then moved to that directory and executed 

    java -cp ".";"c:\ti7\ccsv7\ccs_base\DebugServer\packages\ti\dss\java\*";"c:\users\jwardlaw\eclipse-workspace\eol\libraries\xstream-1.4.10\lib\*";"c:\Users\jwardlaw\eclipse-workspace\leo\resources\*" eol.eol_gui

    It still seems strange to me that the connection could not be made through the target configuration file when running in an executable Jar, all other actions to instantiate the server environment etc seem to be OK. You can see in the screenshot below the successful connection trace output

    Jamie

  • Hi Jamie,

    With the help of one of our senior engineers, we have determined what the issue is. The various dependent JAR files must be referenced from their original location in the CCS installation. There is a dependency on that as mentioned in my first post on this thread. Before, I was using the option to export to a "Runnable JAR file" and packaging the dependent JAR files inside the runnable JAR file. This will not work. You need the manifest file Class-path to have absolute paths to the original location of the dependent JAR files. Hence I created my own manifest file and added it to the project. Then I used the option to export to a regular JAR file and used the option "Use existing manifest from workspace" to choose the custom manifest file. 

    Example of my manifest file:

    Manifest-Version: 1.0
    Class-Path: . file:///C:/ti/ccs7.4.0.00015/ccsv7/ccs_base/DebugServer/packages/ti/dss/java/com.ti.ccstudio.scripting.environment_3.1.0.jar file:///C:/ti/ccs7.4.0.00015/ccsv7/ccs_base/DebugServer/packages/ti/dss/java/com.ti.debug.engine_1.0.0.jar file:///C:/ti/ccs7.4.0.00015/ccsv7/ccs_base/DebugServer/packages/ti/dss/java/js.jar file:///C:/ti/ccs7.4.0.00015/ccsv7/ccs_base/DebugServer/packages/ti/dss/java/dss.jar
    Main-Class: dss_test.TestRM46

    You will need to modify the path to match your CCS installation directory.

    The generated JAR file using the custom manifest file ran successfully.

    Thanks

    ki

  • Thank Ki, that all makes sense. I will work on that in the new year, for our internal use I think the batch file and distribution of the class files will suffice for initial production. As users install ccs to different locations having the jar with a classpath hardcoded is something I would have to work on, try to use environment variables in the file strings to ensure it is portable to different installations. No time to spend on it just now, but I will in future.

    Thanks

    Jamie