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.

Setting STF register



We are trying to set the STF register using Automation routines in a js file. We are able to read the value of the STF but whenever we try to set it it gets set to 0.

We are using CCS 5.1.1, and using server tms320f283xx_sim.

Is it possible to modify this register in a script?

 

Thanks,

Bill

  • Bill,

    Could you provide more details on exactly how you are trying to read/write to the register? What commands are you currently using?

  • AartiG,

    First, we initialize things by calling the following function:

    function InitSim(testName, debug)
    {
      if(debug == null)
        Visible = False
      else
        Visible = debug
     
      /* Create debug environment */
      Env = ScriptingEnvironment.instance();
      /* Create script server object and set the configuration */
      Server = Env.getServer("DebugServer.1");
      Server.setConfig(Path + "tms320f283xx_sim.ccxml");
      /* Open the debug session */
      Session = Server.openSession(".*");
      /* Connect to target */
      Session.target.connect();
      /* Open the session so we can start the tests */
      Session = Server.openSession();
      /* Load the test */
      Session.memory.loadProgram(Path + testName + ".out");
      /* Clear all breakpoints */
      Session.breakpoint.removeAll();
    }

    Path is a variable containing the path to our test area.

    We have 2 wrappers used for the registers:

    function GetReg(regName)
    {
      var value = Session.memory.readRegister(regName)
     
      return(value)
    }
    function SetReg(value, regName)
    {
      Session.memory.writeRegister(regName, value)
    }

    Calling GetReg and SetReg as follows,

    var tempreg new number
    tempreg = GetReg("STF")
    Print(tempreg)
    SetReg(tempreg, "STF")
    Print(GetReg("STF"))

    gives something like:

    tempreg -> 0x225 after first call to GetReg

    tempreg -> 0 after call to SetReg and 2nd call to GetReg

    Hope this is enough info (by the way, Print is a wrapper function).

    Additionally, trying to set STF as follows: Session.memory.writeRegister("STF", 0x225) still results in the STF having a 0 value.

    Thanks,

    Bill

     

  • Bill,

    Thank you for providing the details. I was able to reproduce this behavior as well and it appears to be a limitation or bug in the F2833x simulator. Even in the CCS GUI, when using the F2833x simulator configuration, you can see that the STF register is not visible in the Registers view. It can be added to the Expressions view, however modifying the STF register from the expressions view does not work. It always gets set to 0. Modifying other CPU registers works fine so the issue appears to be limited to the registers not visible in the simulator's Registers view. 

    Instead of writeRegister, you could try directly reading/writing to the address where STF is mapped, 0xF02 using readWord and writeWord if that might be an acceptable workaround.

    For eg,

     var value1 = session.memory.readWord(1, 0xF02)  
     env.traceWrite(value1)  
     
     session.memory.writeWord(1, 0xF02, 549)
     var value2 = session.memory.readWord(1, 0xF02)   
     env.traceWrite(value2)

    It also looks like readRegister/writeRegister works fine with a F28335 xds510usb emulator configuration so the issue seems limited to the simulator. So if you plan to move soon to a hardware environment, it may no longer be an issue.

    I can file a defect report against the simulator but to be honest the simulator is in maintainance mode so I'm not sure how quickly action will be taken to resolve this.