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/MSP430G2553: Issue working with DSS Script

Part Number: MSP430G2553

Tool/software: Code Composer Studio

Hello,

I am trying to prepare a DSS script to verify various functions of firmware. Till now everything was working good, but suddenly I am facing a problem to set the variable value. The expression

var temp = 31;

debugSession.expression.evaluate("i="+temp)

does not set the value i to 31. Even if it sets, but when I give "debugSession.target.run();" instruction, the script behavior is not as expected and does not show the result as per variable set in previous instructions.

Please help me to resolve this issue.

Thanks,

Rakesh Modi

  • Hi Rakesh,

    Based on your small code snippet, I don't see anything wrong. Everything works in my environment. Make sure that the target is halted and the variable is in scope when you try to evaluate the expression. If you are still having issues, please provide a small test case. This would include the dss script and the project it is for.

    Thanks

    ki

  • Hello Ki,

    Thanks for your reply. I am not able to send the entire firmware, but here I have attached c file, which contains functions on which I want to run attached DSS script.

    The issue is "debugSession.target.run();"  statement does not give expected output, but "debugSession.target.sourceStep.over();" statement gives proper result. In both the case breakpoint is at the same location. So I don' understand the reason behind this behavior. Please see attached C code and DSS script.

    test.c
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    static void SendGatewayMessage(uint8_t * message, bool thirdChannelDelay)
    {
    uint8_t ret;
    if ( RFSendGatewayPacket(message, TagConfigFlash.ChannelB, TagConfigFlash.Config.TxPowerGateway, thirdChannelDelay) != SUCCESS)
    {
    __asm__("lable_incTXLong:");
    TAGUpdateBatteryCounters(COUNTER_TXLONG);
    SW_RESET();
    }
    CC110xIdle();
    ret = CC110xWaitForState(CC110X_STATE_IDLE);
    __asm__("lable_retCC110xWaitForState:");
    if (ret == SUCCESS)
    {
    RFSendConfigChange(RFChannelChange, (Tag.TagType == AssetTag) ? TagConfigFlash.ChannelC : TagConfigFlash.ChannelA, NULL);
    }
    else
    {
    TAGUpdateBatteryCounters(COUNTER_TXLONG);
    SW_RESET();
    }
    TAGUpdateBatteryCounters(COUNTER_TXSHORT);
    }
    ERR_STATUS RFSendGatewayPacket(uint8_t * packet, uint8_t txChannel, int8_t txPower, bool delayThirdChannel)
    {
    uint8_t ret = ERR_FAIL, loop = 3;
    while(ret && loop)
    {
    ret = SUCCESS;
    CC110xIdle();
    if (CC110xWaitForState(CC110X_STATE_IDLE) == SUCCESS)
    {
    RFSendConfigChange(RFChannelChange, txChannel, NULL);
    CC110xSetTxPower(txPower);
    if (delayThirdChannel == TRUE)
    {
    // This is to wait for the gateway to send the command on the 3rd channel
    // TODO: This should be driven by an interrupt. Only utilized by RT/GP on gateway receive
    // so not a big deal.
    DelayForMS(540);
    #ifdef USE_WDT
    WDTCTL = WDT_ARST_1000; //Set to using ACLK (VLO) and ~1000ms
    #endif
    }
    if( StartChirp() == OK )
    {
    if (RFTxPacket(packet, ((SEND_MESSAGE_HEADER*)packet)->Length + 1) != OK)
    {
    LEDFlashChirpFail();
    ret = ERR_FAIL;
    }
    if (modeAfterTX == 0x00)
    CC110xWaitForState(CC110X_STATE_IDLE);
    else
    CC110xWaitForState(CC110X_STATE_RX);
    }
    else
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    1325.test.txt
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    // Import the DSS packages into our namespace to save on typing
    importPackage(Packages.com.ti.debug.engine.scripting);
    importPackage(Packages.com.ti.ccstudio.scripting.environment);
    importPackage(Packages.java.lang);
    /******************Variable Declaration*******************************/
    var saveMem = 0;
    var data;
    var PCLocation;
    var returnval;
    var SUCCESS = 0;
    var ERR_FAIL = 1;
    var fileName = "SendGatewayMessage"
    var current_dir = java.lang.System.getProperty("user.dir");
    var log_file = current_dir+"/logs/" + fileName + ".xml";
    /**********************************************************************/
    // Create our scripting environment object - which is the main entry point into any script and
    // the factory for creating other Scriptable ervers and Sessions
    var script = ScriptingEnvironment.instance();
    // Create a log file in the current directory to log script execution
    script.traceBegin(log_file, "DefaultStylesheet.xsl");
    // Log everything
    script.traceSetConsoleLevel(TraceLevel.INFO);
    script.traceSetFileLevel(TraceLevel.INFO);
    /****************************Function Define**********************/
    //End Debug Session and exit
    function endDebugSession()
    {
    i=0;
    //Restore configuration settings
    var x
    for (x in data)
    {
    debugSession.memory.writeData(Memory.Page.PROGRAM, 0x100A+i, data[x], 16);
    i = i+2;
    }
    debugSession.target.disconnect();
    debugServer.stop();
    script.traceEnd();
    System.exit(1);
    }
    function restartTarget()
    {
    // Restart, and go to main. If the target is configured to go to main on restart, then restarting
    // should be sufficient. Otherwise we will need to also set a breakpoint at main and run to it.
    debugSession.target.restart();
    addressMain = debugSession.symbol.getAddress("main");
    if (debugSession.memory.readRegister("PC") != addressMain)
    {
    var bp = debugSession.breakpoint.add(addressMain);
    debugSession.target.run();
    }
    if(saveMem == 0)
    {
    //Save the tag configuration settings
    data = debugSession.memory.readData(Memory.Page.PROGRAM, 0x100A, 16, 16);
    saveMem = 1;
    }
    }
    function verifyBPLocation(Address, testNum)
    {
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    Thanks,

    Rakesh Modi

  • Rakesh Modi said:
    The issue is "debugSession.target.run();"  statement

    Are you talking about the call in line 69 of the script? If your replace it with a step, it works?

    Also please enable full verbose logging and provide the generated log after your try to evaluate the expression.

    Thanks

    ki

  • Hello Ki,

    Yes, I am talking about the line #69 in the script. Yes, if I replace it with step it works. I have attached a log here for failure case. Let me know if you require more information.

    5270.Log.txt
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    c:\ti\processor_sdk_rtos_c665x_5_01_00_11\bin>%DSS_SCRIPT_DIR%\dss.bat SendGatewayMessage.js
    traceSetFileLevel: ENTRY sLevel: ALL
    traceSetFileLevel: RETURN
    ccxml_file=E:\Rfind\hardware\RFindTag\trunk\Project\targetConfigs\MSP430G2553.ccxml
    file_to_flash=E:\Rfind\hardware\RFindTagRailLocator\trunk\Project\Debug\RFindTagRailLocator.out
    getServer: ENTRY sServerName: DebugServer.1
    getServer: Getting definition for: DebugServer.1
    getServer: Constructing server
    getServer: RETURN com.ti.debug.engine.scripting.DebugServer@10444d3
    setConfig: ENTRY sConfigurationFile: E:\Rfind\hardware\RFindTag\trunk\Project\targetConfigs\MSP430G2553.ccxml
    setConfig: RETURN
    openSession: ENTRY sPattern: .*
    start: ENTRY
    start: Firing: onServerStarting()
    start: Connecting to XPCOM DebugServer
    start: Initializing DebugServer using specified configuration: "E:\Rfind\hardware\RFindTag\trunk\Project\targetConfigs\MSP430G2553.ccxml"
    waitUntil: ENTRY com.ti.ccstudio.scripting.environment.ScriptingEnvironment@1d81730 timeout: infinite
    <init>: CPU Name: MSP430
    <init>: PartNum: MSP430G2xx3
    <init>: Family: 430
    <init>: SubFamily/MajorISA: 0
    <init>: Revision/MinorISA: 0
    <init>: Platform: EMULATOR
    <init>: Processor ID: 1803550720
    waitUntil: RETURN com.ti.ccstudio.scripting.environment.ScriptingEnvironment@1d81730
    start: Firing: onServerStarted()
    start: Searching for devices
    listDevices: ENTRY
    listDevices: Found debuggable device: TI MSP430 USB1/MSP430
    listDevices: RETURN
    start: RETURN
    openSession: Searching for device exactly matching name: .*
    openSession: No exact name matches found. Searching for device matching regular expression: .*
    openSession: RETURN TI MSP430 USB1/MSP430
    **********************************************************
    Script File: SendGatewayMessage.js
    connect: ENTRY
    isConnected: ENTRY
    isConnected: Target is not connected
    isConnected: RETURN false
    connect: Requesting target connect
    waitUntil: ENTRY timeout: infinite
    log: Target is now connected
    waitUntil: RETURN
    isConnected: ENTRY
    isConnected: Target is connected
    isConnected: RETURN true
    connect: RETURN
    setScriptTimeout: ENTRY nTimeout: 150000
    setScriptTimeout: Timeout is 150000ms
    setScriptTimeout: RETURN
    This test verifies the SendGatewayMessage function
    loadProgram: ENTRY sFileName: E:\Rfind\hardware\RFindTagRailLocator\trunk\Project\Debug\RFindTagRailLocator.out
    load: Requesting program load
    waitUntil: ENTRY timeout: 150000 (ms)
    MSP430: Flash/FRAM usage is 10249 bytes. RAM usage is 277 bytes.
    waitUntil: RETURN
    load: Program load successful
    getBoolean: ENTRY ID: AutoRunToLabelOnRestart
    getBoolean: RETURN true
    waitForHaltIfPropertySet: Waiting for halt
    waitUntil: ENTRY timeout: 150000 (ms)
    log: Target has halted at 0xD43A
    waitUntil: RETURN
    loadProgram: RETURN
    removeAll: ENTRY
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Thanks,

    Rakesh Modi

  • Hello,

    Any update on this issue?

    Thanks,

    Rakesh Modi

  • Hi Rakesh,

    I took a look at the logs. I do see that the test failed. But it looks like the expression was evaluated correctly. The root cause of the failure is likely not because of the expression evaluation.

    To debug further, I would need a test case. It doesn't have to be your actual application, source files, and script. Something stripped down and simplified is fine.

    Thanks

    ki 

  • Hello,
    I haven’t heard back from you, hence this issue is being closed. If you wish to continue the discussion, please post a reply with an update below (or create a new thread).

    Thanks,
    ki