30 #if defined(__cplusplus)
32 #error Redlib does not support C++
40 extern void __libc_init_array(
void);
46 #define WEAK __attribute__ ((weak))
47 #define ALIAS(f) __attribute__ ((weak, alias(# f)))
54 #if defined(__cplusplus)
86 void MX_CORE_IRQHandler(
void)
ALIAS(IntDefaultHandler);
88 void FLASHEEPROM_IRQHandler(
void)
ALIAS(IntDefaultHandler);
99 void TIMER3_IRQHandler(
void)
ALIAS(IntDefaultHandler);
100 void MCPWM_IRQHandler(
void)
ALIAS(IntDefaultHandler);
104 void SPI_IRQHandler (
void)
ALIAS(IntDefaultHandler);
106 void SSP0_IRQHandler(
void)
ALIAS(IntDefaultHandler);
107 void SSP1_IRQHandler(
void)
ALIAS(IntDefaultHandler);
110 void UART2_IRQHandler(
void)
ALIAS(IntDefaultHandler);
111 void UART3_IRQHandler(
void)
ALIAS(IntDefaultHandler);
113 void I2S1_IRQHandler(
void)
ALIAS(IntDefaultHandler);
114 void SPIFI_IRQHandler(
void)
ALIAS(IntDefaultHandler);
115 void SGPIO_IRQHandler(
void)
ALIAS(IntDefaultHandler);
117 void GPIO1_IRQHandler(
void)
ALIAS(IntDefaultHandler);
118 void GPIO2_IRQHandler(
void)
ALIAS(IntDefaultHandler);
119 void GPIO3_IRQHandler(
void)
ALIAS(IntDefaultHandler);
120 void GPIO4_IRQHandler(
void)
ALIAS(IntDefaultHandler);
121 void GPIO5_IRQHandler(
void)
ALIAS(IntDefaultHandler);
122 void GPIO6_IRQHandler(
void)
ALIAS(IntDefaultHandler);
123 void GPIO7_IRQHandler(
void)
ALIAS(IntDefaultHandler);
124 void GINT0_IRQHandler(
void)
ALIAS(IntDefaultHandler);
125 void GINT1_IRQHandler(
void)
ALIAS(IntDefaultHandler);
127 void CAN1_IRQHandler(
void)
ALIAS(IntDefaultHandler);
128 void ATIMER_IRQHandler(
void)
ALIAS(IntDefaultHandler);
132 void QEI_IRQHandler(
void)
ALIAS(IntDefaultHandler);
141 #if defined(__REDLIB__)
142 extern void __main(
void);
145 extern int main(
void);
152 extern void _vStackTop(
void);
155 #if defined(__cplusplus)
164 extern void(*
const g_pfnVectors[]) (void);
165 __attribute__ ((section(
".isr_vector")))
166 void(*const g_pfnVectors[]) (
void) = {
190 FLASHEEPROM_IRQHandler,
247 __attribute__ ((section(
".after_vectors")))
248 void data_init(
unsigned int romstart,
unsigned int start,
unsigned int len) {
249 unsigned int *pulDest = (
unsigned int *) start;
250 unsigned int *pulSrc = (
unsigned int *) romstart;
252 for (loop = 0; loop < len; loop = loop + 4)
253 *pulDest++ = *pulSrc++;
256 __attribute__ ((section(
".after_vectors")))
257 void bss_init(
unsigned int start,
unsigned int len) {
258 unsigned int *pulDest = (
unsigned int *) start;
260 for (loop = 0; loop < len; loop = loop + 4)
271 extern unsigned int __data_section_table;
272 extern unsigned int __data_section_table_end;
273 extern unsigned int __bss_section_table;
274 extern unsigned int __bss_section_table_end;
288 unsigned int LoadAddr, ExeAddr, SectionLen;
289 unsigned int *SectionTableAddr;
295 SectionTableAddr = &__data_section_table;
298 while (SectionTableAddr < &__data_section_table_end) {
299 LoadAddr = *SectionTableAddr++;
300 ExeAddr = *SectionTableAddr++;
301 SectionLen = *SectionTableAddr++;
302 data_init(LoadAddr, ExeAddr, SectionLen);
306 while (SectionTableAddr < &__bss_section_table_end) {
307 ExeAddr = *SectionTableAddr++;
308 SectionLen = *SectionTableAddr++;
309 bss_init(ExeAddr, SectionLen);
312 #if defined(__cplusplus)
319 #if defined(__REDLIB__)
336 __attribute__ ((section(
".after_vectors")))
342 __attribute__ ((section(
".after_vectors")))
348 __attribute__ ((section(
".after_vectors")))
354 __attribute__ ((section(
".after_vectors")))
360 __attribute__ ((section(
".after_vectors")))
366 __attribute__ ((section(
".after_vectors")))
372 __attribute__ ((section(
".after_vectors")))
378 __attribute__ ((section(
".after_vectors")))
384 __attribute__ ((section(
".after_vectors")))
396 __attribute__ ((section(
".after_vectors")))