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.

CODECOMPOSER: Restart options does not seem to bring system to clean state

Part Number: CODECOMPOSER
Other Parts Discussed in Thread: MSPM0G3519

Tool/software:

Hello,

CCS 20.0.2.5__1.6.2

MSPM0G3519

I have noticed that "Restart" does not bring system to a clean state. For instance, it does not clear CONTROL register which causes system crash with consecutive Run. Second Restart brings system to clean state.

It also does not seem to execute any code until configured "run to" function. None of the BPs in the path leading to it after reset get hit.

What does "Restart" actually do?

Regards,
Eugene

  • Hi Eugene,

    What does "Restart" actually do?

    It simply sets the program counter to the entry point of the application. 

    Thanks

    ki

  • Hi Ki,

    This does not seem to make sense. Why CCS has a GUI item that brings system to an unstable state bypassing any and all application initialization code?

    "Debugger options" in Properties state "Run to symbol". IMHO, that does not mean set PC to symbol address.

    I question the usefulness of "Restart" as it is implemented and its place on the CCS GUI. It should be either fixed or repurposed for some other really useful debugging function.

    Don't you think?

    Regards,
    Eugene

  • This behavior has been the same since the advent of CCS. Why it has been implemented that way I don't have the details of that but I do know that this intended and expected behavior. LIkely back then the applications (and device) were simpler and a simple "restart" was adequate enough. In cases that simply setting the PC to the entry point was not enough, people used the GEL OnRestart callback to add some additional actions to get the device in the proper state. Agreed that in more complex environments, a simple restart is inadequate.

    "Debugger options" in Properties state "Run to symbol"

    This is the autorun to label on load or restart. For a restart, this option will run the target to the specified label after setting the PC to the entry point label (usually c_int00 for TI compliers unless a different location is explicitly specified). If the specified label does not exist (or cannot be reached), then the target will run indefinitely. If this option is disabled, then the target will simply set the PC to the entry point but not execute the target.

  • Hi Ki,

    The fact that it was like that since the 'dawn of times' does not make it right. 

    Look at it from the user point of view. CCS GUI has a button that breaks application when it is being debugged. User probably has other issues to look into and expecting CCS tooling to be of some help.

    If we know that this doesn't work and users have to implement GEL callbacks then why logical question is not being asked, is the existence of that button helping users? I would prefer to have system reset button in this case. At least it is more useful and user friendly then going through layers of sub-menu items.

    Could you at least look into this and evaluate if this button needs to be reproposed as it completely useless for any non-trivial application?

    Regards,

    Eugene

  • The restart option, as it is currently supported, is still commonly used. The expectation is to have the restart option have the current behavior. We don't plan on changing this behavior but we can always look to adding additional buttons with other behavior as needed.

  • Hi Ki,

    I do not quite understand how it is possible to use OnRestart() callback if it is already defined in CCS provided mspm0g3519.gel?

    /*
     * GEL callback function called when the program is restarted.
     */
    OnRestart()
    {
        if (GEL_MatchesConnection("xds")) {
            GEL_Halt();
            GEL_EvalOnTarget("CS_DAP_0", "PWRAP_DPREC0 = PWRAP_DPREC0 | 0x00020000", 0);
            GEL_AdvancedReset("System Reset", 1);
        }
    }

    Is the expectation that user goes inside CCS installation and modifies bunch of files there?

    Regards,

    Eugene

  • I do not quite understand how it is possible to use OnRestart() callback if it is already defined in CCS provided mspm0g3519.gel?

    It varies with each individual use case. I will bring this thread to the attention of the device experts for further comment.

  • Hi Eugene,

    You want the System Reset, not the restart function. System reset will execute a SYSRST on the device which sets all peripherals to default settings (including CPI), CPU Subsystem Reset will execute a CPU Reset which will reset the CPU settings (SP, PC, R1-R15 etc.), and Restart will change the stack pointer to the beginning of main.

    Regards,
    Luke

  • Hi Luke,

    The point here is usefulness of the Restart button not availability of system reset option. Why to have this button if it crashes application that is being debugged.

    Regards,

    Eugene

  • Hi Eugene,

    I've been using the restart functionality quite frequently and haven't run into any crashes. Are you able to get CCS 20 to crash with one of our example codes? If you can, can you tell me which example so I can investigate, currently I haven't been able to replicate what you're talking about with crashing.

  • Hi Luke,

    For me it is sufficient to identify the issue with my application as this is what I need to work. This is non-trivial set up as required by the system - multiple run-times passed through reset to entry point.

    This is my observation. With mspm0g3519 I have CONTROL=3. Pause, Restart and I do not see CONTROL=0. That eventually causes hard fault. Second pause, restart somehow  clears CONTROL. None of that is happening with system or CPU reset and code is reliably working without CCS.

    Eugene

  • Hi Luke,

    Are you able to get CCS 20 to crash with one of our example codes?

    Just to clarify, I believe Eugene is saying that his target application execution "crashes", and not the CCS IDE itself.

    Eugene - please let me know if I am incorrect with my assumption.

    Thanks

    ki

  • Yes, this is correct. First Restart does not seem to properly reset MCU regardless of OnRestart() callback, see above.

  • Hi Eugene,

    Can you use the Reset function instead of Restart here? Reading the descriptions it should be the correct process. If you want to keep all the peripherals maintained except reset only CPU, I don't think we have a function for that specifically.

  • Hi Luke,

    Sure, I can.

    However, that is not the point of this discussion. Restart is the direct GUI element and with OnRestart() callback it should work but it does not. IMHO, using CCS GUI is cumbersome undertaking by itself and any GUI help is welcome! So, what's the point of Restart if it is not capable of bringing target to a desired state?

    Regards,

    Eugene

  • The function of restart is actually behaving as it should. Restart shouldn't be setting any values of the device except putting the program back to the start, whereas reset should set values to their defaults. 

    Restart

    Reset

  • Hi Luke,

    We are going in circles. How is it behaving as it should if it does not properly initialize target? I have provided example where Restart cause target to experience Hard Fault exception. Why are you keep telling me that this is correct and expected behavior?

    Eugene

  • Yes Eugene, it is correct and expected behavior that Restart only sets the program back to the start of main, but does not set registers to default states. The Reset API and behavior should be used if you want to set the device to a default state. You've hit this scenario due to changing the stack pointer behavior itself (Arm Core using PSP instead of MSP), but that is still as intended and designed based on definitions of restart and reset that have been established by industry.

    Regards,
    Luke

  • Hi Luke,

    What seems to fix it is this one particular setting

    Why OnRestart() callback doesn't work without this?

    Eugene

  • Hi Eugene,

    That setting will call Reset when Restart (or program load) is called.

    Regards,
    Luke