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)))
53 #if defined (__cplusplus)
89 void USB0_IRQHandler(
void)
ALIAS(IntDefaultHandler);
90 void USB1_IRQHandler(
void)
ALIAS(IntDefaultHandler);
91 void SCT_IRQHandler(
void)
ALIAS(IntDefaultHandler);
93 void TIMER0_IRQHandler(
void)
ALIAS(IntDefaultHandler);
95 void TIMER2_IRQHandler(
void)
ALIAS(IntDefaultHandler);
96 void TIMER3_IRQHandler(
void)
ALIAS(IntDefaultHandler);
97 void MCPWM_IRQHandler(
void)
ALIAS(IntDefaultHandler);
99 void I2C0_IRQHandler(
void)
ALIAS(IntDefaultHandler);
102 void SSP0_IRQHandler(
void)
ALIAS(IntDefaultHandler);
103 void SSP1_IRQHandler(
void)
ALIAS(IntDefaultHandler);
104 void UART0_IRQHandler(
void)
ALIAS(IntDefaultHandler);
105 void UART1_IRQHandler(
void)
ALIAS(IntDefaultHandler);
106 void UART2_IRQHandler(
void)
ALIAS(IntDefaultHandler);
107 void UART3_IRQHandler(
void)
ALIAS(IntDefaultHandler);
109 void I2S1_IRQHandler(
void)
ALIAS(IntDefaultHandler);
110 void SPIFI_IRQHandler(
void)
ALIAS(IntDefaultHandler);
111 void SGPIO_IRQHandler(
void)
ALIAS(IntDefaultHandler);
113 void GPIO1_IRQHandler(
void)
ALIAS(IntDefaultHandler);
114 void GPIO2_IRQHandler(
void)
ALIAS(IntDefaultHandler);
115 void GPIO3_IRQHandler(
void)
ALIAS(IntDefaultHandler);
116 void GPIO4_IRQHandler(
void)
ALIAS(IntDefaultHandler);
117 void GPIO5_IRQHandler(
void)
ALIAS(IntDefaultHandler);
118 void GPIO6_IRQHandler(
void)
ALIAS(IntDefaultHandler);
119 void GPIO7_IRQHandler(
void)
ALIAS(IntDefaultHandler);
120 void GINT0_IRQHandler(
void)
ALIAS(IntDefaultHandler);
121 void GINT1_IRQHandler(
void)
ALIAS(IntDefaultHandler);
123 void CAN1_IRQHandler(
void)
ALIAS(IntDefaultHandler);
124 void ATIMER_IRQHandler(
void)
ALIAS(IntDefaultHandler);
127 void CAN0_IRQHandler(
void)
ALIAS(IntDefaultHandler);
128 void QEI_IRQHandler(
void)
ALIAS(IntDefaultHandler);
137 #if defined (__REDLIB__)
138 extern void __main(
void);
140 extern int main(
void);
146 extern void _vStackTop(
void);
149 #if defined (__cplusplus)
160 extern void (*
const g_pfnVectors[])(void);
161 __attribute__ ((section(
".isr_vector")))
162 void (* const g_pfnVectors[])(
void) = {
243 __attribute__ ((section(
".after_vectors")))
244 void data_init(
unsigned int romstart,
unsigned int start,
unsigned int len) {
245 unsigned int *pulDest = (
unsigned int*) start;
246 unsigned int *pulSrc = (
unsigned int*) romstart;
248 for (loop = 0; loop < len; loop = loop + 4)
249 *pulDest++ = *pulSrc++;
252 __attribute__ ((section(
".after_vectors")))
253 void bss_init(
unsigned int start,
unsigned int len) {
254 unsigned int *pulDest = (
unsigned int*) start;
256 for (loop = 0; loop < len; loop = loop + 4)
267 extern unsigned int __data_section_table;
268 extern unsigned int __data_section_table_end;
269 extern unsigned int __bss_section_table;
270 extern unsigned int __bss_section_table_end;
286 unsigned int LoadAddr, ExeAddr, SectionLen;
287 unsigned int *SectionTableAddr;
293 SectionTableAddr = &__data_section_table;
296 while (SectionTableAddr < &__data_section_table_end) {
297 LoadAddr = *SectionTableAddr++;
298 ExeAddr = *SectionTableAddr++;
299 SectionLen = *SectionTableAddr++;
300 data_init(LoadAddr, ExeAddr, SectionLen);
304 while (SectionTableAddr < &__bss_section_table_end) {
305 ExeAddr = *SectionTableAddr++;
306 SectionLen = *SectionTableAddr++;
307 bss_init(ExeAddr, SectionLen);
310 #if defined (__cplusplus)
317 #if defined (__REDLIB__)
336 __attribute__ ((section(
".after_vectors")))
343 __attribute__ ((section(
".after_vectors")))
350 __attribute__ ((section(
".after_vectors")))
357 __attribute__ ((section(
".after_vectors")))
364 __attribute__ ((section(
".after_vectors")))
372 __attribute__ ((section(
".after_vectors")))
387 __attribute__ ((section(
".after_vectors")))