30 #if defined (__cplusplus)
32 #error Redlib does not support C++
40 extern void __libc_init_array(
void);
45 #define WEAK __attribute__ ((weak))
46 #define ALIAS(f) __attribute__ ((weak, alias (#f)))
55 #if defined (__cplusplus)
90 void TIMER3_IRQHandler(
void)
ALIAS(IntDefaultHandler);
93 void UART2_IRQHandler(
void)
ALIAS(IntDefaultHandler);
94 void UART3_IRQHandler(
void)
ALIAS(IntDefaultHandler);
95 void PWM1_IRQHandler(
void)
ALIAS(IntDefaultHandler);
98 void I2C2_IRQHandler(
void)
ALIAS(IntDefaultHandler);
99 void SPI_IRQHandler(
void)
ALIAS(IntDefaultHandler);
100 void SSP0_IRQHandler(
void)
ALIAS(IntDefaultHandler);
101 void SSP1_IRQHandler(
void)
ALIAS(IntDefaultHandler);
102 void PLL0_IRQHandler(
void)
ALIAS(IntDefaultHandler);
104 void EINT0_IRQHandler(
void)
ALIAS(IntDefaultHandler);
105 void EINT1_IRQHandler(
void)
ALIAS(IntDefaultHandler);
106 void EINT2_IRQHandler(
void)
ALIAS(IntDefaultHandler);
107 void EINT3_IRQHandler(
void)
ALIAS(IntDefaultHandler);
110 void USB_IRQHandler(
void)
ALIAS(IntDefaultHandler);
116 void MCPWM_IRQHandler(
void)
ALIAS(IntDefaultHandler);
117 void QEI_IRQHandler(
void)
ALIAS(IntDefaultHandler);
118 void PLL1_IRQHandler(
void)
ALIAS(IntDefaultHandler);
119 void USBActivity_IRQHandler(
void)
ALIAS(IntDefaultHandler);
120 void CANActivity_IRQHandler(
void)
ALIAS(IntDefaultHandler);
122 void UART4_IRQHandler(
void)
ALIAS(IntDefaultHandler);
123 void SSP2_IRQHandler(
void)
ALIAS(IntDefaultHandler);
125 void GPIO_IRQHandler(
void)
ALIAS(IntDefaultHandler);
126 void PWM0_IRQHandler(
void)
ALIAS(IntDefaultHandler);
127 void EEPROM_IRQHandler(
void)
ALIAS(IntDefaultHandler);
136 #if defined (__REDLIB__)
137 extern void __main(
void);
139 extern int main(
void);
145 extern void _vStackTop(
void);
148 #if defined (__cplusplus)
157 extern void (*
const g_pfnVectors[])(void);
158 __attribute__ ((section(
".isr_vector")))
159 void(*const g_pfnVectors[]) (
void) = {
213 USBActivity_IRQHandler,
214 CANActivity_IRQHandler,
231 __attribute__ ((section(
".after_vectors")))
232 void data_init(
unsigned int romstart,
unsigned int start,
unsigned int len) {
233 unsigned int *pulDest = (
unsigned int*) start;
234 unsigned int *pulSrc = (
unsigned int*) romstart;
236 for (loop = 0; loop < len; loop = loop + 4)
237 *pulDest++ = *pulSrc++;
240 __attribute__ ((section(
".after_vectors")))
241 void bss_init(
unsigned int start,
unsigned int len) {
242 unsigned int *pulDest = (
unsigned int*) start;
244 for (loop = 0; loop < len; loop = loop + 4)
255 extern unsigned int __data_section_table;
256 extern unsigned int __data_section_table_end;
257 extern unsigned int __bss_section_table;
258 extern unsigned int __bss_section_table_end;
268 __attribute__ ((section(
".after_vectors")))
275 unsigned int LoadAddr, ExeAddr, SectionLen;
276 unsigned int *SectionTableAddr;
282 SectionTableAddr = &__data_section_table;
285 while (SectionTableAddr < &__data_section_table_end) {
286 LoadAddr = *SectionTableAddr++;
287 ExeAddr = *SectionTableAddr++;
288 SectionLen = *SectionTableAddr++;
289 data_init(LoadAddr, ExeAddr, SectionLen);
293 while (SectionTableAddr < &__bss_section_table_end) {
294 ExeAddr = *SectionTableAddr++;
295 SectionLen = *SectionTableAddr++;
296 bss_init(ExeAddr, SectionLen);
299 #if defined (__cplusplus)
306 #if defined (__REDLIB__)
325 __attribute__ ((section(
".after_vectors")))
332 __attribute__ ((section(
".after_vectors")))
339 __attribute__ ((section(
".after_vectors")))
346 __attribute__ ((section(
".after_vectors")))
353 __attribute__ ((section(
".after_vectors")))
360 __attribute__ ((section(
".after_vectors")))
367 __attribute__ ((section(
".after_vectors")))
374 __attribute__ ((section(
".after_vectors")))
381 __attribute__ ((section(
".after_vectors")))
395 __attribute__ ((section(
".after_vectors")))