Mouse code for the MacroRat

Dependencies:   ITG3200 QEI

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?

UserRevisionLine numberNew contents of line
sahilmgandhi 18:6a4db94011d3 1 /**************************************************
sahilmgandhi 18:6a4db94011d3 2 *
sahilmgandhi 18:6a4db94011d3 3 * Part one of the system initialization code, contains low-level
sahilmgandhi 18:6a4db94011d3 4 * initialization, plain thumb variant.
sahilmgandhi 18:6a4db94011d3 5 *
sahilmgandhi 18:6a4db94011d3 6 * Copyright 2012 IAR Systems. All rights reserved.
sahilmgandhi 18:6a4db94011d3 7 *
sahilmgandhi 18:6a4db94011d3 8 * $Revision: 1106 $
sahilmgandhi 18:6a4db94011d3 9 *
sahilmgandhi 18:6a4db94011d3 10 **************************************************/
sahilmgandhi 18:6a4db94011d3 11
sahilmgandhi 18:6a4db94011d3 12 ;
sahilmgandhi 18:6a4db94011d3 13 ; The modules in this file are included in the libraries, and may be replaced
sahilmgandhi 18:6a4db94011d3 14 ; by any user-defined modules that define the PUBLIC symbol _program_start or
sahilmgandhi 18:6a4db94011d3 15 ; a user defined start symbol.
sahilmgandhi 18:6a4db94011d3 16 ; To override the cstartup defined in the library, simply add your modified
sahilmgandhi 18:6a4db94011d3 17 ; version to the workbench project.
sahilmgandhi 18:6a4db94011d3 18 ;
sahilmgandhi 18:6a4db94011d3 19 ; The vector table is normally located at address 0.
sahilmgandhi 18:6a4db94011d3 20 ; When debugging in RAM, it can be located in RAM, aligned to at least 2^6.
sahilmgandhi 18:6a4db94011d3 21 ; The name "__vector_table" has special meaning for C-SPY:
sahilmgandhi 18:6a4db94011d3 22 ; it is where the SP start value is found, and the NVIC vector
sahilmgandhi 18:6a4db94011d3 23 ; table register (VTOR) is initialized to this address if != 0.
sahilmgandhi 18:6a4db94011d3 24 ;
sahilmgandhi 18:6a4db94011d3 25 ; Cortex-M version
sahilmgandhi 18:6a4db94011d3 26 ;
sahilmgandhi 18:6a4db94011d3 27
sahilmgandhi 18:6a4db94011d3 28 MODULE ?cstartup
sahilmgandhi 18:6a4db94011d3 29
sahilmgandhi 18:6a4db94011d3 30 ;; Forward declaration of sections.
sahilmgandhi 18:6a4db94011d3 31 SECTION CSTACK:DATA:NOROOT(3)
sahilmgandhi 18:6a4db94011d3 32
sahilmgandhi 18:6a4db94011d3 33 SECTION .intvec:CODE:NOROOT(2)
sahilmgandhi 18:6a4db94011d3 34
sahilmgandhi 18:6a4db94011d3 35 EXTERN __iar_program_start
sahilmgandhi 18:6a4db94011d3 36 EXTERN SystemInit
sahilmgandhi 18:6a4db94011d3 37 PUBLIC __vector_table
sahilmgandhi 18:6a4db94011d3 38 PUBLIC __vector_table_0x1c
sahilmgandhi 18:6a4db94011d3 39
sahilmgandhi 18:6a4db94011d3 40 DATA
sahilmgandhi 18:6a4db94011d3 41 __vector_table
sahilmgandhi 18:6a4db94011d3 42 DCD sfe(CSTACK) ; Top of Stack
sahilmgandhi 18:6a4db94011d3 43 DCD Reset_Handler ; Reset Handler
sahilmgandhi 18:6a4db94011d3 44 DCD NMI_Handler ; NMI Handler
sahilmgandhi 18:6a4db94011d3 45 DCD HardFault_Handler ; Hard Fault Handler
sahilmgandhi 18:6a4db94011d3 46 DCD MemManage_Handler ; MPU Fault Handler
sahilmgandhi 18:6a4db94011d3 47 DCD BusFault_Handler ; Bus Fault Handler
sahilmgandhi 18:6a4db94011d3 48 DCD UsageFault_Handler ; Usage Fault Handler
sahilmgandhi 18:6a4db94011d3 49 __vector_table_0x1c
sahilmgandhi 18:6a4db94011d3 50 DCD 0 ; Reserved
sahilmgandhi 18:6a4db94011d3 51 DCD 0 ; Reserved
sahilmgandhi 18:6a4db94011d3 52 DCD 0 ; Reserved
sahilmgandhi 18:6a4db94011d3 53 DCD 0 ; Reserved
sahilmgandhi 18:6a4db94011d3 54 DCD SVC_Handler ; SVCall Handler
sahilmgandhi 18:6a4db94011d3 55 DCD DebugMon_Handler ; Debug Monitor Handler
sahilmgandhi 18:6a4db94011d3 56 DCD 0 ; Reserved
sahilmgandhi 18:6a4db94011d3 57 DCD PendSV_Handler ; PendSV Handler
sahilmgandhi 18:6a4db94011d3 58 DCD SysTick_Handler ; SysTick Handler
sahilmgandhi 18:6a4db94011d3 59 DCD FLEX_INT0_IRQHandler ; GPIO pin interrupt 0
sahilmgandhi 18:6a4db94011d3 60 DCD FLEX_INT1_IRQHandler ; GPIO pin interrupt 1
sahilmgandhi 18:6a4db94011d3 61 DCD FLEX_INT2_IRQHandler ; GPIO pin interrupt 2
sahilmgandhi 18:6a4db94011d3 62 DCD FLEX_INT3_IRQHandler ; GPIO pin interrupt 3
sahilmgandhi 18:6a4db94011d3 63 DCD FLEX_INT4_IRQHandler ; GPIO pin interrupt 4
sahilmgandhi 18:6a4db94011d3 64 DCD FLEX_INT5_IRQHandler ; GPIO pin interrupt 5
sahilmgandhi 18:6a4db94011d3 65 DCD FLEX_INT6_IRQHandler ; GPIO pin interrupt 6
sahilmgandhi 18:6a4db94011d3 66 DCD FLEX_INT7_IRQHandler ; GPIO pin interrupt 7
sahilmgandhi 18:6a4db94011d3 67 DCD GINT0_IRQHandler ; GPIO GROUP0 interrupt
sahilmgandhi 18:6a4db94011d3 68 DCD GINT1_IRQHandler ; GPIO GROUP1 interrupt
sahilmgandhi 18:6a4db94011d3 69 DCD 0 ; Reserved
sahilmgandhi 18:6a4db94011d3 70 DCD 0 ; Reserved
sahilmgandhi 18:6a4db94011d3 71 DCD 0 ; Reserved
sahilmgandhi 18:6a4db94011d3 72 DCD 0 ; Reserved
sahilmgandhi 18:6a4db94011d3 73 DCD SSP1_IRQHandler ; SSP1 interrupt
sahilmgandhi 18:6a4db94011d3 74 DCD I2C_IRQHandler ; I2C interrupt
sahilmgandhi 18:6a4db94011d3 75 DCD CT16B0_IRQHandler ; CT16B0 Match 0-3, Capture 0
sahilmgandhi 18:6a4db94011d3 76 DCD CT16B1_IRQHandler ; CT16B1 Match 0-3, Capture 0
sahilmgandhi 18:6a4db94011d3 77 DCD CT32B0_IRQHandler ; CT32B0 Match 0-3, Capture 0
sahilmgandhi 18:6a4db94011d3 78 DCD CT32B1_IRQHandler ; CT32B1 Match 0-3, Capture 0
sahilmgandhi 18:6a4db94011d3 79 DCD SSP0_IRQHandler ; SSP0 interrupt
sahilmgandhi 18:6a4db94011d3 80 DCD USART_IRQHandler ; USART interrupt
sahilmgandhi 18:6a4db94011d3 81 DCD USB_IRQHandler ; USB_IRQ interrupt
sahilmgandhi 18:6a4db94011d3 82 DCD USB_FIQHandler ; USB_FIQ interrupt
sahilmgandhi 18:6a4db94011d3 83 DCD ADC_IRQHandler ; ADC interrupt
sahilmgandhi 18:6a4db94011d3 84 DCD WWDT_IRQHandler ; WWDT interrupt
sahilmgandhi 18:6a4db94011d3 85 DCD BOD_IRQHandler ; BOD interrupt
sahilmgandhi 18:6a4db94011d3 86 DCD 0 ; Reserved
sahilmgandhi 18:6a4db94011d3 87 DCD 0 ; Reserved
sahilmgandhi 18:6a4db94011d3 88 DCD 0 ; Reserved
sahilmgandhi 18:6a4db94011d3 89 DCD USBWakeup_IRQHandler ; USB_WAKEUP interrupt
sahilmgandhi 18:6a4db94011d3 90
sahilmgandhi 18:6a4db94011d3 91 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
sahilmgandhi 18:6a4db94011d3 92 ;;
sahilmgandhi 18:6a4db94011d3 93 ;; Default interrupt handlers.
sahilmgandhi 18:6a4db94011d3 94 ;;
sahilmgandhi 18:6a4db94011d3 95 THUMB
sahilmgandhi 18:6a4db94011d3 96 PUBWEAK Reset_Handler
sahilmgandhi 18:6a4db94011d3 97 SECTION .text:CODE:NOROOT:REORDER(2)
sahilmgandhi 18:6a4db94011d3 98 Reset_Handler
sahilmgandhi 18:6a4db94011d3 99
sahilmgandhi 18:6a4db94011d3 100 LDR R0, =SystemInit
sahilmgandhi 18:6a4db94011d3 101 BLX R0
sahilmgandhi 18:6a4db94011d3 102 LDR R0, =__iar_program_start
sahilmgandhi 18:6a4db94011d3 103 BX R0
sahilmgandhi 18:6a4db94011d3 104
sahilmgandhi 18:6a4db94011d3 105 PUBWEAK NMI_Handler
sahilmgandhi 18:6a4db94011d3 106 PUBWEAK HardFault_Handler
sahilmgandhi 18:6a4db94011d3 107 PUBWEAK MemManage_Handler
sahilmgandhi 18:6a4db94011d3 108 PUBWEAK BusFault_Handler
sahilmgandhi 18:6a4db94011d3 109 PUBWEAK UsageFault_Handler
sahilmgandhi 18:6a4db94011d3 110 PUBWEAK SVC_Handler
sahilmgandhi 18:6a4db94011d3 111 PUBWEAK DebugMon_Handler
sahilmgandhi 18:6a4db94011d3 112 PUBWEAK PendSV_Handler
sahilmgandhi 18:6a4db94011d3 113 PUBWEAK SysTick_Handler
sahilmgandhi 18:6a4db94011d3 114 PUBWEAK FLEX_INT0_IRQHandler
sahilmgandhi 18:6a4db94011d3 115 PUBWEAK FLEX_INT1_IRQHandler
sahilmgandhi 18:6a4db94011d3 116 PUBWEAK FLEX_INT2_IRQHandler
sahilmgandhi 18:6a4db94011d3 117 PUBWEAK FLEX_INT3_IRQHandler
sahilmgandhi 18:6a4db94011d3 118 PUBWEAK FLEX_INT4_IRQHandler
sahilmgandhi 18:6a4db94011d3 119 PUBWEAK FLEX_INT5_IRQHandler
sahilmgandhi 18:6a4db94011d3 120 PUBWEAK FLEX_INT6_IRQHandler
sahilmgandhi 18:6a4db94011d3 121 PUBWEAK FLEX_INT7_IRQHandler
sahilmgandhi 18:6a4db94011d3 122 PUBWEAK GINT0_IRQHandler
sahilmgandhi 18:6a4db94011d3 123 PUBWEAK GINT1_IRQHandler
sahilmgandhi 18:6a4db94011d3 124 PUBWEAK SSP1_IRQHandler
sahilmgandhi 18:6a4db94011d3 125 PUBWEAK I2C_IRQHandler
sahilmgandhi 18:6a4db94011d3 126 PUBWEAK CT16B0_IRQHandler
sahilmgandhi 18:6a4db94011d3 127 PUBWEAK CT16B1_IRQHandler
sahilmgandhi 18:6a4db94011d3 128 PUBWEAK CT32B0_IRQHandler
sahilmgandhi 18:6a4db94011d3 129 PUBWEAK CT32B1_IRQHandler
sahilmgandhi 18:6a4db94011d3 130 PUBWEAK SSP0_IRQHandler
sahilmgandhi 18:6a4db94011d3 131 PUBWEAK USART_IRQHandler
sahilmgandhi 18:6a4db94011d3 132 PUBWEAK USB_IRQHandler
sahilmgandhi 18:6a4db94011d3 133 PUBWEAK USB_FIQHandler
sahilmgandhi 18:6a4db94011d3 134 PUBWEAK ADC_IRQHandler
sahilmgandhi 18:6a4db94011d3 135 PUBWEAK WWDT_IRQHandler
sahilmgandhi 18:6a4db94011d3 136 PUBWEAK BOD_IRQHandler
sahilmgandhi 18:6a4db94011d3 137 PUBWEAK USBWakeup_IRQHandler
sahilmgandhi 18:6a4db94011d3 138
sahilmgandhi 18:6a4db94011d3 139 SECTION .text:CODE:REORDER:NOROOT(1)
sahilmgandhi 18:6a4db94011d3 140 THUMB
sahilmgandhi 18:6a4db94011d3 141
sahilmgandhi 18:6a4db94011d3 142 NMI_Handler
sahilmgandhi 18:6a4db94011d3 143 HardFault_Handler
sahilmgandhi 18:6a4db94011d3 144 MemManage_Handler
sahilmgandhi 18:6a4db94011d3 145 BusFault_Handler
sahilmgandhi 18:6a4db94011d3 146 UsageFault_Handler
sahilmgandhi 18:6a4db94011d3 147 SVC_Handler
sahilmgandhi 18:6a4db94011d3 148 DebugMon_Handler
sahilmgandhi 18:6a4db94011d3 149 PendSV_Handler
sahilmgandhi 18:6a4db94011d3 150 SysTick_Handler
sahilmgandhi 18:6a4db94011d3 151 FLEX_INT0_IRQHandler
sahilmgandhi 18:6a4db94011d3 152 FLEX_INT1_IRQHandler
sahilmgandhi 18:6a4db94011d3 153 FLEX_INT2_IRQHandler
sahilmgandhi 18:6a4db94011d3 154 FLEX_INT3_IRQHandler
sahilmgandhi 18:6a4db94011d3 155 FLEX_INT4_IRQHandler
sahilmgandhi 18:6a4db94011d3 156 FLEX_INT5_IRQHandler
sahilmgandhi 18:6a4db94011d3 157 FLEX_INT6_IRQHandler
sahilmgandhi 18:6a4db94011d3 158 FLEX_INT7_IRQHandler
sahilmgandhi 18:6a4db94011d3 159 GINT0_IRQHandler
sahilmgandhi 18:6a4db94011d3 160 GINT1_IRQHandler
sahilmgandhi 18:6a4db94011d3 161 SSP1_IRQHandler
sahilmgandhi 18:6a4db94011d3 162 I2C_IRQHandler
sahilmgandhi 18:6a4db94011d3 163 CT16B0_IRQHandler
sahilmgandhi 18:6a4db94011d3 164 CT16B1_IRQHandler
sahilmgandhi 18:6a4db94011d3 165 CT32B0_IRQHandler
sahilmgandhi 18:6a4db94011d3 166 CT32B1_IRQHandler
sahilmgandhi 18:6a4db94011d3 167 SSP0_IRQHandler
sahilmgandhi 18:6a4db94011d3 168 USART_IRQHandler
sahilmgandhi 18:6a4db94011d3 169 USB_IRQHandler
sahilmgandhi 18:6a4db94011d3 170 USB_FIQHandler
sahilmgandhi 18:6a4db94011d3 171 ADC_IRQHandler
sahilmgandhi 18:6a4db94011d3 172 WWDT_IRQHandler
sahilmgandhi 18:6a4db94011d3 173 BOD_IRQHandler
sahilmgandhi 18:6a4db94011d3 174 USBWakeup_IRQHandler
sahilmgandhi 18:6a4db94011d3 175 Default_Handler
sahilmgandhi 18:6a4db94011d3 176 B Default_Handler
sahilmgandhi 18:6a4db94011d3 177
sahilmgandhi 18:6a4db94011d3 178 END