| 1 | /*********************************************************************
|
|---|
| 2 | * SEGGER Microcontroller GmbH *
|
|---|
| 3 | * The Embedded Experts *
|
|---|
| 4 | **********************************************************************
|
|---|
| 5 | * *
|
|---|
| 6 | * (c) 2014 - 2024 SEGGER Microcontroller GmbH *
|
|---|
| 7 | * *
|
|---|
| 8 | * www.segger.com Support: support@segger.com *
|
|---|
| 9 | * *
|
|---|
| 10 | **********************************************************************
|
|---|
| 11 | * *
|
|---|
| 12 | * All rights reserved. *
|
|---|
| 13 | * *
|
|---|
| 14 | * Redistribution and use in source and binary forms, with or *
|
|---|
| 15 | * without modification, are permitted provided that the following *
|
|---|
| 16 | * condition is met: *
|
|---|
| 17 | * *
|
|---|
| 18 | * - Redistributions of source code must retain the above copyright *
|
|---|
| 19 | * notice, this condition and the following disclaimer. *
|
|---|
| 20 | * *
|
|---|
| 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
|
|---|
| 22 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, *
|
|---|
| 23 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *
|
|---|
| 24 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
|
|---|
| 25 | * DISCLAIMED. IN NO EVENT SHALL SEGGER Microcontroller BE LIABLE FOR *
|
|---|
| 26 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR *
|
|---|
| 27 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT *
|
|---|
| 28 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
|
|---|
| 29 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
|
|---|
| 30 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
|
|---|
| 31 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE *
|
|---|
| 32 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH *
|
|---|
| 33 | * DAMAGE. *
|
|---|
| 34 | * *
|
|---|
| 35 | **********************************************************************
|
|---|
| 36 |
|
|---|
| 37 | -------------------------- END-OF-HEADER -----------------------------
|
|---|
| 38 |
|
|---|
| 39 | File : stm32c031xx_Vectors.s
|
|---|
| 40 | Purpose : Exception and interrupt vectors for stm32c031xx devices.
|
|---|
| 41 |
|
|---|
| 42 | Additional information:
|
|---|
| 43 | Preprocessor Definitions
|
|---|
| 44 | __NO_EXTERNAL_INTERRUPTS
|
|---|
| 45 | If defined,
|
|---|
| 46 | the vector table will contain only the internal exceptions
|
|---|
| 47 | and interrupts.
|
|---|
| 48 | __VECTORS_IN_RAM
|
|---|
| 49 | If defined,
|
|---|
| 50 | an area of RAM, large enough to store the vector table,
|
|---|
| 51 | will be reserved.
|
|---|
| 52 |
|
|---|
| 53 | __OPTIMIZATION_SMALL
|
|---|
| 54 | If defined,
|
|---|
| 55 | all weak definitions of interrupt handlers will share the
|
|---|
| 56 | same implementation.
|
|---|
| 57 | If not defined,
|
|---|
| 58 | all weak definitions of interrupt handlers will be defined
|
|---|
| 59 | with their own implementation.
|
|---|
| 60 | */
|
|---|
| 61 | .syntax unified
|
|---|
| 62 |
|
|---|
| 63 | /*********************************************************************
|
|---|
| 64 | *
|
|---|
| 65 | * Macros
|
|---|
| 66 | *
|
|---|
| 67 | **********************************************************************
|
|---|
| 68 | */
|
|---|
| 69 |
|
|---|
| 70 | //
|
|---|
| 71 | // Directly place a vector (word) in the vector table
|
|---|
| 72 | //
|
|---|
| 73 | .macro VECTOR Name=
|
|---|
| 74 | .section .vectors, "ax"
|
|---|
| 75 | .code 16
|
|---|
| 76 | .word \Name
|
|---|
| 77 | .endm
|
|---|
| 78 |
|
|---|
| 79 | //
|
|---|
| 80 | // Declare an exception handler with a weak definition
|
|---|
| 81 | //
|
|---|
| 82 | .macro EXC_HANDLER Name=
|
|---|
| 83 | //
|
|---|
| 84 | // Insert vector in vector table
|
|---|
| 85 | //
|
|---|
| 86 | .section .vectors, "ax"
|
|---|
| 87 | .word \Name
|
|---|
| 88 | //
|
|---|
| 89 | // Insert dummy handler in init section
|
|---|
| 90 | //
|
|---|
| 91 | .section .init.\Name, "ax"
|
|---|
| 92 | .thumb_func
|
|---|
| 93 | .weak \Name
|
|---|
| 94 | .balign 2
|
|---|
| 95 | \Name:
|
|---|
| 96 | 1: b 1b // Endless loop
|
|---|
| 97 | .endm
|
|---|
| 98 |
|
|---|
| 99 | //
|
|---|
| 100 | // Declare an interrupt handler with a weak definition
|
|---|
| 101 | //
|
|---|
| 102 | .macro ISR_HANDLER Name=
|
|---|
| 103 | //
|
|---|
| 104 | // Insert vector in vector table
|
|---|
| 105 | //
|
|---|
| 106 | .section .vectors, "ax"
|
|---|
| 107 | .word \Name
|
|---|
| 108 | //
|
|---|
| 109 | // Insert dummy handler in init section
|
|---|
| 110 | //
|
|---|
| 111 | #if defined(__OPTIMIZATION_SMALL)
|
|---|
| 112 | .section .init, "ax"
|
|---|
| 113 | .weak \Name
|
|---|
| 114 | .thumb_set \Name,Dummy_Handler
|
|---|
| 115 | #else
|
|---|
| 116 | .section .init.\Name, "ax"
|
|---|
| 117 | .thumb_func
|
|---|
| 118 | .weak \Name
|
|---|
| 119 | .balign 2
|
|---|
| 120 | \Name:
|
|---|
| 121 | 1: b 1b // Endless loop
|
|---|
| 122 | #endif
|
|---|
| 123 | .endm
|
|---|
| 124 |
|
|---|
| 125 | //
|
|---|
| 126 | // Place a reserved vector in vector table
|
|---|
| 127 | //
|
|---|
| 128 | .macro ISR_RESERVED
|
|---|
| 129 | .section .vectors, "ax"
|
|---|
| 130 | .word 0
|
|---|
| 131 | .endm
|
|---|
| 132 |
|
|---|
| 133 | //
|
|---|
| 134 | // Place a reserved vector in vector table
|
|---|
| 135 | //
|
|---|
| 136 | .macro ISR_RESERVED_DUMMY
|
|---|
| 137 | .section .vectors, "ax"
|
|---|
| 138 | .word Dummy_Handler
|
|---|
| 139 | .endm
|
|---|
| 140 |
|
|---|
| 141 | /*********************************************************************
|
|---|
| 142 | *
|
|---|
| 143 | * Externals
|
|---|
| 144 | *
|
|---|
| 145 | **********************************************************************
|
|---|
| 146 | */
|
|---|
| 147 | .extern __stack_end__
|
|---|
| 148 | .extern Reset_Handler
|
|---|
| 149 | .extern HardFault_Handler
|
|---|
| 150 |
|
|---|
| 151 | /*********************************************************************
|
|---|
| 152 | *
|
|---|
| 153 | * Global functions
|
|---|
| 154 | *
|
|---|
| 155 | **********************************************************************
|
|---|
| 156 | */
|
|---|
| 157 |
|
|---|
| 158 | /*********************************************************************
|
|---|
| 159 | *
|
|---|
| 160 | * Setup of the vector table and weak definition of interrupt handlers
|
|---|
| 161 | *
|
|---|
| 162 | */
|
|---|
| 163 | .section .vectors, "ax"
|
|---|
| 164 | .code 16
|
|---|
| 165 | .balign 256
|
|---|
| 166 | .global _vectors
|
|---|
| 167 | _vectors:
|
|---|
| 168 | //
|
|---|
| 169 | // Internal exceptions and interrupts
|
|---|
| 170 | //
|
|---|
| 171 | VECTOR __stack_end__
|
|---|
| 172 | VECTOR Reset_Handler
|
|---|
| 173 | EXC_HANDLER NMI_Handler
|
|---|
| 174 | VECTOR HardFault_Handler
|
|---|
| 175 | #ifdef __ARM_ARCH_6M__
|
|---|
| 176 | ISR_RESERVED
|
|---|
| 177 | ISR_RESERVED
|
|---|
| 178 | ISR_RESERVED
|
|---|
| 179 | #else
|
|---|
| 180 | EXC_HANDLER MemManage_Handler
|
|---|
| 181 | EXC_HANDLER BusFault_Handler
|
|---|
| 182 | EXC_HANDLER UsageFault_Handler
|
|---|
| 183 | #endif
|
|---|
| 184 | ISR_RESERVED
|
|---|
| 185 | ISR_RESERVED
|
|---|
| 186 | ISR_RESERVED
|
|---|
| 187 | ISR_RESERVED
|
|---|
| 188 | EXC_HANDLER SVC_Handler
|
|---|
| 189 | #ifdef __ARM_ARCH_6M__
|
|---|
| 190 | ISR_RESERVED
|
|---|
| 191 | #else
|
|---|
| 192 | EXC_HANDLER DebugMon_Handler
|
|---|
| 193 | #endif
|
|---|
| 194 | ISR_RESERVED
|
|---|
| 195 | EXC_HANDLER PendSV_Handler
|
|---|
| 196 | EXC_HANDLER SysTick_Handler
|
|---|
| 197 | //
|
|---|
| 198 | // External interrupts
|
|---|
| 199 | //
|
|---|
| 200 | #ifndef __NO_EXTERNAL_INTERRUPTS
|
|---|
| 201 | ISR_HANDLER WWDG_IRQHandler
|
|---|
| 202 | ISR_RESERVED
|
|---|
| 203 | ISR_HANDLER RTC_IRQHandler
|
|---|
| 204 | ISR_HANDLER FLASH_IRQHandler
|
|---|
| 205 | ISR_HANDLER RCC_IRQHandler
|
|---|
| 206 | ISR_HANDLER EXTI0_1_IRQHandler
|
|---|
| 207 | ISR_HANDLER EXTI2_3_IRQHandler
|
|---|
| 208 | ISR_HANDLER EXTI4_15_IRQHandler
|
|---|
| 209 | ISR_RESERVED
|
|---|
| 210 | ISR_HANDLER DMA1_Channel1_IRQHandler
|
|---|
| 211 | ISR_HANDLER DMA1_Channel2_3_IRQHandler
|
|---|
| 212 | ISR_HANDLER DMAMUX1_IRQHandler
|
|---|
| 213 | ISR_HANDLER ADC1_IRQHandler
|
|---|
| 214 | ISR_HANDLER TIM1_BRK_UP_TRG_COM_IRQHandler
|
|---|
| 215 | ISR_HANDLER TIM1_CC_IRQHandler
|
|---|
| 216 | ISR_RESERVED
|
|---|
| 217 | ISR_HANDLER TIM3_IRQHandler
|
|---|
| 218 | ISR_RESERVED
|
|---|
| 219 | ISR_RESERVED
|
|---|
| 220 | ISR_HANDLER TIM14_IRQHandler
|
|---|
| 221 | ISR_RESERVED
|
|---|
| 222 | ISR_HANDLER TIM16_IRQHandler
|
|---|
| 223 | ISR_HANDLER TIM17_IRQHandler
|
|---|
| 224 | ISR_HANDLER I2C1_IRQHandler
|
|---|
| 225 | ISR_RESERVED
|
|---|
| 226 | ISR_HANDLER SPI1_IRQHandler
|
|---|
| 227 | ISR_RESERVED
|
|---|
| 228 | ISR_HANDLER USART1_IRQHandler
|
|---|
| 229 | ISR_HANDLER USART2_IRQHandler
|
|---|
| 230 | #endif
|
|---|
| 231 | //
|
|---|
| 232 | .section .vectors, "ax"
|
|---|
| 233 | _vectors_end:
|
|---|
| 234 |
|
|---|
| 235 | #ifdef __VECTORS_IN_RAM
|
|---|
| 236 | //
|
|---|
| 237 | // Reserve space with the size of the vector table
|
|---|
| 238 | // in the designated RAM section.
|
|---|
| 239 | //
|
|---|
| 240 | .section .vectors_ram, "ax"
|
|---|
| 241 | .balign 256
|
|---|
| 242 | .global _vectors_ram
|
|---|
| 243 |
|
|---|
| 244 | _vectors_ram:
|
|---|
| 245 | .space _vectors_end - _vectors, 0
|
|---|
| 246 | #endif
|
|---|
| 247 |
|
|---|
| 248 | /*********************************************************************
|
|---|
| 249 | *
|
|---|
| 250 | * Dummy handler to be used for reserved interrupt vectors
|
|---|
| 251 | * and weak implementation of interrupts.
|
|---|
| 252 | *
|
|---|
| 253 | */
|
|---|
| 254 | .section .init.Dummy_Handler, "ax"
|
|---|
| 255 | .thumb_func
|
|---|
| 256 | .weak Dummy_Handler
|
|---|
| 257 | .balign 2
|
|---|
| 258 | Dummy_Handler:
|
|---|
| 259 | 1: b 1b // Endless loop
|
|---|
| 260 |
|
|---|
| 261 |
|
|---|
| 262 | /*************************** End of file ****************************/
|
|---|