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.

Debug won't reach main

I've got a custom (dual) 5509A board and I'm using CCSv4. I've got my code all compiled without errors and tcf file is all set up. When I launch the debugger, the code seems to get caught in _auto_init and never reaches main.

I created a simple test program making all the tconf settings similar and it reaches main ok.

Any ideas what could be stalling it in _auto_init?

Thanks for any suggestions.

Cam

  • Cam,

    What are the differences between your simple test program and the one getting stuck in auto_init()?  Are you explicitly adding some .cinit records?

    I’ve hit this before when doing early porting of DSP/BIOS to a new device family.  It was tedious to track down the .cinit record that was bad.  It required stepping thru the loop in auto_init and verifying proper addresses and sizes for each .cinit record.  Once that initial debug was done though, there were no issues with the .cinits generated from DSP/BIOS.

    Can you identify any changes to global variable allocations between your two programs?  And maybe incrementally add the changes to the successfully-getting-to-main() program, until you see the failure?

    Scott

  • Thanks Scott.

    I found the problem. By adjusting the debug properties to disable the autorun to main, I stepped through the bios setup code and found it was crashing during the IDL_calibrate routine when it stepped into some code that was placed in the IDL loop by the original author (I'm porting old code from CCS2.20). I discovered that if you select "Include in CPU load calibration" under the particular IDL process in the configuration tool, your IDL code will be run before main. This was happening and an initialized variable was being referenced. I made "include in CPU load calibration" false and, bingo, I made it to main.

  • Cam,

    OK, glad it is resolved, thanks for reporting back.

    I was assuming it was failing at the top part of auto_init() while processing .cinit records, but it was actually later in the function during a BIOS initialization call (that is added at the end of the compiler’s standard auto_init() function).  

    BTW, there is a list of the restrictions for functions to be included in the idle loop autocalculation in the API guide:

    Remember that functions included in the calibration are run before
    the main() function runs. These functions should not access data
    structures that are not initialized before the main() function runs. In
    particular, functions that perform any of the following actions should
    not be included in the idle loop calibration:
    - enabling hardware interrupts or the SWI or TSK schedulers
    - using CLK APIs to get the time
    - accessing PIP objects
    - blocking tasks
    - creating dynamic objects

    Did that old function violate one of these?

    Scott

  • Hey Scott,

    Yes it was. It was using a pointer that had to be initialized in main.

    Cam