TI E2E Community
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.
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?
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 beforethe main() function runs. These functions should not access datastructures that are not initialized before the main() function runs. Inparticular, functions that perform any of the following actions shouldnot 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 objectsDid that old function violate one of these?Scott
Yes it was. It was using a pointer that had to be initialized in main.
All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.
TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs andembedded processors, along with software, tools and the industry’s largest sales/support staff.