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)))
48 #include "sys_config.h"
55 #if defined (__cplusplus)
90 void TIMER3_IRQHandler(
void)
ALIAS(IntDefaultHandler);
93 void UART2_IRQHandler(
void)
ALIAS(IntDefaultHandler);
94 void UART3_IRQHandler(
void)
ALIAS(IntDefaultHandler);
95 void PWM1_IRQHandler(
void)
ALIAS(IntDefaultHandler);
98 void I2C2_IRQHandler(
void)
ALIAS(IntDefaultHandler);
99 void SPI_IRQHandler(
void)
ALIAS(IntDefaultHandler);
100 void SSP0_IRQHandler(
void)
ALIAS(IntDefaultHandler);
101 void SSP1_IRQHandler(
void)
ALIAS(IntDefaultHandler);
102 void PLL0_IRQHandler(
void)
ALIAS(IntDefaultHandler);
104 void EINT0_IRQHandler(
void)
ALIAS(IntDefaultHandler);
105 void EINT1_IRQHandler(
void)
ALIAS(IntDefaultHandler);
106 void EINT2_IRQHandler(
void)
ALIAS(IntDefaultHandler);
107 void EINT3_IRQHandler(
void)
ALIAS(IntDefaultHandler);
110 void USB_IRQHandler(
void)
ALIAS(IntDefaultHandler);
116 void MCPWM_IRQHandler(
void)
ALIAS(IntDefaultHandler);
117 void QEI_IRQHandler(
void)
ALIAS(IntDefaultHandler);
118 void PLL1_IRQHandler(
void)
ALIAS(IntDefaultHandler);
119 void USBActivity_IRQHandler(
void)
ALIAS(IntDefaultHandler);
120 void CANActivity_IRQHandler(
void)
ALIAS(IntDefaultHandler);
122 void UART4_IRQHandler(
void)
ALIAS(IntDefaultHandler);
123 void SSP2_IRQHandler(
void)
ALIAS(IntDefaultHandler);
125 void GPIO_IRQHandler(
void)
ALIAS(IntDefaultHandler);
126 void PWM0_IRQHandler(
void)
ALIAS(IntDefaultHandler);
127 void EEPROM_IRQHandler(
void)
ALIAS(IntDefaultHandler);
136 #if defined (__REDLIB__)
137 extern void __main(
void);
139 extern int main(
void);
145 extern void _vStackTop(
void);
148 #if defined (__cplusplus)
157 extern void (*
const g_pfnVectors[])(void);
158 __attribute__ ((section(
".isr_vector")))
159 void(*const g_pfnVectors[]) (
void) = {
192 #ifndef CHIP_LPC175X_6X
212 #ifndef CHIP_LPC175X_6X
220 USBActivity_IRQHandler,
221 CANActivity_IRQHandler,
222 #ifndef CHIP_LPC175X_6X
239 __attribute__ ((section(
".after_vectors")))
240 void data_init(
unsigned int romstart,
unsigned int start,
unsigned int len) {
241 unsigned int *pulDest = (
unsigned int*) start;
242 unsigned int *pulSrc = (
unsigned int*) romstart;
244 for (loop = 0; loop < len; loop = loop + 4)
245 *pulDest++ = *pulSrc++;
248 __attribute__ ((section(
".after_vectors")))
249 void bss_init(
unsigned int start,
unsigned int len) {
250 unsigned int *pulDest = (
unsigned int*) start;
252 for (loop = 0; loop < len; loop = loop + 4)
263 extern unsigned int __data_section_table;
264 extern unsigned int __data_section_table_end;
265 extern unsigned int __bss_section_table;
266 extern unsigned int __bss_section_table_end;
276 __attribute__ ((section(
".after_vectors")))
283 unsigned int LoadAddr, ExeAddr, SectionLen;
284 unsigned int *SectionTableAddr;
290 SectionTableAddr = &__data_section_table;
293 while (SectionTableAddr < &__data_section_table_end) {
294 LoadAddr = *SectionTableAddr++;
295 ExeAddr = *SectionTableAddr++;
296 SectionLen = *SectionTableAddr++;
297 data_init(LoadAddr, ExeAddr, SectionLen);
301 while (SectionTableAddr < &__bss_section_table_end) {
302 ExeAddr = *SectionTableAddr++;
303 SectionLen = *SectionTableAddr++;
304 bss_init(ExeAddr, SectionLen);
307 #if defined (__cplusplus)
314 #if defined (__REDLIB__)
333 __attribute__ ((section(
".after_vectors")))
340 __attribute__ ((section(
".after_vectors")))
347 __attribute__ ((section(
".after_vectors")))
354 __attribute__ ((section(
".after_vectors")))
361 __attribute__ ((section(
".after_vectors")))
368 __attribute__ ((section(
".after_vectors")))
375 __attribute__ ((section(
".after_vectors")))
382 __attribute__ ((section(
".after_vectors")))
389 __attribute__ ((section(
".after_vectors")))
403 __attribute__ ((section(
".after_vectors")))