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)
85 void MX_CORE_IRQHandler(
void)
ALIAS(IntDefaultHandler);
87 void FLASHEEPROM_IRQHandler(
void)
ALIAS(IntDefaultHandler);
98 void TIMER3_IRQHandler(
void)
ALIAS(IntDefaultHandler);
99 void MCPWM_IRQHandler(
void)
ALIAS(IntDefaultHandler);
103 void SPI_IRQHandler (
void)
ALIAS(IntDefaultHandler);
105 void SSP0_IRQHandler(
void)
ALIAS(IntDefaultHandler);
106 void SSP1_IRQHandler(
void)
ALIAS(IntDefaultHandler);
109 void UART2_IRQHandler(
void)
ALIAS(IntDefaultHandler);
110 void UART3_IRQHandler(
void)
ALIAS(IntDefaultHandler);
112 void I2S1_IRQHandler(
void)
ALIAS(IntDefaultHandler);
113 void SPIFI_IRQHandler(
void)
ALIAS(IntDefaultHandler);
114 void SGPIO_IRQHandler(
void)
ALIAS(IntDefaultHandler);
116 void GPIO1_IRQHandler(
void)
ALIAS(IntDefaultHandler);
117 void GPIO2_IRQHandler(
void)
ALIAS(IntDefaultHandler);
118 void GPIO3_IRQHandler(
void)
ALIAS(IntDefaultHandler);
119 void GPIO4_IRQHandler(
void)
ALIAS(IntDefaultHandler);
120 void GPIO5_IRQHandler(
void)
ALIAS(IntDefaultHandler);
121 void GPIO6_IRQHandler(
void)
ALIAS(IntDefaultHandler);
122 void GPIO7_IRQHandler(
void)
ALIAS(IntDefaultHandler);
123 void GINT0_IRQHandler(
void)
ALIAS(IntDefaultHandler);
124 void GINT1_IRQHandler(
void)
ALIAS(IntDefaultHandler);
126 void CAN1_IRQHandler(
void)
ALIAS(IntDefaultHandler);
127 void ATIMER_IRQHandler(
void)
ALIAS(IntDefaultHandler);
131 void QEI_IRQHandler(
void)
ALIAS(IntDefaultHandler);
140 #if defined (__REDLIB__)
141 extern void __main(
void);
143 extern int main(
void);
149 extern void _vStackTop(
void);
152 #if defined (__cplusplus)
163 extern void (*
const g_pfnVectors[])(void);
164 __attribute__ ((section(
".isr_vector")))
165 void (* const g_pfnVectors[])(
void) = {
189 FLASHEEPROM_IRQHandler,
246 __attribute__ ((section(
".after_vectors")))
247 void data_init(
unsigned int romstart,
unsigned int start,
unsigned int len) {
248 unsigned int *pulDest = (
unsigned int*) start;
249 unsigned int *pulSrc = (
unsigned int*) romstart;
251 for (loop = 0; loop < len; loop = loop + 4)
252 *pulDest++ = *pulSrc++;
255 __attribute__ ((section(
".after_vectors")))
256 void bss_init(
unsigned int start,
unsigned int len) {
257 unsigned int *pulDest = (
unsigned int*) start;
259 for (loop = 0; loop < len; loop = loop + 4)
270 extern unsigned int __data_section_table;
271 extern unsigned int __data_section_table_end;
272 extern unsigned int __bss_section_table;
273 extern unsigned int __bss_section_table_end;
289 unsigned int LoadAddr, ExeAddr, SectionLen;
290 unsigned int *SectionTableAddr;
296 SectionTableAddr = &__data_section_table;
299 while (SectionTableAddr < &__data_section_table_end) {
300 LoadAddr = *SectionTableAddr++;
301 ExeAddr = *SectionTableAddr++;
302 SectionLen = *SectionTableAddr++;
303 data_init(LoadAddr, ExeAddr, SectionLen);
307 while (SectionTableAddr < &__bss_section_table_end) {
308 ExeAddr = *SectionTableAddr++;
309 SectionLen = *SectionTableAddr++;
310 bss_init(ExeAddr, SectionLen);
313 #if defined (__cplusplus)
320 #if defined (__REDLIB__)
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")))
375 __attribute__ ((section(
".after_vectors")))
390 __attribute__ ((section(
".after_vectors")))