Other Parts Discussed in Thread: HALCOGEN
Tool/software: Code Composer Studio
We have a custom board based on the TMS570LS3 HDK. We are using the code based on TMS570LS31x_HDK_Connectivity_Test.zip.
The code compiled out of the box and we started making changes before we received the actual board to get ahead.
We now have the board and started debugging the code with an XDS200 from spectrum digital. It programs and runs but gets stuck in the reset vector in sys_startup.c.
When execution gets to the /* initalise the C global variables */ section it loops through twice and on the second pass at the (*handler)((const unsigned char *)loadAdr, runAdr) line it resets and enters the same vector and gets stuck in a loop.
/* initalise the C global variables */ if (&__TI_Handler_Table_Base < &__TI_Handler_Table_Limit) { unsigned char **tablePtr = (unsigned char **)&__TI_CINIT_Base; unsigned char **tableLimit = (unsigned char **)&__TI_CINIT_Limit; while (tablePtr < tableLimit) { unsigned char *loadAdr = *tablePtr++; unsigned char *runAdr = *tablePtr++; unsigned char idx = *loadAdr++; handler_fptr handler = (handler_fptr)(&__TI_Handler_Table_Base)[idx]; (*handler)((const unsigned char *)loadAdr, runAdr); } } /* initalise contructors */ if (__TI_PINIT_Base < __TI_PINIT_Limit) { void (**p0)() = (void *)__TI_PINIT_Base; while ((unsigned)p0 < __TI_PINIT_Limit) { void (*p)() = *p0++; p(); } }
We can get around the issue by not intiializing the C variables or constructors by putting #if 0 and #endif around the code above, but it is problematic where there is initialized data.
For example we are also using the lwIP port HALCoGen EMAC Driver with lwIP Demonstration and it has initialized string variables that do not come out. We changed them to const to force them into flash, but there must be other issues where we do not have initialized data.
Any ideas why this example code out of the box fails to initialize the C variables?