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)))
54 #if defined(OS_UCOS_III)
59 #if defined(__cplusplus)
91 void MX_CORE_IRQHandler(
void)
ALIAS(IntDefaultHandler);
93 void FLASHEEPROM_IRQHandler(
void)
ALIAS(IntDefaultHandler);
102 void GINT1_IRQHandler(
void)
ALIAS(IntDefaultHandler);
103 void GPIO4_IRQHandler(
void)
ALIAS(IntDefaultHandler);
104 void TIMER3_IRQHandler(
void)
ALIAS(IntDefaultHandler);
105 void MCPWM_IRQHandler(
void)
ALIAS(IntDefaultHandler);
108 void SGPIO_IRQHandler(
void)
ALIAS(IntDefaultHandler);
109 void SPI_IRQHandler (
void)
ALIAS(IntDefaultHandler);
111 void SSP0_IRQHandler(
void)
ALIAS(IntDefaultHandler);
115 void UART2_IRQHandler(
void)
ALIAS(IntDefaultHandler);
116 void UART3_IRQHandler(
void)
ALIAS(IntDefaultHandler);
127 #if defined(__REDLIB__)
128 extern void __main(
void);
131 extern int main(
void);
138 extern void _vStackTop(
void);
147 #define STACK_SIZE (0x200)
157 #define HEAP_SIZE (0x4000)
160 unsigned int __vStack[
STACK_SIZE /
sizeof(
unsigned int)] __attribute__((section(
"STACK,\"aw\",%nobits@")));
161 unsigned int __vHeap[
HEAP_SIZE /
sizeof(
unsigned int)] __attribute__((section(
"HEAP,\"aw\",%nobits@")));
164 #if defined(__cplusplus)
168 #define M0_Image_Magic 0xAA55DEAD
169 extern const struct image_sig __M0Signature;
177 extern void(*
const g_pfnVectors[]) (void);
178 __attribute__ ((section(
".isr_vector")))
179 void(*const g_pfnVectors[]) (
void) = {
190 (void (*)(void))&__M0Signature,
195 #if defined(OS_UCOS_III)
207 FLASHEEPROM_IRQHandler,
243 __attribute__ ((section(
".after_vectors")))
244 void data_init(
unsigned int romstart,
unsigned int start,
unsigned int len) {
245 unsigned int *pulDest = (
unsigned int *) start;
246 unsigned int *pulSrc = (
unsigned int *) romstart;
248 for (loop = 0; loop < len; loop = loop + 4)
249 *pulDest++ = *pulSrc++;
252 __attribute__ ((section(
".after_vectors")))
253 void bss_init(
unsigned int start,
unsigned int len) {
254 unsigned int *pulDest = (
unsigned int *) start;
256 for (loop = 0; loop < len; loop = loop + 4)
267 extern unsigned int __data_section_table;
268 extern unsigned int __data_section_table_end;
269 extern unsigned int __bss_section_table;
270 extern unsigned int __bss_section_table_end;
271 extern unsigned int __bss_section_end;
285 unsigned int LoadAddr, ExeAddr, SectionLen;
286 unsigned int *SectionTableAddr;
292 SectionTableAddr = &__data_section_table;
295 while (SectionTableAddr < &__data_section_table_end) {
296 LoadAddr = *SectionTableAddr++;
297 ExeAddr = *SectionTableAddr++;
298 SectionLen = *SectionTableAddr++;
299 data_init(LoadAddr, ExeAddr, SectionLen);
303 while (SectionTableAddr < &__bss_section_end) {
304 ExeAddr = *SectionTableAddr++;
305 SectionLen = *SectionTableAddr++;
306 bss_init(ExeAddr, SectionLen);
309 #if defined(__cplusplus)
316 #if defined(__REDLIB__)
333 __attribute__ ((section(
".after_vectors")))
339 __attribute__ ((section(
".after_vectors")))
345 __attribute__ ((section(
".after_vectors")))
351 __attribute__ ((section(
".after_vectors")))
357 __attribute__ ((section(
".after_vectors")))
363 __attribute__ ((section(
".after_vectors")))
369 __attribute__ ((section(
".after_vectors")))
375 __attribute__ ((section(
".after_vectors")))
381 __attribute__ ((section(
".after_vectors")))
393 __attribute__ ((section(
".after_vectors")))
394 void IntDefaultHandler(
void)
404 extern unsigned int *_pvHeapStart;
405 unsigned int __check_heap_overflow (
void * new_end_of_heap)
407 return (new_end_of_heap >= (
void *)&__vHeap[HEAP_SIZE/
sizeof(
unsigned int)]);