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.

Problem getting to main on debug startup

This problem appears to be similar to the thread "Problem getting to start of main on debug startup" from a couple of years ago. The issue is that I will be plugging away doing routine debugging when for absolutely no reason at all the program will fail to start -- instead of running to main it will end up on an ESTOP that appears to be in the library (i.e. the code beyond _c_int00 entry point). The actual place it gets stuck is in a loop that appears to be calling constructors from a list of constructor addresses prior to pulling the command line arguments (!) and calling to main.

The processor is an 069 running on a Control Card. I'm using CCS5.3 with the USB emulator. The hardware appears to be OK; I have a small RAM based project I can use to check it. The code base itself is too large to run out of RAM, its a port of an existing 2812 based product that is written in C++. I've checked that the watchdog is disabled before the startup code runs and there's no problem with stack headroom.

Concident with the emergence of this problem is the observation that the system clock is running at a different speed. The Control Card usually has the processor clock set to 90MHz but after this problem appeared I noticed that it was running at the default 10MHz. This is easy enough to deal with -- we'd have to put clock initialization and the like for a real product -- and it really shouldn't affect the operation of the code (because we've got to get to main to run code to reset the clock) but because it appeared at the same time as the run-to-main issue there may be a connection.

This code is running on an evaluation board which starts up with the processor running at 90MHz. The processor's clock configuration changed overnight so its running at a default 10MHz. It is easy enough to reinitialize the clock to the correct speed (we're going to have to do this for the real product) but because it was coincident with the emergence of the run-to-main issue its possible that the two are connected.

Needless to say the emergence of this problem did not coincide with any changes to the code. It was literally a case of switch off for the evening with everything working, switch on the next morning with everything malfunctioning.

Suggestions welcome....

  • Hi Martin,

    Very hard to believe. The changes in the processor cock overnight? Did you try changing the clock source?

    Regards,

    Gautam

  • > did you try changing the clock source?

    Yes, but as expected this was just a symptom. What appears to have happened is that the standard entry point -- code_start in the F2806x_CodeStartBranch.asm file -- appears to exist somewhere else in the code base, possibly in a library. Something rearranged the link order which meant that instead of executing 'my' start code it jumped to this code. This caused my problem because this code didn't disable the watchdog -- the code base I'm running executes a whole bunch of constructors before emerging to main which took enough time for the watchdog to trip. My fix is to copy the code start fragment into a new file and rename the entry point to something other than 'code_start'.

    These observations are consistent with those in the thread I cited. The problem was similar -- suddenly a working program wouldn't run to main. The fix in this case was to note that the link order had been changed and reset the link order by either rebuilding a new project or editing some configuration file.

    I think I've experienced this problem before on another, simpler, project. In this case the project was small enough to just make a copy (which I did) -- I just thought of this as an IDE 'trick of the light'. IDEs trying to be clever (and failing miserably at it) seems to be more common than you'd expect; I've seen this sort of thing happen with Microsoft's IDE, with Eclipse in a different environment -- so much so that I really prefer to work old school with makefiles and just use the IDE as a front end to the debugger.

  • Martin, that's very unusual behavior by the IDE. I hope a TI mate resolves your issue soon!

    Regards,

    Gautam