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)))
56 #if defined(__cplusplus)
88 void MX_CORE_IRQHandler(
void)
ALIAS(IntDefaultHandler);
90 void FLASHEEPROM_IRQHandler(
void)
ALIAS(IntDefaultHandler);
101 void TIMER3_IRQHandler(
void)
ALIAS(IntDefaultHandler);
102 void MCPWM_IRQHandler(
void)
ALIAS(IntDefaultHandler);
106 void SPI_IRQHandler (
void)
ALIAS(IntDefaultHandler);
108 void SSP0_IRQHandler(
void)
ALIAS(IntDefaultHandler);
109 void SSP1_IRQHandler(
void)
ALIAS(IntDefaultHandler);
112 void UART2_IRQHandler(
void)
ALIAS(IntDefaultHandler);
113 void UART3_IRQHandler(
void)
ALIAS(IntDefaultHandler);
115 void I2S1_IRQHandler(
void)
ALIAS(IntDefaultHandler);
116 void SPIFI_IRQHandler(
void)
ALIAS(IntDefaultHandler);
117 void SGPIO_IRQHandler(
void)
ALIAS(IntDefaultHandler);
119 void GPIO1_IRQHandler(
void)
ALIAS(IntDefaultHandler);
120 void GPIO2_IRQHandler(
void)
ALIAS(IntDefaultHandler);
121 void GPIO3_IRQHandler(
void)
ALIAS(IntDefaultHandler);
122 void GPIO4_IRQHandler(
void)
ALIAS(IntDefaultHandler);
123 void GPIO5_IRQHandler(
void)
ALIAS(IntDefaultHandler);
124 void GPIO6_IRQHandler(
void)
ALIAS(IntDefaultHandler);
125 void GPIO7_IRQHandler(
void)
ALIAS(IntDefaultHandler);
126 void GINT0_IRQHandler(
void)
ALIAS(IntDefaultHandler);
127 void GINT1_IRQHandler(
void)
ALIAS(IntDefaultHandler);
129 void CAN1_IRQHandler(
void)
ALIAS(IntDefaultHandler);
130 void ATIMER_IRQHandler(
void)
ALIAS(IntDefaultHandler);
134 void QEI_IRQHandler(
void)
ALIAS(IntDefaultHandler);
143 #if defined(__REDLIB__)
144 extern void __main(
void);
147 extern int main(
void);
154 extern void _vStackTop(
void);
157 #if defined(__cplusplus)
166 extern void(*
const g_pfnVectors[]) (void);
167 __attribute__ ((section(
".isr_vector")))
168 void(*const g_pfnVectors[]) (
void) = {
192 FLASHEEPROM_IRQHandler,
249 __attribute__ ((section(
".after_vectors")))
250 void data_init(
unsigned int romstart,
unsigned int start,
unsigned int len) {
251 unsigned int *pulDest = (
unsigned int *) start;
252 unsigned int *pulSrc = (
unsigned int *) romstart;
254 for (loop = 0; loop < len; loop = loop + 4)
255 *pulDest++ = *pulSrc++;
258 __attribute__ ((section(
".after_vectors")))
259 void bss_init(
unsigned int start,
unsigned int len) {
260 unsigned int *pulDest = (
unsigned int *) start;
262 for (loop = 0; loop < len; loop = loop + 4)
273 extern unsigned int __data_section_table;
274 extern unsigned int __data_section_table_end;
275 extern unsigned int __bss_section_table;
276 extern unsigned int __bss_section_table_end;
290 unsigned int LoadAddr, ExeAddr, SectionLen;
291 unsigned int *SectionTableAddr;
297 SectionTableAddr = &__data_section_table;
300 while (SectionTableAddr < &__data_section_table_end) {
301 LoadAddr = *SectionTableAddr++;
302 ExeAddr = *SectionTableAddr++;
303 SectionLen = *SectionTableAddr++;
304 data_init(LoadAddr, ExeAddr, SectionLen);
308 while (SectionTableAddr < &__bss_section_table_end) {
309 ExeAddr = *SectionTableAddr++;
310 SectionLen = *SectionTableAddr++;
311 bss_init(ExeAddr, SectionLen);
314 #if defined(__cplusplus)
321 #if defined(__REDLIB__)
338 __attribute__ ((section(
".after_vectors")))
344 __attribute__ ((section(
".after_vectors")))
350 __attribute__ ((section(
".after_vectors")))
356 __attribute__ ((section(
".after_vectors")))
362 __attribute__ ((section(
".after_vectors")))
368 __attribute__ ((section(
".after_vectors")))
374 __attribute__ ((section(
".after_vectors")))
380 __attribute__ ((section(
".after_vectors")))
386 __attribute__ ((section(
".after_vectors")))
398 __attribute__ ((section(
".after_vectors")))