I am able to erase and program the OC flash of an RM48L952 with the XDS200 via UniFlash Version: 3.3.0.00053 on my Windows machine (though the connection is unreliable as mentioned here). Now I want to streamline the flash process by writing a script to do the same. I started with scriptExample_complex.js and modified it for the RM48L952 my software images as follows.
/* Import DebugServer enving and Java packages */
importPackage(Packages.com.ti.debug.engine.scripting);
importPackage(Packages.com.ti.ccstudio.scripting.environment);
importPackage(Packages.java.lang);
/*
Equivalent to the command line:
uniflash -log Custom_Flash.xml -ccxml ../configs/TMS470MF066_USB.ccxml -setOptions FlashEraseSelection="Selected Sectors Only" FlashBank0Sector0=0 FlashBank0Sector1=true -operation Erase
*/
/* Global handles to the debugger */
var env = ScriptingEnvironment.instance();
var server = env.getServer("DebugServer.1");
env.traceWrite("TEST 1\n");
// Create a log file in the current directory to log script execution
env.traceBegin("Custom_Flash.xml", "../stylesheet/DefaultStylesheet.xsl");
env.traceSetFileLevel(TraceLevel.ALL);
env.traceWrite("TEST 2\n");
server.setConfig("../configs/RM48L952.ccxml");
env.traceWrite("TEST 3\n");
var session = server.openSession("*","*"); // error here
env.traceWrite("TEST 4\n");
try{
/* Unlocking device */
env.traceWrite("\nUnlocking...");
session.flash.performOperation("Unlock");
env.traceWrite("Finish unlock.\n");
/* Set Flash Options */
env.traceWrite("Setting flash options...");
session.flash.options.setString("FlashEraseSelection", "Entire Flash"); // Entire Flash, Selected Sectors Only, or Necessary Sectors Only
env.traceWrite("\nConnecting to the device...");
session.target.connect();
env.traceWrite("Connected. \n");
env.traceWrite("Erasing selected Flash sectors...");
session.flash.performOperation("Erase");
env.traceWrite("Completed.");
env.traceWrite("Starting Program loads...");
session.flash.multiloadStart();
session.memory.loadProgram("../programs/CLV.hex");
session.memory.loadProgram("../programs/boot.hex");
session.memory.loadProgram("../programs/SYS.hex");
session.flash.multiloadEnd();
env.traceWrite("Completed.\n");
}
catch(err)
{
env.traceWrite("Error encountered during script: " + err);
}
/* End session, since the tests are done
*/
server.stop();
session.terminate();
env.traceEnd();
I ran this script with the following command:
C:\ti\uniflash_3.3\ccs_base\scripting\examples\uniflash\scripting>..\..\..\bin\d ss.bat Custom_Flash.js
This is the output:
TEST 1
TEST 2
TEST 3
E_RPCENV_IO_ERROR(-6) No connection: DTC_IO_Open::dtc_io
Failed to open i/o connection (xds2xxu:0)
SEVERE: IcePick: Error initializing emulator: (Error -2083 @ 0x0) Unable to comm
unicate with the debug probe. Confirm debug probe configuration and connections,
reset the debug probe, and retry the operation. (Emulation package 5.1.641.0)
SEVERE: Could not start server: DebugServer.1: IcePick: Error initializing emula
tor: (Error -2083 @ 0x0) Unable to communicate with the debug probe. Confirm deb
ug probe configuration and connections, reset the debug probe, and retry the ope
ration. (Emulation package 5.1.641.0)
org.mozilla.javascript.WrappedException: Wrapped com.ti.ccstudio.scripting.envir
onment.ScriptingException: Could not start server: DebugServer.1: IcePick: Error
initializing emulator: (Error -2083 @ 0x0) Unable to communicate with the debug
probe. Confirm debug probe configuration and connections, reset the debug probe
, and retry the operation. (Emulation package 5.1.641.0)
(Custom_Flash.js#25)
at org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:17
05)
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:157)
at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:20
1)
at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:74)
at org.mozilla.javascript.gen.c1._c0(Custom_Flash.js:25)
at org.mozilla.javascript.gen.c1.call(Custom_Flash.js)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:3
37)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:275
5)
at org.mozilla.javascript.gen.c1.call(Custom_Flash.js)
at org.mozilla.javascript.gen.c1.exec(Custom_Flash.js)
at org.mozilla.javascript.tools.shell.Main.evaluateScript(Main.java:500)
at org.mozilla.javascript.tools.shell.Main.processFileSecure(Main.java:4
22)
at org.mozilla.javascript.tools.shell.Main.processFile(Main.java:388)
at org.mozilla.javascript.tools.shell.Main.processSource(Main.java:379)
at org.mozilla.javascript.tools.shell.Main.processFiles(Main.java:176)
at org.mozilla.javascript.tools.shell.Main$IProxy.run(Main.java:97)
at org.mozilla.javascript.Context.call(Context.java:540)
at org.mozilla.javascript.ContextFactory.call(ContextFactory.java:447)
at org.mozilla.javascript.tools.shell.Main.exec(Main.java:159)
at org.mozilla.javascript.tools.shell.Main.main(Main.java:137)
Caused by: com.ti.ccstudio.scripting.environment.ScriptingException: Could not s
tart server: DebugServer.1: IcePick: Error initializing emulator: (Error -2083 @
0x0) Unable to communicate with the debug probe. Confirm debug probe configurat
ion and connections, reset the debug probe, and retry the operation. (Emulation
package 5.1.641.0)
at com.ti.debug.engine.scripting.DebugServer$SessionFactory.<init>(Debug
Server.java:164)
at com.ti.debug.engine.scripting.DebugServer.openSession(DebugServer.jav
a:1327)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:142)
... 18 more
At the error message's recommendation, I reset the probe and tried again. The error persisted. I thought, maybe I could learn something by running UniFlash from CMD. I got the same error. With the knowledge that the program itself works (sometimes), what might be the problem with flashing via cmd and script?
Thanks,
Ryan