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/TMS320F28377S: Erase selected sectors of flash using DSS

Part Number: TMS320F28377S
Other Parts Discussed in Thread: CCSTUDIO

Tool/software: Code Composer Studio

Here's the snapshot of my script so far:

debugSession = debugServer.openSession( "*","*" );
debugSession.flash.options.setString("FlashEraseSelection", "Selected Sectors Only");
debugSession.flash.options.setNumeric("FlashSPLLIMULT",19);
debugSession.flash.options.setString("FlashSPLLFMULT","0 [0]");
debugSession.flash.options.setString("FlashSYSDIVSEL","0 [/1]");

.....

debugSession.flash.erase();

I noticed in the API document the following note

" look up the exact string for your device using the mySession.flash.options.printOptions() API" , I am not quite sure how to use this function. 

How can I specify the sectors I wish to erase? 

Thanks

Rashmy

  • Hi Rashmy,

    Rashmy Parimi said:
    " look up the exact string for your device using the mySession.flash.options.printOptions() API" , I am not quite sure how to use this function. 

    Simply add the call to your script. This will print all available options for your device and the associated strings for it.

    debugSession.flash.options.printOptions(".*");

    I attached my output.

    /cfs-file/__key/communityserver-discussions-components-files/81/flash_5F00_options_5F00_f28377.txt

    Rashmy Parimi said:
    How can I specify the sectors I wish to erase? 

    if you look at the printOptions output, you can see:

    Radio Button Option:
        id: FlashEraseSelection
        name: TMS320C28XX.Flash Settings.Erase Settings.
        value: Entire Flash
        choices:
            Entire Flash
            Necessary Sectors Only (for Program Load)
            Selected Sectors Only
    Boolean Option:
        id: FlashC28Bank0Sector0
        name: TMS320C28XX.Flash Settings.Erase Settings.Sector A (0x80000 - 0x81FFF)
        value: true
    Boolean Option:
        id: FlashC28Bank0Sector1
        name: TMS320C28XX.Flash Settings.Erase Settings.Sector B (0x82000 - 0x83FFF)
        value: true
    Boolean Option:
        id: FlashC28Bank0Sector2
        name: TMS320C28XX.Flash Settings.Erase Settings.Sector C (0x84000 - 0x85FFF)
        value: true

    ....

    So an example of erasing just the first two sectors would look like:

    session.flash.options.setString("FlashEraseSelection","Selected Sectors Only");

    session.flash.options.setBoolean("FlashC28Bank0Sector0",true);
    session.flash.options.setBoolean("FlashC28Bank0Sector1",true);
    session.flash.options.setBoolean("FlashC28Bank0Sector2",false);
    session.flash.options.setBoolean("FlashC28Bank0Sector3",false);
    session.flash.options.setBoolean("FlashC28Bank0Sector4",false);
    session.flash.options.setBoolean("FlashC28Bank0Sector5",false);
    session.flash.options.setBoolean("FlashC28Bank0Sector6",false);
    session.flash.options.setBoolean("FlashC28Bank0Sector7",false);
    session.flash.options.setBoolean("FlashC28Bank0Sector8",false);
    session.flash.options.setBoolean("FlashC28Bank0Sector9",false);
    session.flash.options.setBoolean("FlashC28Bank0Sector10",false);
    session.flash.options.setBoolean("FlashC28Bank0Sector11",false);
    session.flash.options.setBoolean("FlashC28Bank0Sector12",false);
    session.flash.options.setBoolean("FlashC28Bank0Sector13",false);

    session.flash.erase();

    Thanks

    ki

  • Thanks for your response, Ki. However I get this error " Target is not connected or does not support current Flash operation. " for the line session.flash.erase(). Does the API not support erase for TMS320F28377S ?

    Thanks

    Rashmy

  • It should work. I tried it with my F28377S LaunchPad. Is your target indeed connected? Can I see the rest of your script?

    Thanks
    ki
  • My target is connected, I tried testing the connection from my target configuration file and it is successful. I am able to flash using CCS IDE. However my script does not work as expected. Here's the rest of my script.

    // Import the DSS packages 
    importPackage(Packages.com.ti.debug.engine.scripting)
    importPackage(Packages.com.ti.ccstudio.scripting.environment)
    importPackage(Packages.java.lang)

    // Configurable Parameters
    var deviceCCXMLFile = "../TMS320F28377S.ccxml";
    //var programToLoad = "../DSP_28377_4_jointmodule.out";
    var programToLoad = "../DSP_28377_jointmodule.bin";

    // Create scripting environment object 
    var script = ScriptingEnvironment.instance();

    // Create a debug server
    var debugServer = script.getServer( "DebugServer.1" );

    // Set the device ccxml
    debugServer.setConfig( deviceCCXMLFile );

    // Open a debug session
    debugSession = debugServer.openSession( "*","*" );
    debugSession.flash.options.setString("FlashEraseSelection", "Selected Sectors Only");
    print(debugSession.flash.options.getString("FlashEraseSelection"));
    debugSession.flash.options.setNumeric("FlashSPLLIMULT",19);
    debugSession.flash.options.setString("FlashSPLLFMULT","0 [0]");
    debugSession.flash.options.setString("FlashSYSDIVSEL","0 [/1]");
    //debugSession.flash.options.printOptions(".*");
    debugSession.flash.options.setBoolean("FlashC28Bank0Sector0",false);
    debugSession.flash.options.setBoolean("FlashC28Bank0Sector1",false);
    debugSession.flash.options.setBoolean("FlashC28Bank0Sector2",false);
    debugSession.flash.options.setBoolean("FlashC28Bank0Sector3",false);
    debugSession.flash.options.setBoolean("FlashC28Bank0Sector4",false);
    debugSession.flash.options.setBoolean("FlashC28Bank0Sector5",false);
    debugSession.flash.options.setBoolean("FlashC28Bank0Sector6",false);
    debugSession.flash.options.setBoolean("FlashC28Bank0Sector7",false);
    debugSession.flash.options.setBoolean("FlashC28Bank0Sector8",true);
    debugSession.flash.options.setBoolean("FlashC28Bank0Sector9",true);
    debugSession.flash.options.setBoolean("FlashC28Bank0Sector10",true);
    debugSession.flash.options.setBoolean("FlashC28Bank0Sector11",false);
    debugSession.flash.options.setBoolean("FlashC28Bank0Sector12",false);
    debugSession.flash.options.setBoolean("FlashC28Bank0Sector13",false);
    debugSession.flash.erase();


    // Connect to the target
    debugSession.target.connect();

    // Load the program
    debugSession.memory.loadBinaryProgram( programToLoad,0xB0000);
    //debugSession.memory.loadProgram( programToLoad);

    // Run the program
    debugSession.target.run();

    // Disconnect from the target
    debugSession.target.disconnect();

    debugSession.terminate();
    debugServer.stop();

    Please let me know if I am missing something.

    Rashmy

  • Rashmy Parimi said:

    debugSession.flash.erase();


    // Connect to the target
    debugSession.target.connect();

    your target connect call is coming AFTER your call to erase the flash. You need to be connect to the target first before you can try to erase the flash

  • I am able to erase now. Thanks for your help.