14 #pragma GCC push_options
15 #pragma GCC optimize ("Og")
18 #if defined (__cplusplus)
20 #error Redlib does not support C++
28 extern void __libc_init_array(
void);
33 #define WEAK __attribute__ ((weak))
34 #define WEAK_AV __attribute__ ((weak, section(".after_vectors")))
35 #define ALIAS(f) __attribute__ ((weak, alias (#f)))
38 #if defined (__cplusplus)
50 #if defined (__USE_CMSIS)
52 #endif // (__USE_CMSIS)
397 #if defined (__REDLIB__)
398 extern void __main(
void);
400 extern int main(
void);
405 extern void _vStackTop(
void);
407 #if defined (__cplusplus)
417 extern void (*
const g_pfnVectors[])(void);
418 extern void * __Vectors
__attribute__ ((alias (
"g_pfnVectors")));
421 void (* const g_pfnVectors[])(
void) = {
604 void data_init(
unsigned int romstart,
unsigned int start,
unsigned int len) {
605 unsigned int *pulDest = (
unsigned int*)
start;
606 unsigned int *pulSrc = (
unsigned int*) romstart;
608 for (loop = 0; loop < len; loop = loop + 4)
609 *pulDest++ = *pulSrc++;
613 void bss_init(
unsigned int start,
unsigned int len) {
614 unsigned int *pulDest = (
unsigned int*)
start;
616 for (loop = 0; loop < len; loop = loop + 4)
641 __asm
volatile (
"cpsid i");
644 #if defined (__USE_CMSIS)
649 volatile unsigned int *WDOG1_WCR = (
unsigned int *) 0x400B8000;
650 *WDOG1_WCR = *WDOG1_WCR & ~(1 << 2);
651 volatile unsigned int *WDOG2_WCR = (
unsigned int *) 0x400D0000;
652 *WDOG2_WCR = *WDOG2_WCR & ~(1 << 2);
654 *((
volatile unsigned int *)0x400BC004) = 0xD928C520;
656 *((
volatile unsigned int *)0x400BC008) = 0xFFFF;
658 volatile unsigned int *RTWDOG_CS = (
unsigned int *) 0x400BC000;
659 *RTWDOG_CS = (*RTWDOG_CS & ~(1 << 7)) | (1 << 5);
661 #endif // (__USE_CMSIS)
666 unsigned int LoadAddr, ExeAddr, SectionLen;
667 unsigned int *SectionTableAddr;
674 LoadAddr = *SectionTableAddr++;
675 ExeAddr = *SectionTableAddr++;
676 SectionLen = *SectionTableAddr++;
677 data_init(LoadAddr, ExeAddr, SectionLen);
683 ExeAddr = *SectionTableAddr++;
684 SectionLen = *SectionTableAddr++;
685 bss_init(ExeAddr, SectionLen);
689 #if !defined (__USE_CMSIS)
697 unsigned int * pSCB_VTOR = (
unsigned int *) 0xE000ED08;
698 if ((
unsigned int *)g_pfnVectors!=(
unsigned int *) 0x00000000) {
699 *pSCB_VTOR = (
unsigned int)g_pfnVectors;
701 #endif // (__USE_CMSIS)
702 #if defined (__cplusplus)
710 __asm
volatile (
"cpsie i");
712 #if defined (__REDLIB__)
786 { DMA1_DMA17_DriverIRQHandler();
790 { DMA2_DMA18_DriverIRQHandler();
794 { DMA3_DMA19_DriverIRQHandler();
798 { DMA4_DMA20_DriverIRQHandler();
802 { DMA5_DMA21_DriverIRQHandler();
806 { DMA6_DMA22_DriverIRQHandler();
810 { DMA7_DMA23_DriverIRQHandler();
814 { DMA8_DMA24_DriverIRQHandler();
818 { DMA9_DMA25_DriverIRQHandler();
822 { DMA10_DMA26_DriverIRQHandler();
826 { DMA11_DMA27_DriverIRQHandler();
830 { DMA12_DMA28_DriverIRQHandler();
834 { DMA13_DMA29_DriverIRQHandler();
838 { DMA14_DMA30_DriverIRQHandler();
842 { DMA15_DMA31_DriverIRQHandler();
846 { DMA_ERROR_DriverIRQHandler();
850 { CTI0_ERROR_DriverIRQHandler();
854 { CTI1_ERROR_DriverIRQHandler();
858 { CORE_DriverIRQHandler();
862 { LPUART1_DriverIRQHandler();
866 { LPUART2_DriverIRQHandler();
870 { LPUART3_DriverIRQHandler();
874 { LPUART4_DriverIRQHandler();
878 { LPUART5_DriverIRQHandler();
882 { LPUART6_DriverIRQHandler();
886 { LPUART7_DriverIRQHandler();
890 { LPUART8_DriverIRQHandler();
894 { LPI2C1_DriverIRQHandler();
898 { LPI2C2_DriverIRQHandler();
902 { LPI2C3_DriverIRQHandler();
906 { LPI2C4_DriverIRQHandler();
910 { LPSPI1_DriverIRQHandler();
914 { LPSPI2_DriverIRQHandler();
918 { LPSPI3_DriverIRQHandler();
922 { LPSPI4_DriverIRQHandler();
926 { CAN1_DriverIRQHandler();
930 { CAN2_DriverIRQHandler();
934 { FLEXRAM_DriverIRQHandler();
938 { KPP_DriverIRQHandler();
942 { TSC_DIG_DriverIRQHandler();
946 { GPR_IRQ_DriverIRQHandler();
950 { LCDIF_DriverIRQHandler();
954 { CSI_DriverIRQHandler();
958 { PXP_DriverIRQHandler();
962 { WDOG2_DriverIRQHandler();
966 { SNVS_HP_WRAPPER_DriverIRQHandler();
970 { SNVS_HP_WRAPPER_TZ_DriverIRQHandler();
974 { SNVS_LP_WRAPPER_DriverIRQHandler();
978 { CSU_DriverIRQHandler();
982 { DCP_DriverIRQHandler();
986 { DCP_VMI_DriverIRQHandler();
990 { Reserved68_DriverIRQHandler();
994 { TRNG_DriverIRQHandler();
998 { SJC_DriverIRQHandler();
1002 { BEE_DriverIRQHandler();
1006 { SAI1_DriverIRQHandler();
1010 { SAI2_DriverIRQHandler();
1014 { SAI3_RX_DriverIRQHandler();
1018 { SAI3_TX_DriverIRQHandler();
1022 { SPDIF_DriverIRQHandler();
1026 { PMU_EVENT_DriverIRQHandler();
1030 { Reserved78_DriverIRQHandler();
1034 { TEMP_LOW_HIGH_DriverIRQHandler();
1038 { TEMP_PANIC_DriverIRQHandler();
1042 { USB_PHY1_DriverIRQHandler();
1046 { USB_PHY2_DriverIRQHandler();
1050 { ADC1_DriverIRQHandler();
1054 { ADC2_DriverIRQHandler();
1058 { DCDC_DriverIRQHandler();
1062 { Reserved86_DriverIRQHandler();
1066 { Reserved87_DriverIRQHandler();
1070 { GPIO1_INT0_DriverIRQHandler();
1074 { GPIO1_INT1_DriverIRQHandler();
1078 { GPIO1_INT2_DriverIRQHandler();
1082 { GPIO1_INT3_DriverIRQHandler();
1086 { GPIO1_INT4_DriverIRQHandler();
1090 { GPIO1_INT5_DriverIRQHandler();
1094 { GPIO1_INT6_DriverIRQHandler();
1098 { GPIO1_INT7_DriverIRQHandler();
1102 { GPIO1_Combined_0_15_DriverIRQHandler();
1106 { GPIO1_Combined_16_31_DriverIRQHandler();
1110 { GPIO2_Combined_0_15_DriverIRQHandler();
1114 { GPIO2_Combined_16_31_DriverIRQHandler();
1118 { GPIO3_Combined_0_15_DriverIRQHandler();
1122 { GPIO3_Combined_16_31_DriverIRQHandler();
1126 { GPIO4_Combined_0_15_DriverIRQHandler();
1130 { GPIO4_Combined_16_31_DriverIRQHandler();
1134 { GPIO5_Combined_0_15_DriverIRQHandler();
1138 { GPIO5_Combined_16_31_DriverIRQHandler();
1142 { FLEXIO1_DriverIRQHandler();
1146 { FLEXIO2_DriverIRQHandler();
1150 { WDOG1_DriverIRQHandler();
1154 { RTWDOG_DriverIRQHandler();
1158 { EWM_DriverIRQHandler();
1162 { CCM_1_DriverIRQHandler();
1166 { CCM_2_DriverIRQHandler();
1170 { GPC_DriverIRQHandler();
1174 { SRC_DriverIRQHandler();
1178 { Reserved115_DriverIRQHandler();
1182 { GPT1_DriverIRQHandler();
1186 { GPT2_DriverIRQHandler();
1190 { PWM1_0_DriverIRQHandler();
1194 { PWM1_1_DriverIRQHandler();
1198 { PWM1_2_DriverIRQHandler();
1202 { PWM1_3_DriverIRQHandler();
1206 { PWM1_FAULT_DriverIRQHandler();
1210 { Reserved123_DriverIRQHandler();
1214 { FLEXSPI_DriverIRQHandler();
1218 { SEMC_DriverIRQHandler();
1222 { USDHC1_DriverIRQHandler();
1226 { USDHC2_DriverIRQHandler();
1230 { USB_OTG2_DriverIRQHandler();
1234 { USB_OTG1_DriverIRQHandler();
1238 { ENET_DriverIRQHandler();
1242 { ENET_1588_Timer_DriverIRQHandler();
1246 { XBAR1_IRQ_0_1_DriverIRQHandler();
1250 { XBAR1_IRQ_2_3_DriverIRQHandler();
1254 { ADC_ETC_IRQ0_DriverIRQHandler();
1258 { ADC_ETC_IRQ1_DriverIRQHandler();
1262 { ADC_ETC_IRQ2_DriverIRQHandler();
1266 { ADC_ETC_ERROR_IRQ_DriverIRQHandler();
1270 { PIT_DriverIRQHandler();
1274 { ACMP1_DriverIRQHandler();
1278 { ACMP2_DriverIRQHandler();
1282 { ACMP3_DriverIRQHandler();
1286 { ACMP4_DriverIRQHandler();
1290 { Reserved143_DriverIRQHandler();
1294 { Reserved144_DriverIRQHandler();
1298 { ENC1_DriverIRQHandler();
1302 { ENC2_DriverIRQHandler();
1306 { ENC3_DriverIRQHandler();
1310 { ENC4_DriverIRQHandler();
1314 { TMR1_DriverIRQHandler();
1318 { TMR2_DriverIRQHandler();
1322 { TMR3_DriverIRQHandler();
1326 { TMR4_DriverIRQHandler();
1330 { PWM2_0_DriverIRQHandler();
1334 { PWM2_1_DriverIRQHandler();
1338 { PWM2_2_DriverIRQHandler();
1342 { PWM2_3_DriverIRQHandler();
1346 { PWM2_FAULT_DriverIRQHandler();
1350 { PWM3_0_DriverIRQHandler();
1354 { PWM3_1_DriverIRQHandler();
1358 { PWM3_2_DriverIRQHandler();
1362 { PWM3_3_DriverIRQHandler();
1366 { PWM3_FAULT_DriverIRQHandler();
1370 { PWM4_0_DriverIRQHandler();
1374 { PWM4_1_DriverIRQHandler();
1378 { PWM4_2_DriverIRQHandler();
1382 { PWM4_3_DriverIRQHandler();
1386 { PWM4_FAULT_DriverIRQHandler();
1392 #pragma GCC pop_options