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 SPI1_IRQHandler(
void)
ALIAS(IntDefaultHandler);
88 void UART2_IRQHandler(
void)
ALIAS(IntDefaultHandler);
96 void PININT0_IRQHandler(
void)
ALIAS(IntDefaultHandler);
97 void PININT1_IRQHandler(
void)
ALIAS(IntDefaultHandler);
98 void PININT2_IRQHandler(
void)
ALIAS(IntDefaultHandler);
99 void PININT3_IRQHandler(
void)
ALIAS(IntDefaultHandler);
100 void PININT4_IRQHandler(
void)
ALIAS(IntDefaultHandler);
101 void PININT5_IRQHandler(
void)
ALIAS(IntDefaultHandler);
102 void PININT6_IRQHandler(
void)
ALIAS(IntDefaultHandler);
103 void PININT7_IRQHandler(
void)
ALIAS(IntDefaultHandler);
111 #if defined (__REDLIB__)
112 extern void __main(
void);
114 extern int main(
void);
120 extern void _vStackTop(
void);
123 #if defined (__cplusplus)
132 extern void (*
const g_pfnVectors[])(void);
133 __attribute__ ((section(
".isr_vector")))
134 void (* const g_pfnVectors[])(
void) = {
195 __attribute__ ((section(
".after_vectors")))
196 void data_init(
unsigned int romstart,
unsigned int start,
unsigned int len) {
197 unsigned int *pulDest = (
unsigned int*) start;
198 unsigned int *pulSrc = (
unsigned int*) romstart;
200 for (loop = 0; loop < len; loop = loop + 4)
201 *pulDest++ = *pulSrc++;
204 __attribute__ ((section(
".after_vectors")))
205 void bss_init(
unsigned int start,
unsigned int len) {
206 unsigned int *pulDest = (
unsigned int*) start;
208 for (loop = 0; loop < len; loop = loop + 4)
219 extern unsigned int __data_section_table;
220 extern unsigned int __data_section_table_end;
221 extern unsigned int __bss_section_table;
222 extern unsigned int __bss_section_table_end;
230 __attribute__ ((section(
".after_vectors")))
237 unsigned int LoadAddr, ExeAddr, SectionLen;
238 unsigned int *SectionTableAddr;
241 SectionTableAddr = &__data_section_table;
244 while (SectionTableAddr < &__data_section_table_end) {
245 LoadAddr = *SectionTableAddr++;
246 ExeAddr = *SectionTableAddr++;
247 SectionLen = *SectionTableAddr++;
248 data_init(LoadAddr, ExeAddr, SectionLen);
252 while (SectionTableAddr < &__bss_section_table_end) {
253 ExeAddr = *SectionTableAddr++;
254 SectionLen = *SectionTableAddr++;
255 bss_init(ExeAddr, SectionLen);
260 #if defined (__cplusplus)
267 #if defined (__REDLIB__)
286 __attribute__ ((section(
".after_vectors")))
287 void NMI_Handler(
void)
293 __attribute__ ((section(
".after_vectors")))
294 void HardFault_Handler(
void)
300 __attribute__ ((section(
".after_vectors")))
301 void SVCall_Handler(
void)
307 __attribute__ ((section(
".after_vectors")))
308 void PendSV_Handler(
void)
321 __attribute__ ((section(
".after_vectors")))
322 void IntDefaultHandler(
void)