Mouse code for the MacroRat
mbed-dev/targets/TARGET_NUVOTON/TARGET_M451/device/startup_M451Series.c@46:b156ef445742, 2017-06-03 (annotated)
- Committer:
- sahilmgandhi
- Date:
- Sat Jun 03 00:22:44 2017 +0000
- Revision:
- 46:b156ef445742
- Parent:
- 18:6a4db94011d3
Final code for internal battlebot competition.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sahilmgandhi | 18:6a4db94011d3 | 1 | /****************************************************************************** |
sahilmgandhi | 18:6a4db94011d3 | 2 | * @file startup_M451Series.c |
sahilmgandhi | 18:6a4db94011d3 | 3 | * @version V0.10 |
sahilmgandhi | 18:6a4db94011d3 | 4 | * $Revision: 11 $ |
sahilmgandhi | 18:6a4db94011d3 | 5 | * $Date: 15/09/02 10:02a $ |
sahilmgandhi | 18:6a4db94011d3 | 6 | * @brief CMSIS Cortex-M4 Core Peripheral Access Layer Source File for M451 Series MCU |
sahilmgandhi | 18:6a4db94011d3 | 7 | * |
sahilmgandhi | 18:6a4db94011d3 | 8 | * @note |
sahilmgandhi | 18:6a4db94011d3 | 9 | * Copyright (C) 2013~2015 Nuvoton Technology Corp. All rights reserved. |
sahilmgandhi | 18:6a4db94011d3 | 10 | *****************************************************************************/ |
sahilmgandhi | 18:6a4db94011d3 | 11 | |
sahilmgandhi | 18:6a4db94011d3 | 12 | #include "M451Series.h" |
sahilmgandhi | 18:6a4db94011d3 | 13 | |
sahilmgandhi | 18:6a4db94011d3 | 14 | /* Suppress warning messages */ |
sahilmgandhi | 18:6a4db94011d3 | 15 | #if defined(__CC_ARM) |
sahilmgandhi | 18:6a4db94011d3 | 16 | // Suppress warning message: extended constant initialiser used |
sahilmgandhi | 18:6a4db94011d3 | 17 | #pragma diag_suppress 1296 |
sahilmgandhi | 18:6a4db94011d3 | 18 | #elif defined(__ICCARM__) |
sahilmgandhi | 18:6a4db94011d3 | 19 | #elif defined(__GNUC__) |
sahilmgandhi | 18:6a4db94011d3 | 20 | #endif |
sahilmgandhi | 18:6a4db94011d3 | 21 | |
sahilmgandhi | 18:6a4db94011d3 | 22 | /* Macro Definitions */ |
sahilmgandhi | 18:6a4db94011d3 | 23 | #if defined(__CC_ARM) |
sahilmgandhi | 18:6a4db94011d3 | 24 | #define WEAK __attribute__ ((weak)) |
sahilmgandhi | 18:6a4db94011d3 | 25 | #define ALIAS(f) __attribute__ ((weak, alias(#f))) |
sahilmgandhi | 18:6a4db94011d3 | 26 | |
sahilmgandhi | 18:6a4db94011d3 | 27 | #define WEAK_ALIAS_FUNC(FUN, FUN_ALIAS) \ |
sahilmgandhi | 18:6a4db94011d3 | 28 | void FUN(void) __attribute__ ((weak, alias(#FUN_ALIAS))); |
sahilmgandhi | 18:6a4db94011d3 | 29 | |
sahilmgandhi | 18:6a4db94011d3 | 30 | #elif defined(__ICCARM__) |
sahilmgandhi | 18:6a4db94011d3 | 31 | //#define STRINGIFY(x) #x |
sahilmgandhi | 18:6a4db94011d3 | 32 | //#define _STRINGIFY(x) STRINGIFY(x) |
sahilmgandhi | 18:6a4db94011d3 | 33 | #define WEAK_ALIAS_FUNC(FUN, FUN_ALIAS) \ |
sahilmgandhi | 18:6a4db94011d3 | 34 | void FUN(void); \ |
sahilmgandhi | 18:6a4db94011d3 | 35 | _Pragma(_STRINGIFY(_WEAK_ALIAS_FUNC(FUN, FUN_ALIAS))) |
sahilmgandhi | 18:6a4db94011d3 | 36 | #define _WEAK_ALIAS_FUNC(FUN, FUN_ALIAS) weak __WEAK_ALIAS_FUNC(FUN, FUN_ALIAS) |
sahilmgandhi | 18:6a4db94011d3 | 37 | #define __WEAK_ALIAS_FUNC(FUN, FUN_ALIAS) FUN##=##FUN_ALIAS |
sahilmgandhi | 18:6a4db94011d3 | 38 | |
sahilmgandhi | 18:6a4db94011d3 | 39 | #elif defined(__GNUC__) |
sahilmgandhi | 18:6a4db94011d3 | 40 | #define WEAK __attribute__ ((weak)) |
sahilmgandhi | 18:6a4db94011d3 | 41 | #define ALIAS(f) __attribute__ ((weak, alias(#f))) |
sahilmgandhi | 18:6a4db94011d3 | 42 | |
sahilmgandhi | 18:6a4db94011d3 | 43 | #define WEAK_ALIAS_FUNC(FUN, FUN_ALIAS) \ |
sahilmgandhi | 18:6a4db94011d3 | 44 | void FUN(void) __attribute__ ((weak, alias(#FUN_ALIAS))); |
sahilmgandhi | 18:6a4db94011d3 | 45 | |
sahilmgandhi | 18:6a4db94011d3 | 46 | #endif |
sahilmgandhi | 18:6a4db94011d3 | 47 | |
sahilmgandhi | 18:6a4db94011d3 | 48 | |
sahilmgandhi | 18:6a4db94011d3 | 49 | /* Initialize segments */ |
sahilmgandhi | 18:6a4db94011d3 | 50 | #if defined(__CC_ARM) |
sahilmgandhi | 18:6a4db94011d3 | 51 | extern uint32_t Image$$ARM_LIB_STACK$$ZI$$Limit; |
sahilmgandhi | 18:6a4db94011d3 | 52 | extern void __main(void); |
sahilmgandhi | 18:6a4db94011d3 | 53 | #elif defined(__ICCARM__) |
sahilmgandhi | 18:6a4db94011d3 | 54 | void __iar_program_start(void); |
sahilmgandhi | 18:6a4db94011d3 | 55 | #elif defined(__GNUC__) |
sahilmgandhi | 18:6a4db94011d3 | 56 | extern uint32_t __StackTop; |
sahilmgandhi | 18:6a4db94011d3 | 57 | extern uint32_t __etext; |
sahilmgandhi | 18:6a4db94011d3 | 58 | extern uint32_t __data_start__; |
sahilmgandhi | 18:6a4db94011d3 | 59 | extern uint32_t __data_end__; |
sahilmgandhi | 18:6a4db94011d3 | 60 | extern uint32_t __bss_start__; |
sahilmgandhi | 18:6a4db94011d3 | 61 | extern uint32_t __bss_end__; |
sahilmgandhi | 18:6a4db94011d3 | 62 | |
sahilmgandhi | 18:6a4db94011d3 | 63 | extern void uvisor_init(void); |
sahilmgandhi | 18:6a4db94011d3 | 64 | //#if defined(TOOLCHAIN_GCC_ARM) |
sahilmgandhi | 18:6a4db94011d3 | 65 | //extern void _start(void); |
sahilmgandhi | 18:6a4db94011d3 | 66 | //#endif |
sahilmgandhi | 18:6a4db94011d3 | 67 | extern void software_init_hook(void) __attribute__((weak)); |
sahilmgandhi | 18:6a4db94011d3 | 68 | extern void __libc_init_array(void); |
sahilmgandhi | 18:6a4db94011d3 | 69 | extern int main(void); |
sahilmgandhi | 18:6a4db94011d3 | 70 | #endif |
sahilmgandhi | 18:6a4db94011d3 | 71 | |
sahilmgandhi | 18:6a4db94011d3 | 72 | /* Default empty handler */ |
sahilmgandhi | 18:6a4db94011d3 | 73 | void Default_Handler(void); |
sahilmgandhi | 18:6a4db94011d3 | 74 | |
sahilmgandhi | 18:6a4db94011d3 | 75 | /* Reset handler */ |
sahilmgandhi | 18:6a4db94011d3 | 76 | void Reset_Handler(void); |
sahilmgandhi | 18:6a4db94011d3 | 77 | |
sahilmgandhi | 18:6a4db94011d3 | 78 | /* Cortex-M4 core handlers */ |
sahilmgandhi | 18:6a4db94011d3 | 79 | WEAK_ALIAS_FUNC(NMI_Handler, Default_Handler) |
sahilmgandhi | 18:6a4db94011d3 | 80 | WEAK_ALIAS_FUNC(HardFault_Handler, Default_Handler) |
sahilmgandhi | 18:6a4db94011d3 | 81 | WEAK_ALIAS_FUNC(MemManage_Handler, Default_Handler) |
sahilmgandhi | 18:6a4db94011d3 | 82 | WEAK_ALIAS_FUNC(BusFault_Handler , Default_Handler) |
sahilmgandhi | 18:6a4db94011d3 | 83 | WEAK_ALIAS_FUNC(UsageFault_Handler, Default_Handler) |
sahilmgandhi | 18:6a4db94011d3 | 84 | WEAK_ALIAS_FUNC(SVC_Handler, Default_Handler) |
sahilmgandhi | 18:6a4db94011d3 | 85 | WEAK_ALIAS_FUNC(DebugMon_Handler, Default_Handler) |
sahilmgandhi | 18:6a4db94011d3 | 86 | WEAK_ALIAS_FUNC(PendSV_Handler, Default_Handler) |
sahilmgandhi | 18:6a4db94011d3 | 87 | WEAK_ALIAS_FUNC(SysTick_Handler, Default_Handler) |
sahilmgandhi | 18:6a4db94011d3 | 88 | |
sahilmgandhi | 18:6a4db94011d3 | 89 | /* Peripherals handlers */ |
sahilmgandhi | 18:6a4db94011d3 | 90 | WEAK_ALIAS_FUNC(BOD_IRQHandler, Default_Handler) // 0: Brown Out detection |
sahilmgandhi | 18:6a4db94011d3 | 91 | WEAK_ALIAS_FUNC(IRC_IRQHandler, Default_Handler) // 1: Internal RC |
sahilmgandhi | 18:6a4db94011d3 | 92 | WEAK_ALIAS_FUNC(PWRWU_IRQHandler, Default_Handler) // 2: Power down wake up |
sahilmgandhi | 18:6a4db94011d3 | 93 | WEAK_ALIAS_FUNC(RAMPE_IRQHandler, Default_Handler) // 3: RAM parity error |
sahilmgandhi | 18:6a4db94011d3 | 94 | WEAK_ALIAS_FUNC(CLKFAIL_IRQHandler, Default_Handler) // 4: Clock detection fail |
sahilmgandhi | 18:6a4db94011d3 | 95 | // 5: Reserved |
sahilmgandhi | 18:6a4db94011d3 | 96 | WEAK_ALIAS_FUNC(RTC_IRQHandler, Default_Handler) // 6: Real Time Clock |
sahilmgandhi | 18:6a4db94011d3 | 97 | WEAK_ALIAS_FUNC(TAMPER_IRQHandler, Default_Handler) // 7: Tamper detection |
sahilmgandhi | 18:6a4db94011d3 | 98 | WEAK_ALIAS_FUNC(WDT_IRQHandler, Default_Handler) // 8: Watchdog timer |
sahilmgandhi | 18:6a4db94011d3 | 99 | WEAK_ALIAS_FUNC(WWDT_IRQHandler, Default_Handler) // 9: Window watchdog timer |
sahilmgandhi | 18:6a4db94011d3 | 100 | WEAK_ALIAS_FUNC(EINT0_IRQHandler, Default_Handler) // 10: External Input 0 |
sahilmgandhi | 18:6a4db94011d3 | 101 | WEAK_ALIAS_FUNC(EINT1_IRQHandler, Default_Handler) // 11: External Input 1 |
sahilmgandhi | 18:6a4db94011d3 | 102 | WEAK_ALIAS_FUNC(EINT2_IRQHandler, Default_Handler) // 12: External Input 2 |
sahilmgandhi | 18:6a4db94011d3 | 103 | WEAK_ALIAS_FUNC(EINT3_IRQHandler, Default_Handler) // 13: External Input 3 |
sahilmgandhi | 18:6a4db94011d3 | 104 | WEAK_ALIAS_FUNC(EINT4_IRQHandler, Default_Handler) // 14: External Input 4 |
sahilmgandhi | 18:6a4db94011d3 | 105 | WEAK_ALIAS_FUNC(EINT5_IRQHandler, Default_Handler) // 15: External Input 5 |
sahilmgandhi | 18:6a4db94011d3 | 106 | WEAK_ALIAS_FUNC(GPA_IRQHandler, Default_Handler) // 16: GPIO Port A |
sahilmgandhi | 18:6a4db94011d3 | 107 | WEAK_ALIAS_FUNC(GPB_IRQHandler, Default_Handler) // 17: GPIO Port B |
sahilmgandhi | 18:6a4db94011d3 | 108 | WEAK_ALIAS_FUNC(GPC_IRQHandler, Default_Handler) // 18: GPIO Port C |
sahilmgandhi | 18:6a4db94011d3 | 109 | WEAK_ALIAS_FUNC(GPD_IRQHandler, Default_Handler) // 19: GPIO Port D |
sahilmgandhi | 18:6a4db94011d3 | 110 | WEAK_ALIAS_FUNC(GPE_IRQHandler, Default_Handler) // 20: GPIO Port E |
sahilmgandhi | 18:6a4db94011d3 | 111 | WEAK_ALIAS_FUNC(GPF_IRQHandler, Default_Handler) // 21: GPIO Port F |
sahilmgandhi | 18:6a4db94011d3 | 112 | WEAK_ALIAS_FUNC(SPI0_IRQHandler, Default_Handler) // 22: SPI0 |
sahilmgandhi | 18:6a4db94011d3 | 113 | WEAK_ALIAS_FUNC(SPI1_IRQHandler, Default_Handler) // 23: SPI1 |
sahilmgandhi | 18:6a4db94011d3 | 114 | WEAK_ALIAS_FUNC(BRAKE0_IRQHandler, Default_Handler) // 24: |
sahilmgandhi | 18:6a4db94011d3 | 115 | WEAK_ALIAS_FUNC(PWM0P0_IRQHandler, Default_Handler) // 25: |
sahilmgandhi | 18:6a4db94011d3 | 116 | WEAK_ALIAS_FUNC(PWM0P1_IRQHandler, Default_Handler) // 26: |
sahilmgandhi | 18:6a4db94011d3 | 117 | WEAK_ALIAS_FUNC(PWM0P2_IRQHandler, Default_Handler) // 27: |
sahilmgandhi | 18:6a4db94011d3 | 118 | WEAK_ALIAS_FUNC(BRAKE1_IRQHandler, Default_Handler) // 28: |
sahilmgandhi | 18:6a4db94011d3 | 119 | WEAK_ALIAS_FUNC(PWM1P0_IRQHandler, Default_Handler) // 29: |
sahilmgandhi | 18:6a4db94011d3 | 120 | WEAK_ALIAS_FUNC(PWM1P1_IRQHandler, Default_Handler) // 30: |
sahilmgandhi | 18:6a4db94011d3 | 121 | WEAK_ALIAS_FUNC(PWM1P2_IRQHandler, Default_Handler) // 31: |
sahilmgandhi | 18:6a4db94011d3 | 122 | WEAK_ALIAS_FUNC(TMR0_IRQHandler, Default_Handler) // 32: Timer 0 |
sahilmgandhi | 18:6a4db94011d3 | 123 | WEAK_ALIAS_FUNC(TMR1_IRQHandler, Default_Handler) // 33: Timer 1 |
sahilmgandhi | 18:6a4db94011d3 | 124 | WEAK_ALIAS_FUNC(TMR2_IRQHandler, Default_Handler) // 34: Timer 2 |
sahilmgandhi | 18:6a4db94011d3 | 125 | WEAK_ALIAS_FUNC(TMR3_IRQHandler, Default_Handler) // 35: Timer 3 |
sahilmgandhi | 18:6a4db94011d3 | 126 | WEAK_ALIAS_FUNC(UART0_IRQHandler, Default_Handler) // 36: UART0 |
sahilmgandhi | 18:6a4db94011d3 | 127 | WEAK_ALIAS_FUNC(UART1_IRQHandler, Default_Handler) // 37: UART1 |
sahilmgandhi | 18:6a4db94011d3 | 128 | WEAK_ALIAS_FUNC(I2C0_IRQHandler, Default_Handler) // 38: I2C0 |
sahilmgandhi | 18:6a4db94011d3 | 129 | WEAK_ALIAS_FUNC(I2C1_IRQHandler, Default_Handler) // 39: I2C1 |
sahilmgandhi | 18:6a4db94011d3 | 130 | WEAK_ALIAS_FUNC(PDMA_IRQHandler, Default_Handler) // 40: Peripheral DMA |
sahilmgandhi | 18:6a4db94011d3 | 131 | WEAK_ALIAS_FUNC(DAC_IRQHandler, Default_Handler) // 41: DAC |
sahilmgandhi | 18:6a4db94011d3 | 132 | WEAK_ALIAS_FUNC(ADC00_IRQHandler, Default_Handler) // 42: ADC0 interrupt source 0 |
sahilmgandhi | 18:6a4db94011d3 | 133 | WEAK_ALIAS_FUNC(ADC01_IRQHandler, Default_Handler) // 43: ADC0 interrupt source 1 |
sahilmgandhi | 18:6a4db94011d3 | 134 | WEAK_ALIAS_FUNC(ACMP01_IRQHandler, Default_Handler) // 44: ACMP0 and ACMP1 |
sahilmgandhi | 18:6a4db94011d3 | 135 | // 45: Reserved |
sahilmgandhi | 18:6a4db94011d3 | 136 | WEAK_ALIAS_FUNC(ADC02_IRQHandler, Default_Handler) // 46: ADC0 interrupt source 2 |
sahilmgandhi | 18:6a4db94011d3 | 137 | WEAK_ALIAS_FUNC(ADC03_IRQHandler, Default_Handler) // 47: ADC0 interrupt source 3 |
sahilmgandhi | 18:6a4db94011d3 | 138 | WEAK_ALIAS_FUNC(UART2_IRQHandler, Default_Handler) // 48: UART2 |
sahilmgandhi | 18:6a4db94011d3 | 139 | WEAK_ALIAS_FUNC(UART3_IRQHandler, Default_Handler) // 49: UART3 |
sahilmgandhi | 18:6a4db94011d3 | 140 | // 50: Reserved |
sahilmgandhi | 18:6a4db94011d3 | 141 | WEAK_ALIAS_FUNC(SPI2_IRQHandler, Default_Handler) // 51: SPI2 |
sahilmgandhi | 18:6a4db94011d3 | 142 | // 52: Reserved |
sahilmgandhi | 18:6a4db94011d3 | 143 | WEAK_ALIAS_FUNC(USBD_IRQHandler, Default_Handler) // 53: USB device |
sahilmgandhi | 18:6a4db94011d3 | 144 | WEAK_ALIAS_FUNC(USBH_IRQHandler, Default_Handler) // 54: USB host |
sahilmgandhi | 18:6a4db94011d3 | 145 | WEAK_ALIAS_FUNC(USBOTG_IRQHandler, Default_Handler) // 55: USB OTG |
sahilmgandhi | 18:6a4db94011d3 | 146 | WEAK_ALIAS_FUNC(CAN0_IRQHandler, Default_Handler) // 56: CAN0 |
sahilmgandhi | 18:6a4db94011d3 | 147 | // 57: Reserved |
sahilmgandhi | 18:6a4db94011d3 | 148 | WEAK_ALIAS_FUNC(SC0_IRQHandler, Default_Handler) // 58: |
sahilmgandhi | 18:6a4db94011d3 | 149 | // 59: Reserved. |
sahilmgandhi | 18:6a4db94011d3 | 150 | // 60: |
sahilmgandhi | 18:6a4db94011d3 | 151 | // 61: |
sahilmgandhi | 18:6a4db94011d3 | 152 | // 62: |
sahilmgandhi | 18:6a4db94011d3 | 153 | WEAK_ALIAS_FUNC(TK_IRQHandler, Default_Handler) // 63: |
sahilmgandhi | 18:6a4db94011d3 | 154 | |
sahilmgandhi | 18:6a4db94011d3 | 155 | /* Vector table */ |
sahilmgandhi | 18:6a4db94011d3 | 156 | #if defined(__CC_ARM) |
sahilmgandhi | 18:6a4db94011d3 | 157 | __attribute__ ((section("RESET"))) |
sahilmgandhi | 18:6a4db94011d3 | 158 | const uint32_t __vector_handlers[] = { |
sahilmgandhi | 18:6a4db94011d3 | 159 | #elif defined(__ICCARM__) |
sahilmgandhi | 18:6a4db94011d3 | 160 | extern uint32_t CSTACK$$Limit; |
sahilmgandhi | 18:6a4db94011d3 | 161 | const uint32_t __vector_table[] @ ".intvec" = { |
sahilmgandhi | 18:6a4db94011d3 | 162 | #elif defined(__GNUC__) |
sahilmgandhi | 18:6a4db94011d3 | 163 | __attribute__ ((section(".vector_table"))) |
sahilmgandhi | 18:6a4db94011d3 | 164 | const uint32_t __vector_handlers[] = { |
sahilmgandhi | 18:6a4db94011d3 | 165 | #endif |
sahilmgandhi | 18:6a4db94011d3 | 166 | |
sahilmgandhi | 18:6a4db94011d3 | 167 | /* Configure Initial Stack Pointer, using linker-generated symbols */ |
sahilmgandhi | 18:6a4db94011d3 | 168 | #if defined(__CC_ARM) |
sahilmgandhi | 18:6a4db94011d3 | 169 | (uint32_t) &Image$$ARM_LIB_STACK$$ZI$$Limit, |
sahilmgandhi | 18:6a4db94011d3 | 170 | #elif defined(__ICCARM__) |
sahilmgandhi | 18:6a4db94011d3 | 171 | //(uint32_t) __sfe("CSTACK"), |
sahilmgandhi | 18:6a4db94011d3 | 172 | (uint32_t) &CSTACK$$Limit, |
sahilmgandhi | 18:6a4db94011d3 | 173 | #elif defined(__GNUC__) |
sahilmgandhi | 18:6a4db94011d3 | 174 | (uint32_t) &__StackTop, |
sahilmgandhi | 18:6a4db94011d3 | 175 | #endif |
sahilmgandhi | 18:6a4db94011d3 | 176 | |
sahilmgandhi | 18:6a4db94011d3 | 177 | (uint32_t) Reset_Handler, // Reset Handler |
sahilmgandhi | 18:6a4db94011d3 | 178 | (uint32_t) NMI_Handler, // NMI Handler |
sahilmgandhi | 18:6a4db94011d3 | 179 | (uint32_t) HardFault_Handler, // Hard Fault Handler |
sahilmgandhi | 18:6a4db94011d3 | 180 | (uint32_t) MemManage_Handler, // MPU Fault Handler |
sahilmgandhi | 18:6a4db94011d3 | 181 | (uint32_t) BusFault_Handler, // Bus Fault Handler |
sahilmgandhi | 18:6a4db94011d3 | 182 | (uint32_t) UsageFault_Handler, // Usage Fault Handler |
sahilmgandhi | 18:6a4db94011d3 | 183 | 0, // Reserved |
sahilmgandhi | 18:6a4db94011d3 | 184 | 0, // Reserved |
sahilmgandhi | 18:6a4db94011d3 | 185 | 0, // Reserved |
sahilmgandhi | 18:6a4db94011d3 | 186 | 0, // Reserved |
sahilmgandhi | 18:6a4db94011d3 | 187 | (uint32_t) SVC_Handler, // SVCall Handler |
sahilmgandhi | 18:6a4db94011d3 | 188 | (uint32_t) DebugMon_Handler, // Debug Monitor Handler |
sahilmgandhi | 18:6a4db94011d3 | 189 | 0, // Reserved |
sahilmgandhi | 18:6a4db94011d3 | 190 | (uint32_t) PendSV_Handler, // PendSV Handler |
sahilmgandhi | 18:6a4db94011d3 | 191 | (uint32_t) SysTick_Handler, // SysTick Handler |
sahilmgandhi | 18:6a4db94011d3 | 192 | |
sahilmgandhi | 18:6a4db94011d3 | 193 | /* External Interrupts */ |
sahilmgandhi | 18:6a4db94011d3 | 194 | (uint32_t) BOD_IRQHandler, // 0: Brown Out detection |
sahilmgandhi | 18:6a4db94011d3 | 195 | (uint32_t) IRC_IRQHandler, // 1: Internal RC |
sahilmgandhi | 18:6a4db94011d3 | 196 | (uint32_t) PWRWU_IRQHandler, // 2: Power down wake up |
sahilmgandhi | 18:6a4db94011d3 | 197 | (uint32_t) RAMPE_IRQHandler, // 3: RAM parity error |
sahilmgandhi | 18:6a4db94011d3 | 198 | (uint32_t) CLKFAIL_IRQHandler, // 4: Clock detection fail |
sahilmgandhi | 18:6a4db94011d3 | 199 | (uint32_t) Default_Handler, // 5: Reserved |
sahilmgandhi | 18:6a4db94011d3 | 200 | (uint32_t) RTC_IRQHandler, // 6: Real Time Clock |
sahilmgandhi | 18:6a4db94011d3 | 201 | (uint32_t) TAMPER_IRQHandler, // 7: Tamper detection |
sahilmgandhi | 18:6a4db94011d3 | 202 | (uint32_t) WDT_IRQHandler, // 8: Watchdog timer |
sahilmgandhi | 18:6a4db94011d3 | 203 | (uint32_t) WWDT_IRQHandler, // 9: Window watchdog timer |
sahilmgandhi | 18:6a4db94011d3 | 204 | (uint32_t) EINT0_IRQHandler, // 10: External Input 0 |
sahilmgandhi | 18:6a4db94011d3 | 205 | (uint32_t) EINT1_IRQHandler, // 11: External Input 1 |
sahilmgandhi | 18:6a4db94011d3 | 206 | (uint32_t) EINT2_IRQHandler, // 12: External Input 2 |
sahilmgandhi | 18:6a4db94011d3 | 207 | (uint32_t) EINT3_IRQHandler, // 13: External Input 3 |
sahilmgandhi | 18:6a4db94011d3 | 208 | (uint32_t) EINT4_IRQHandler, // 14: External Input 4 |
sahilmgandhi | 18:6a4db94011d3 | 209 | (uint32_t) EINT5_IRQHandler, // 15: External Input 5 |
sahilmgandhi | 18:6a4db94011d3 | 210 | (uint32_t) GPA_IRQHandler, // 16: GPIO Port A |
sahilmgandhi | 18:6a4db94011d3 | 211 | (uint32_t) GPB_IRQHandler, // 17: GPIO Port B |
sahilmgandhi | 18:6a4db94011d3 | 212 | (uint32_t) GPC_IRQHandler, // 18: GPIO Port C |
sahilmgandhi | 18:6a4db94011d3 | 213 | (uint32_t) GPD_IRQHandler, // 19: GPIO Port D |
sahilmgandhi | 18:6a4db94011d3 | 214 | (uint32_t) GPE_IRQHandler, // 20: GPIO Port E |
sahilmgandhi | 18:6a4db94011d3 | 215 | (uint32_t) GPF_IRQHandler, // 21: GPIO Port F |
sahilmgandhi | 18:6a4db94011d3 | 216 | (uint32_t) SPI0_IRQHandler, // 22: SPI0 |
sahilmgandhi | 18:6a4db94011d3 | 217 | (uint32_t) SPI1_IRQHandler, // 23: SPI1 |
sahilmgandhi | 18:6a4db94011d3 | 218 | (uint32_t) BRAKE0_IRQHandler, // 24: |
sahilmgandhi | 18:6a4db94011d3 | 219 | (uint32_t) PWM0P0_IRQHandler, // 25: |
sahilmgandhi | 18:6a4db94011d3 | 220 | (uint32_t) PWM0P1_IRQHandler, // 26: |
sahilmgandhi | 18:6a4db94011d3 | 221 | (uint32_t) PWM0P2_IRQHandler, // 27: |
sahilmgandhi | 18:6a4db94011d3 | 222 | (uint32_t) BRAKE1_IRQHandler, // 28: |
sahilmgandhi | 18:6a4db94011d3 | 223 | (uint32_t) PWM1P0_IRQHandler, // 29: |
sahilmgandhi | 18:6a4db94011d3 | 224 | (uint32_t) PWM1P1_IRQHandler, // 30: |
sahilmgandhi | 18:6a4db94011d3 | 225 | (uint32_t) PWM1P2_IRQHandler, // 31: |
sahilmgandhi | 18:6a4db94011d3 | 226 | (uint32_t) TMR0_IRQHandler, // 32: Timer 0 |
sahilmgandhi | 18:6a4db94011d3 | 227 | (uint32_t) TMR1_IRQHandler, // 33: Timer 1 |
sahilmgandhi | 18:6a4db94011d3 | 228 | (uint32_t) TMR2_IRQHandler, // 34: Timer 2 |
sahilmgandhi | 18:6a4db94011d3 | 229 | (uint32_t) TMR3_IRQHandler, // 35: Timer 3 |
sahilmgandhi | 18:6a4db94011d3 | 230 | (uint32_t) UART0_IRQHandler, // 36: UART0 |
sahilmgandhi | 18:6a4db94011d3 | 231 | (uint32_t) UART1_IRQHandler, // 37: UART1 |
sahilmgandhi | 18:6a4db94011d3 | 232 | (uint32_t) I2C0_IRQHandler, // 38: I2C0 |
sahilmgandhi | 18:6a4db94011d3 | 233 | (uint32_t) I2C1_IRQHandler, // 39: I2C1 |
sahilmgandhi | 18:6a4db94011d3 | 234 | (uint32_t) PDMA_IRQHandler, // 40: Peripheral DMA |
sahilmgandhi | 18:6a4db94011d3 | 235 | (uint32_t) DAC_IRQHandler, // 41: DAC |
sahilmgandhi | 18:6a4db94011d3 | 236 | (uint32_t) ADC00_IRQHandler, // 42: ADC0 interrupt source 0 |
sahilmgandhi | 18:6a4db94011d3 | 237 | (uint32_t) ADC01_IRQHandler, // 43: ADC0 interrupt source 1 |
sahilmgandhi | 18:6a4db94011d3 | 238 | (uint32_t) ACMP01_IRQHandler, // 44: ACMP0 and ACMP1 |
sahilmgandhi | 18:6a4db94011d3 | 239 | (uint32_t) Default_Handler, // 45: Reserved |
sahilmgandhi | 18:6a4db94011d3 | 240 | (uint32_t) ADC02_IRQHandler, // 46: ADC0 interrupt source 2 |
sahilmgandhi | 18:6a4db94011d3 | 241 | (uint32_t) ADC03_IRQHandler, // 47: ADC0 interrupt source 3 |
sahilmgandhi | 18:6a4db94011d3 | 242 | (uint32_t) UART2_IRQHandler, // 48: UART2 |
sahilmgandhi | 18:6a4db94011d3 | 243 | (uint32_t) UART3_IRQHandler, // 49: UART3 |
sahilmgandhi | 18:6a4db94011d3 | 244 | (uint32_t) Default_Handler, // 50: Reserved |
sahilmgandhi | 18:6a4db94011d3 | 245 | (uint32_t) SPI2_IRQHandler, // 51: SPI2 |
sahilmgandhi | 18:6a4db94011d3 | 246 | (uint32_t) Default_Handler, // 52: Reserved |
sahilmgandhi | 18:6a4db94011d3 | 247 | (uint32_t) USBD_IRQHandler, // 53: USB device |
sahilmgandhi | 18:6a4db94011d3 | 248 | (uint32_t) USBH_IRQHandler, // 54: USB host |
sahilmgandhi | 18:6a4db94011d3 | 249 | (uint32_t) USBOTG_IRQHandler, // 55: USB OTG |
sahilmgandhi | 18:6a4db94011d3 | 250 | (uint32_t) CAN0_IRQHandler, // 56: CAN0 |
sahilmgandhi | 18:6a4db94011d3 | 251 | (uint32_t) Default_Handler, // 57: Reserved |
sahilmgandhi | 18:6a4db94011d3 | 252 | (uint32_t) SC0_IRQHandler, // 58: |
sahilmgandhi | 18:6a4db94011d3 | 253 | (uint32_t) Default_Handler, // 59: Reserved. |
sahilmgandhi | 18:6a4db94011d3 | 254 | (uint32_t) Default_Handler, // 60: |
sahilmgandhi | 18:6a4db94011d3 | 255 | (uint32_t) Default_Handler, // 61: |
sahilmgandhi | 18:6a4db94011d3 | 256 | (uint32_t) Default_Handler, // 62: |
sahilmgandhi | 18:6a4db94011d3 | 257 | (uint32_t) TK_IRQHandler, // 63: |
sahilmgandhi | 18:6a4db94011d3 | 258 | }; |
sahilmgandhi | 18:6a4db94011d3 | 259 | |
sahilmgandhi | 18:6a4db94011d3 | 260 | /** |
sahilmgandhi | 18:6a4db94011d3 | 261 | * \brief This is the code that gets called on processor reset. |
sahilmgandhi | 18:6a4db94011d3 | 262 | */ |
sahilmgandhi | 18:6a4db94011d3 | 263 | void Reset_Handler(void) |
sahilmgandhi | 18:6a4db94011d3 | 264 | { |
sahilmgandhi | 18:6a4db94011d3 | 265 | /* Disable register write-protection function */ |
sahilmgandhi | 18:6a4db94011d3 | 266 | SYS_UnlockReg(); |
sahilmgandhi | 18:6a4db94011d3 | 267 | |
sahilmgandhi | 18:6a4db94011d3 | 268 | /* Disable Power-on Reset function */ |
sahilmgandhi | 18:6a4db94011d3 | 269 | SYS_DISABLE_POR(); |
sahilmgandhi | 18:6a4db94011d3 | 270 | |
sahilmgandhi | 18:6a4db94011d3 | 271 | /* HXT Crystal Type Select: INV */ |
sahilmgandhi | 18:6a4db94011d3 | 272 | CLK->PWRCTL &= ~CLK_PWRCTL_HXTSELTYP_Msk; |
sahilmgandhi | 18:6a4db94011d3 | 273 | |
sahilmgandhi | 18:6a4db94011d3 | 274 | /* Enable register write-protection function */ |
sahilmgandhi | 18:6a4db94011d3 | 275 | SYS_LockReg(); |
sahilmgandhi | 18:6a4db94011d3 | 276 | |
sahilmgandhi | 18:6a4db94011d3 | 277 | /** |
sahilmgandhi | 18:6a4db94011d3 | 278 | * Because EBI (external SRAM) init is done in SystemInit(), SystemInit() must be called at the very start. |
sahilmgandhi | 18:6a4db94011d3 | 279 | */ |
sahilmgandhi | 18:6a4db94011d3 | 280 | SystemInit(); |
sahilmgandhi | 18:6a4db94011d3 | 281 | |
sahilmgandhi | 18:6a4db94011d3 | 282 | #if defined(__CC_ARM) |
sahilmgandhi | 18:6a4db94011d3 | 283 | __main(); |
sahilmgandhi | 18:6a4db94011d3 | 284 | |
sahilmgandhi | 18:6a4db94011d3 | 285 | #elif defined(__ICCARM__) |
sahilmgandhi | 18:6a4db94011d3 | 286 | __iar_program_start(); |
sahilmgandhi | 18:6a4db94011d3 | 287 | |
sahilmgandhi | 18:6a4db94011d3 | 288 | #elif defined(__GNUC__) |
sahilmgandhi | 18:6a4db94011d3 | 289 | uint32_t *src_ind = (uint32_t *) &__etext; |
sahilmgandhi | 18:6a4db94011d3 | 290 | uint32_t *dst_ind = (uint32_t *) &__data_start__; |
sahilmgandhi | 18:6a4db94011d3 | 291 | uint32_t *dst_end = (uint32_t *) &__data_end__; |
sahilmgandhi | 18:6a4db94011d3 | 292 | |
sahilmgandhi | 18:6a4db94011d3 | 293 | /* Move .data section from ROM to RAM */ |
sahilmgandhi | 18:6a4db94011d3 | 294 | if (src_ind != dst_ind) { |
sahilmgandhi | 18:6a4db94011d3 | 295 | for (; dst_ind < dst_end;) { |
sahilmgandhi | 18:6a4db94011d3 | 296 | *dst_ind ++ = *src_ind ++; |
sahilmgandhi | 18:6a4db94011d3 | 297 | } |
sahilmgandhi | 18:6a4db94011d3 | 298 | } |
sahilmgandhi | 18:6a4db94011d3 | 299 | |
sahilmgandhi | 18:6a4db94011d3 | 300 | /* Initialize .bss section to zero */ |
sahilmgandhi | 18:6a4db94011d3 | 301 | dst_ind = (uint32_t *) &__bss_start__; |
sahilmgandhi | 18:6a4db94011d3 | 302 | dst_end = (uint32_t *) &__bss_end__; |
sahilmgandhi | 18:6a4db94011d3 | 303 | if (dst_ind != dst_end) { |
sahilmgandhi | 18:6a4db94011d3 | 304 | for (; dst_ind < dst_end;) { |
sahilmgandhi | 18:6a4db94011d3 | 305 | *dst_ind ++ = 0; |
sahilmgandhi | 18:6a4db94011d3 | 306 | } |
sahilmgandhi | 18:6a4db94011d3 | 307 | } |
sahilmgandhi | 18:6a4db94011d3 | 308 | |
sahilmgandhi | 18:6a4db94011d3 | 309 | //uvisor_init(); |
sahilmgandhi | 18:6a4db94011d3 | 310 | |
sahilmgandhi | 18:6a4db94011d3 | 311 | if (software_init_hook) { |
sahilmgandhi | 18:6a4db94011d3 | 312 | /** |
sahilmgandhi | 18:6a4db94011d3 | 313 | * Give control to the RTOS via software_init_hook() which will also call __libc_init_array(). |
sahilmgandhi | 18:6a4db94011d3 | 314 | * Assume software_init_hook() is defined in libraries/rtos/rtx/TARGET_CORTEX_M/RTX_CM_lib.h. |
sahilmgandhi | 18:6a4db94011d3 | 315 | */ |
sahilmgandhi | 18:6a4db94011d3 | 316 | software_init_hook(); |
sahilmgandhi | 18:6a4db94011d3 | 317 | } |
sahilmgandhi | 18:6a4db94011d3 | 318 | else { |
sahilmgandhi | 18:6a4db94011d3 | 319 | __libc_init_array(); |
sahilmgandhi | 18:6a4db94011d3 | 320 | main(); |
sahilmgandhi | 18:6a4db94011d3 | 321 | } |
sahilmgandhi | 18:6a4db94011d3 | 322 | #endif |
sahilmgandhi | 18:6a4db94011d3 | 323 | |
sahilmgandhi | 18:6a4db94011d3 | 324 | /* Infinite loop */ |
sahilmgandhi | 18:6a4db94011d3 | 325 | while (1); |
sahilmgandhi | 18:6a4db94011d3 | 326 | } |
sahilmgandhi | 18:6a4db94011d3 | 327 | |
sahilmgandhi | 18:6a4db94011d3 | 328 | /** |
sahilmgandhi | 18:6a4db94011d3 | 329 | * \brief Default interrupt handler for unused IRQs. |
sahilmgandhi | 18:6a4db94011d3 | 330 | */ |
sahilmgandhi | 18:6a4db94011d3 | 331 | void Default_Handler(void) |
sahilmgandhi | 18:6a4db94011d3 | 332 | { |
sahilmgandhi | 18:6a4db94011d3 | 333 | while (1); |
sahilmgandhi | 18:6a4db94011d3 | 334 | } |