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);
97 void GINT1_IRQHandler(
void)
ALIAS(IntDefaultHandler);
98 void GPIO4_IRQHandler(
void)
ALIAS(IntDefaultHandler);
99 void TIMER3_IRQHandler(
void)
ALIAS(IntDefaultHandler);
100 void MCPWM_IRQHandler(
void)
ALIAS(IntDefaultHandler);
103 void SGPIO_IRQHandler(
void)
ALIAS(IntDefaultHandler);
104 void SPI_IRQHandler (
void)
ALIAS(IntDefaultHandler);
106 void SSP0_IRQHandler(
void)
ALIAS(IntDefaultHandler);
110 void UART2_IRQHandler(
void)
ALIAS(IntDefaultHandler);
111 void UART3_IRQHandler(
void)
ALIAS(IntDefaultHandler);
122 #if defined(__REDLIB__)
123 extern void __main(
void);
126 extern int main(
void);
133 extern void _vStackTop(
void);
136 #if defined(__cplusplus)
145 extern void(*
const g_pfnVectors[]) (void);
146 __attribute__ ((section(
".isr_vector")))
147 void(*const g_pfnVectors[]) (
void) = {
171 FLASHEEPROM_IRQHandler,
207 __attribute__ ((section(
".after_vectors")))
208 void data_init(
unsigned int romstart,
unsigned int start,
unsigned int len) {
209 unsigned int *pulDest = (
unsigned int *) start;
210 unsigned int *pulSrc = (
unsigned int *) romstart;
212 for (loop = 0; loop < len; loop = loop + 4)
213 *pulDest++ = *pulSrc++;
216 __attribute__ ((section(
".after_vectors")))
217 void bss_init(
unsigned int start,
unsigned int len) {
218 unsigned int *pulDest = (
unsigned int *) start;
220 for (loop = 0; loop < len; loop = loop + 4)
231 extern unsigned int __data_section_table;
232 extern unsigned int __data_section_table_end;
233 extern unsigned int __bss_section_table;
234 extern unsigned int __bss_section_table_end;
248 unsigned int LoadAddr, ExeAddr, SectionLen;
249 unsigned int *SectionTableAddr;
255 SectionTableAddr = &__data_section_table;
258 while (SectionTableAddr < &__data_section_table_end) {
259 LoadAddr = *SectionTableAddr++;
260 ExeAddr = *SectionTableAddr++;
261 SectionLen = *SectionTableAddr++;
262 data_init(LoadAddr, ExeAddr, SectionLen);
266 while (SectionTableAddr < &__bss_section_table_end) {
267 ExeAddr = *SectionTableAddr++;
268 SectionLen = *SectionTableAddr++;
269 bss_init(ExeAddr, SectionLen);
272 #if defined(__cplusplus)
279 #if defined(__REDLIB__)
296 __attribute__ ((section(
".after_vectors")))
302 __attribute__ ((section(
".after_vectors")))
308 __attribute__ ((section(
".after_vectors")))
314 __attribute__ ((section(
".after_vectors")))
320 __attribute__ ((section(
".after_vectors")))
326 __attribute__ ((section(
".after_vectors")))
332 __attribute__ ((section(
".after_vectors")))
338 __attribute__ ((section(
".after_vectors")))
344 __attribute__ ((section(
".after_vectors")))
356 __attribute__ ((section(
".after_vectors")))