30 #if defined(__cplusplus)
32 #error Redlib does not support C++
40 extern void __libc_init_array(
void);
46 #include "lpc43xx_dualcore_config.h"
48 #define WEAK __attribute__ ((weak))
49 #define ALIAS(f) __attribute__ ((weak, alias(# f)))
55 #if defined(OS_UCOS_III)
61 #if defined(__cplusplus)
93 void MX_CORE_IRQHandler(
void)
ALIAS(IntDefaultHandler);
95 void FLASHEEPROM_IRQHandler(
void)
ALIAS(IntDefaultHandler);
106 void TIMER3_IRQHandler(
void)
ALIAS(IntDefaultHandler);
107 void MCPWM_IRQHandler(
void)
ALIAS(IntDefaultHandler);
111 void SPI_IRQHandler (
void)
ALIAS(IntDefaultHandler);
113 void SSP0_IRQHandler(
void)
ALIAS(IntDefaultHandler);
114 void SSP1_IRQHandler(
void)
ALIAS(IntDefaultHandler);
117 void UART2_IRQHandler(
void)
ALIAS(IntDefaultHandler);
118 void UART3_IRQHandler(
void)
ALIAS(IntDefaultHandler);
120 void I2S1_IRQHandler(
void)
ALIAS(IntDefaultHandler);
121 void SPIFI_IRQHandler(
void)
ALIAS(IntDefaultHandler);
122 void SGPIO_IRQHandler(
void)
ALIAS(IntDefaultHandler);
124 void GPIO1_IRQHandler(
void)
ALIAS(IntDefaultHandler);
125 void GPIO2_IRQHandler(
void)
ALIAS(IntDefaultHandler);
126 void GPIO3_IRQHandler(
void)
ALIAS(IntDefaultHandler);
127 void GPIO4_IRQHandler(
void)
ALIAS(IntDefaultHandler);
128 void GPIO5_IRQHandler(
void)
ALIAS(IntDefaultHandler);
129 void GPIO6_IRQHandler(
void)
ALIAS(IntDefaultHandler);
130 void GPIO7_IRQHandler(
void)
ALIAS(IntDefaultHandler);
131 void GINT0_IRQHandler(
void)
ALIAS(IntDefaultHandler);
132 void GINT1_IRQHandler(
void)
ALIAS(IntDefaultHandler);
134 void CAN1_IRQHandler(
void)
ALIAS(IntDefaultHandler);
135 void ATIMER_IRQHandler(
void)
ALIAS(IntDefaultHandler);
139 void QEI_IRQHandler(
void)
ALIAS(IntDefaultHandler);
148 #if defined(__REDLIB__)
149 extern void __main(
void);
152 extern int main(
void);
159 extern void _vStackTop(
void);
168 #define STACK_SIZE (0x200)
178 #define HEAP_SIZE (0x4000)
181 unsigned int __vStack[
STACK_SIZE /
sizeof(
unsigned int)] __attribute__((section(
"STACK,\"aw\",%nobits@")));
182 unsigned int __vHeap[
HEAP_SIZE /
sizeof(
unsigned int)] __attribute__((section(
"HEAP,\"aw\",%nobits@")));
185 #if defined(__cplusplus)
194 extern void(*
const g_pfnVectors[]) (void);
195 __attribute__ ((section(
".isr_vector")))
196 void(*const g_pfnVectors[]) (
void) = {
212 #if defined(OS_UCOS_III)
225 FLASHEEPROM_IRQHandler,
282 __attribute__ ((section(
".after_vectors")))
283 void data_init(
unsigned int romstart,
unsigned int start,
unsigned int len) {
284 unsigned int *pulDest = (
unsigned int *) start;
285 unsigned int *pulSrc = (
unsigned int *) romstart;
287 for (loop = 0; loop < len; loop = loop + 4)
288 *pulDest++ = *pulSrc++;
291 __attribute__ ((section(
".after_vectors")))
292 void bss_init(
unsigned int start,
unsigned int len) {
293 unsigned int *pulDest = (
unsigned int *) start;
295 for (loop = 0; loop < len; loop = loop + 4)
306 extern unsigned int __data_section_table;
307 extern unsigned int __data_section_table_end;
308 extern unsigned int __bss_section_table;
309 extern unsigned int __bss_section_table_end;
323 unsigned int LoadAddr, ExeAddr, SectionLen;
324 unsigned int *SectionTableAddr;
330 SectionTableAddr = &__data_section_table;
333 while (SectionTableAddr < &__data_section_table_end) {
334 LoadAddr = *SectionTableAddr++;
335 ExeAddr = *SectionTableAddr++;
336 SectionLen = *SectionTableAddr++;
337 data_init(LoadAddr, ExeAddr, SectionLen);
341 while (SectionTableAddr < &__bss_section_table_end) {
342 ExeAddr = *SectionTableAddr++;
343 SectionLen = *SectionTableAddr++;
344 bss_init(ExeAddr, SectionLen);
347 #if defined(__cplusplus)
354 #if defined(__REDLIB__)
371 __attribute__ ((section(
".after_vectors")))
377 __attribute__ ((section(
".after_vectors")))
383 __attribute__ ((section(
".after_vectors")))
389 __attribute__ ((section(
".after_vectors")))
395 __attribute__ ((section(
".after_vectors")))
401 __attribute__ ((section(
".after_vectors")))
407 __attribute__ ((section(
".after_vectors")))
413 __attribute__ ((section(
".after_vectors")))
419 __attribute__ ((section(
".after_vectors")))
431 __attribute__ ((section(
".after_vectors")))
432 void IntDefaultHandler(
void)
442 extern unsigned int *_pvHeapStart;
443 unsigned int __check_heap_overflow (
void * new_end_of_heap)
445 return (new_end_of_heap >= (
void *)&__vHeap[HEAP_SIZE/
sizeof(
unsigned int)]);