TI E2E Community
C2000 32-bit Microcontrollers Forum
program failing to return to calling function after running subroutine,_c_init0 issue?
I'm using the 2401a on the ezdsp board from spectrum. I'm programming in c.
When the main function calls a subroutine the subroutine runs and then returns to the reset vector at 00h.
The following indicates that this is a problem with the _c_init0 subroutine: http://www-k.ext.ti.com/SRVS/CGI-BIN/WEBCGI.EXE/,/?St=65,E=0000000000012830560,K=9057,Sxi=19,Case=obj(8480)
I have the reset vector as _c_init, and it runs a few lines in dissasembly before calling the main which appears to be what the rts.src says its supposed to do when built with rts2xx.lib. My questions are is there any other problem that could cause this and also how does this routine allow for initializing other variables, constants and functions.
Thanks for any help anyone can provide.
It sounds like the watchdog is timing-out and causing a reset. Have you disabled the watchdog immediately after entering main()? Here's an example of how to do it:
/* Watchdog timer (WD) registers */#define WDCNTR (volatile unsigned int *)0x7023 /* WD counter reg */#define WDKEY (volatile unsigned int *)0x7025 /* WD reset key reg */#define WDCR (volatile unsigned int *)0x7029 /* WD timer control reg */
/* Disable the watchdog */ *WDCR = 0x00E8; /* disable the dog */
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.