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.
Hello,
I am writing a bootloader and I have a problem. When it comes to programming the following step: "Initialize copy table, global variables, and constructors". I copied and pasted the following code, which is in the start up code I found in a development kit, but it isn't working. Do I have to use these variables somewhere else or is the compiler responsible for using them? PS: I'm using CCS 5.3
#pragma WEAK(__TI_Handler_Table_Base) #pragma WEAK(__TI_Handler_Table_Limit) #pragma WEAK(__TI_CINIT_Base) #pragma WEAK(__TI_CINIT_Limit) extern unsigned int __TI_Handler_Table_Base; extern unsigned int __TI_Handler_Table_Limit; extern unsigned int __TI_CINIT_Base; extern unsigned int __TI_CINIT_Limit; extern unsigned int __TI_PINIT_Base; extern unsigned int __TI_PINIT_Limit; extern unsigned int * __binit__; /* initalise copy table */ if ((unsigned int *)&__binit__ != (unsigned int *)0xFFFFFFFFU) { extern void copy_in(void *binit); copy_in((void *)&__binit__); } /* 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 int)p0 < __TI_PINIT_Limit) { void (*p)() = *p0++; p(); } }
Thank you for posting on the Hercules forum. One of our engineers will be on the problem shortly.