mbed library sources

Dependents:   frdm_kl05z_gpio_test

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Thu Nov 21 10:00:05 2013 +0000
Revision:
47:02833c62d054
Child:
66:64ad953ee6c3
Synchronized with git revision 6a5335a40ed97c7edd719e209bda5f3b5d9d997e

Full URL: https://github.com/mbedmicro/mbed/commit/6a5335a40ed97c7edd719e209bda5f3b5d9d997e/

Added sleep to LPC81x

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 47:02833c62d054 1 /* File: startup_ARMCM4.S
mbed_official 47:02833c62d054 2 * Purpose: startup file for Cortex-M4 devices. Should use with
mbed_official 47:02833c62d054 3 * GCC for ARM Embedded Processors
mbed_official 47:02833c62d054 4 * Version: V1.4
mbed_official 47:02833c62d054 5 * Date: 20 Dezember 2012
mbed_official 47:02833c62d054 6 *
mbed_official 47:02833c62d054 7 */
mbed_official 47:02833c62d054 8 /* Copyright (c) 2011 - 2012 ARM LIMITED
mbed_official 47:02833c62d054 9
mbed_official 47:02833c62d054 10 All rights reserved.
mbed_official 47:02833c62d054 11 Redistribution and use in source and binary forms, with or without
mbed_official 47:02833c62d054 12 modification, are permitted provided that the following conditions are met:
mbed_official 47:02833c62d054 13 - Redistributions of source code must retain the above copyright
mbed_official 47:02833c62d054 14 notice, this list of conditions and the following disclaimer.
mbed_official 47:02833c62d054 15 - Redistributions in binary form must reproduce the above copyright
mbed_official 47:02833c62d054 16 notice, this list of conditions and the following disclaimer in the
mbed_official 47:02833c62d054 17 documentation and/or other materials provided with the distribution.
mbed_official 47:02833c62d054 18 - Neither the name of ARM nor the names of its contributors may be used
mbed_official 47:02833c62d054 19 to endorse or promote products derived from this software without
mbed_official 47:02833c62d054 20 specific prior written permission.
mbed_official 47:02833c62d054 21 *
mbed_official 47:02833c62d054 22 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
mbed_official 47:02833c62d054 23 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
mbed_official 47:02833c62d054 24 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
mbed_official 47:02833c62d054 25 ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
mbed_official 47:02833c62d054 26 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
mbed_official 47:02833c62d054 27 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
mbed_official 47:02833c62d054 28 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
mbed_official 47:02833c62d054 29 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
mbed_official 47:02833c62d054 30 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
mbed_official 47:02833c62d054 31 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
mbed_official 47:02833c62d054 32 POSSIBILITY OF SUCH DAMAGE.
mbed_official 47:02833c62d054 33 ---------------------------------------------------------------------------*/
mbed_official 47:02833c62d054 34
mbed_official 47:02833c62d054 35
mbed_official 47:02833c62d054 36 .syntax unified
mbed_official 47:02833c62d054 37 .arch armv7-m
mbed_official 47:02833c62d054 38
mbed_official 47:02833c62d054 39 .section .stack
mbed_official 47:02833c62d054 40 .align 3
mbed_official 47:02833c62d054 41 .ifdef __STACK_SIZE
mbed_official 47:02833c62d054 42 .equ Stack_Size, __STACK_SIZE
mbed_official 47:02833c62d054 43 .else
mbed_official 47:02833c62d054 44 .equ Stack_Size, 0x00000400
mbed_official 47:02833c62d054 45 .endif
mbed_official 47:02833c62d054 46 .globl __StackTop
mbed_official 47:02833c62d054 47 .globl __StackLimit
mbed_official 47:02833c62d054 48 __StackLimit:
mbed_official 47:02833c62d054 49 .space Stack_Size
mbed_official 47:02833c62d054 50 .size __StackLimit, . - __StackLimit
mbed_official 47:02833c62d054 51 __StackTop:
mbed_official 47:02833c62d054 52 .size __StackTop, . - __StackTop
mbed_official 47:02833c62d054 53
mbed_official 47:02833c62d054 54 .section .heap
mbed_official 47:02833c62d054 55 .align 3
mbed_official 47:02833c62d054 56 .ifdef __HEAP_SIZE
mbed_official 47:02833c62d054 57 .equ Heap_Size, __HEAP_SIZE
mbed_official 47:02833c62d054 58 .else
mbed_official 47:02833c62d054 59 .equ Heap_Size, 0x00000C00
mbed_official 47:02833c62d054 60 .endif
mbed_official 47:02833c62d054 61 .globl __HeapBase
mbed_official 47:02833c62d054 62 .globl __HeapLimit
mbed_official 47:02833c62d054 63 __HeapBase:
mbed_official 47:02833c62d054 64 .if Heap_Size
mbed_official 47:02833c62d054 65 .space Heap_Size
mbed_official 47:02833c62d054 66 .endif
mbed_official 47:02833c62d054 67 .size __HeapBase, . - __HeapBase
mbed_official 47:02833c62d054 68 __HeapLimit:
mbed_official 47:02833c62d054 69 .size __HeapLimit, . - __HeapLimit
mbed_official 47:02833c62d054 70
mbed_official 47:02833c62d054 71 .section .isr_vector
mbed_official 47:02833c62d054 72 .align 2
mbed_official 47:02833c62d054 73 .globl __isr_vector
mbed_official 47:02833c62d054 74 __isr_vector:
mbed_official 47:02833c62d054 75 .long __StackTop /* Top of Stack */
mbed_official 47:02833c62d054 76 .long Reset_Handler /* Reset Handler */
mbed_official 47:02833c62d054 77 .long NMI_Handler /* NMI Handler */
mbed_official 47:02833c62d054 78 .long HardFault_Handler /* Hard Fault Handler */
mbed_official 47:02833c62d054 79 .long MemManage_Handler /* MPU Fault Handler */
mbed_official 47:02833c62d054 80 .long BusFault_Handler /* Bus Fault Handler */
mbed_official 47:02833c62d054 81 .long UsageFault_Handler /* Usage Fault Handler */
mbed_official 47:02833c62d054 82 .long 0 /* Reserved */
mbed_official 47:02833c62d054 83 .long 0 /* Reserved */
mbed_official 47:02833c62d054 84 .long 0 /* Reserved */
mbed_official 47:02833c62d054 85 .long 0 /* Reserved */
mbed_official 47:02833c62d054 86 .long SVC_Handler /* SVCall Handler */
mbed_official 47:02833c62d054 87 .long DebugMon_Handler /* Debug Monitor Handler */
mbed_official 47:02833c62d054 88 .long 0 /* Reserved */
mbed_official 47:02833c62d054 89 .long PendSV_Handler /* PendSV Handler */
mbed_official 47:02833c62d054 90 .long SysTick_Handler /* SysTick Handler */
mbed_official 47:02833c62d054 91
mbed_official 47:02833c62d054 92 /* External interrupts */
mbed_official 47:02833c62d054 93 .long DAC_IRQHandler /* 0: DAC */
mbed_official 47:02833c62d054 94 .long M0CORE_IRQHandler /* 1: M4-M0 communication */
mbed_official 47:02833c62d054 95 .long DMA_IRQHandler /* 2: - */
mbed_official 47:02833c62d054 96 .long 0 /* 3: Reserved */
mbed_official 47:02833c62d054 97 .long FLASHEEPROM_IRQHandler/* 4: ORed flash bank A/B, EEPROM int */
mbed_official 47:02833c62d054 98 .long ETHERNET_IRQHandler /* 5: Ethernet interrupt */
mbed_official 47:02833c62d054 99 .long SDIO_IRQHandler /* 6: SD/MMC interrupt */
mbed_official 47:02833c62d054 100 .long LCD_IRQHandler /* 7: - */
mbed_official 47:02833c62d054 101 .long USB0_IRQHandler /* 8: OTG interrupt */
mbed_official 47:02833c62d054 102 .long USB1_IRQHandler /* 9: - */
mbed_official 47:02833c62d054 103 .long SCT_IRQHandler /* 10: SCT combined interrupt */
mbed_official 47:02833c62d054 104 .long RITIMER_IRQHandler /* 11: - */
mbed_official 47:02833c62d054 105 .long TIMER0_IRQHandler /* 12: - */
mbed_official 47:02833c62d054 106 .long TIMER1_IRQHandler /* 13: - */
mbed_official 47:02833c62d054 107 .long TIMER2_IRQHandler /* 14: - */
mbed_official 47:02833c62d054 108 .long TIMER3_IRQHandler /* 15: - */
mbed_official 47:02833c62d054 109 .long MCPWM_IRQHandler /* 16: Motor control PWM */
mbed_official 47:02833c62d054 110 .long ADC0_IRQHandler /* 17: - */
mbed_official 47:02833c62d054 111 .long I2C0_IRQHandler /* 18: - */
mbed_official 47:02833c62d054 112 .long I2C1_IRQHandler /* 19: - */
mbed_official 47:02833c62d054 113 .long SPI_IRQHandler /* 20: - */
mbed_official 47:02833c62d054 114 .long ADC1_IRQHandler /* 21: - */
mbed_official 47:02833c62d054 115 .long SSP0_IRQHandler /* 22: - */
mbed_official 47:02833c62d054 116 .long SSP1_IRQHandler /* 23: - */
mbed_official 47:02833c62d054 117 .long USART0_IRQHandler /* 24: - */
mbed_official 47:02833c62d054 118 .long UART1_IRQHandler /* 25: Combined UART int w Modem int */
mbed_official 47:02833c62d054 119 .long USART2_IRQHandler /* 26: - */
mbed_official 47:02833c62d054 120 .long USART3_IRQHandler /* 27: combined USART int w IrDA int */
mbed_official 47:02833c62d054 121 .long I2S0_IRQHandler /* 28: - */
mbed_official 47:02833c62d054 122 .long I2S1_IRQHandler /* 29: - */
mbed_official 47:02833c62d054 123 .long SPIFI_IRQHandler /* 30: - */
mbed_official 47:02833c62d054 124 .long SGPIO_IRQHandler /* 31: - */
mbed_official 47:02833c62d054 125 .long PIN_INT0_IRQHandler /* 32: GPIO pin interrupt 0 */
mbed_official 47:02833c62d054 126 .long PIN_INT1_IRQHandler /* 33: GPIO pin interrupt 1 */
mbed_official 47:02833c62d054 127 .long PIN_INT2_IRQHandler /* 34: GPIO pin interrupt 2 */
mbed_official 47:02833c62d054 128 .long PIN_INT3_IRQHandler /* 35: GPIO pin interrupt 3 */
mbed_official 47:02833c62d054 129 .long PIN_INT4_IRQHandler /* 36: GPIO pin interrupt 4 */
mbed_official 47:02833c62d054 130 .long PIN_INT5_IRQHandler /* 37: GPIO pin interrupt 5 */
mbed_official 47:02833c62d054 131 .long PIN_INT6_IRQHandler /* 38: GPIO pin interrupt 6 */
mbed_official 47:02833c62d054 132 .long PIN_INT7_IRQHandler /* 39: GPIO pin interrupt 7 */
mbed_official 47:02833c62d054 133 .long GINT0_IRQHandler /* 40: GPIO global interrupt 0 */
mbed_official 47:02833c62d054 134 .long GINT1_IRQHandler /* 41: GPIO global interrupt 1 */
mbed_official 47:02833c62d054 135 .long EVENTROUTER_IRQHandler/* 42: Event router interrupt */
mbed_official 47:02833c62d054 136 .long C_CAN1_IRQHandler /* 43: - */
mbed_official 47:02833c62d054 137 .long 0 /* 44: Reserved */
mbed_official 47:02833c62d054 138 .long 0 /* 45: Reserved */
mbed_official 47:02833c62d054 139 .long ATIMER_IRQHandler /* 46: Alarm timer interuupt */
mbed_official 47:02833c62d054 140 .long RTC_IRQHandler /* 47: - */
mbed_official 47:02833c62d054 141 .long 0 /* 48: Reserved */
mbed_official 47:02833c62d054 142 .long WWDT_IRQHandler /* 49: - */
mbed_official 47:02833c62d054 143 .long 0 /* 50: Reserved */
mbed_official 47:02833c62d054 144 .long C_CAN0_IRQHandler /* 51: - */
mbed_official 47:02833c62d054 145 .long QEI_IRQHandler /* 52: - */
mbed_official 47:02833c62d054 146
mbed_official 47:02833c62d054 147 .size __isr_vector, . - __isr_vector
mbed_official 47:02833c62d054 148
mbed_official 47:02833c62d054 149 .text
mbed_official 47:02833c62d054 150 .thumb
mbed_official 47:02833c62d054 151 .thumb_func
mbed_official 47:02833c62d054 152 .align 2
mbed_official 47:02833c62d054 153 .globl Reset_Handler
mbed_official 47:02833c62d054 154 .type Reset_Handler, %function
mbed_official 47:02833c62d054 155 Reset_Handler:
mbed_official 47:02833c62d054 156 /* Loop to copy data from read only memory to RAM. The ranges
mbed_official 47:02833c62d054 157 * of copy from/to are specified by following symbols evaluated in
mbed_official 47:02833c62d054 158 * linker script.
mbed_official 47:02833c62d054 159 * __etext: End of code section, i.e., begin of data sections to copy from.
mbed_official 47:02833c62d054 160 * __data_start__/__data_end__: RAM address range that data should be
mbed_official 47:02833c62d054 161 * copied to. Both must be aligned to 4 bytes boundary. */
mbed_official 47:02833c62d054 162
mbed_official 47:02833c62d054 163 ldr r1, =__etext
mbed_official 47:02833c62d054 164 ldr r2, =__data_start__
mbed_official 47:02833c62d054 165 ldr r3, =__data_end__
mbed_official 47:02833c62d054 166
mbed_official 47:02833c62d054 167 .if 1
mbed_official 47:02833c62d054 168 /* Here are two copies of loop implemenations. First one favors code size
mbed_official 47:02833c62d054 169 * and the second one favors performance. Default uses the first one.
mbed_official 47:02833c62d054 170 * Change to "#if 0" to use the second one */
mbed_official 47:02833c62d054 171 .LC0:
mbed_official 47:02833c62d054 172 cmp r2, r3
mbed_official 47:02833c62d054 173 ittt lt
mbed_official 47:02833c62d054 174 ldrlt r0, [r1], #4
mbed_official 47:02833c62d054 175 strlt r0, [r2], #4
mbed_official 47:02833c62d054 176 blt .LC0
mbed_official 47:02833c62d054 177 .else
mbed_official 47:02833c62d054 178 subs r3, r2
mbed_official 47:02833c62d054 179 ble .LC1
mbed_official 47:02833c62d054 180 .LC0:
mbed_official 47:02833c62d054 181 subs r3, #4
mbed_official 47:02833c62d054 182 ldr r0, [r1, r3]
mbed_official 47:02833c62d054 183 str r0, [r2, r3]
mbed_official 47:02833c62d054 184 bgt .LC0
mbed_official 47:02833c62d054 185 .LC1:
mbed_official 47:02833c62d054 186 .endif
mbed_official 47:02833c62d054 187
mbed_official 47:02833c62d054 188 .ifdef __STARTUP_CLEAR_BSS
mbed_official 47:02833c62d054 189 /* This part of work usually is done in C library startup code. Otherwise,
mbed_official 47:02833c62d054 190 * define this macro to enable it in this startup.
mbed_official 47:02833c62d054 191 *
mbed_official 47:02833c62d054 192 * Loop to zero out BSS section, which uses following symbols
mbed_official 47:02833c62d054 193 * in linker script:
mbed_official 47:02833c62d054 194 * __bss_start__: start of BSS section. Must align to 4
mbed_official 47:02833c62d054 195 * __bss_end__: end of BSS section. Must align to 4
mbed_official 47:02833c62d054 196 */
mbed_official 47:02833c62d054 197 ldr r1, =__bss_start__
mbed_official 47:02833c62d054 198 ldr r2, =__bss_end__
mbed_official 47:02833c62d054 199
mbed_official 47:02833c62d054 200 movs r0, 0
mbed_official 47:02833c62d054 201 .LC2:
mbed_official 47:02833c62d054 202 cmp r1, r2
mbed_official 47:02833c62d054 203 itt lt
mbed_official 47:02833c62d054 204 strlt r0, [r1], #4
mbed_official 47:02833c62d054 205 blt .LC2
mbed_official 47:02833c62d054 206 .endif /* __STARTUP_CLEAR_BSS */
mbed_official 47:02833c62d054 207
mbed_official 47:02833c62d054 208 .ifndef __NO_SYSTEM_INIT
mbed_official 47:02833c62d054 209 bl SystemInit
mbed_official 47:02833c62d054 210 .endif
mbed_official 47:02833c62d054 211
mbed_official 47:02833c62d054 212 .ifndef __START
mbed_official 47:02833c62d054 213 .set __START,_start
mbed_official 47:02833c62d054 214 .endif
mbed_official 47:02833c62d054 215 bl __START
mbed_official 47:02833c62d054 216 .pool
mbed_official 47:02833c62d054 217 .size Reset_Handler, . - Reset_Handler
mbed_official 47:02833c62d054 218
mbed_official 47:02833c62d054 219 /* Macro to define default handlers. Default handler
mbed_official 47:02833c62d054 220 * will be weak symbol and just dead loops. They can be
mbed_official 47:02833c62d054 221 * overwritten by other handlers */
mbed_official 47:02833c62d054 222 .macro def_irq_handler handler_name
mbed_official 47:02833c62d054 223 .align 1
mbed_official 47:02833c62d054 224 .thumb_func
mbed_official 47:02833c62d054 225 .weak \handler_name
mbed_official 47:02833c62d054 226 .type \handler_name, %function
mbed_official 47:02833c62d054 227 \handler_name :
mbed_official 47:02833c62d054 228 b .
mbed_official 47:02833c62d054 229 .size \handler_name, . - \handler_name
mbed_official 47:02833c62d054 230 .endm
mbed_official 47:02833c62d054 231
mbed_official 47:02833c62d054 232 def_irq_handler NMI_Handler
mbed_official 47:02833c62d054 233 def_irq_handler HardFault_Handler
mbed_official 47:02833c62d054 234 def_irq_handler MemManage_Handler
mbed_official 47:02833c62d054 235 def_irq_handler BusFault_Handler
mbed_official 47:02833c62d054 236 def_irq_handler UsageFault_Handler
mbed_official 47:02833c62d054 237 def_irq_handler SVC_Handler
mbed_official 47:02833c62d054 238 def_irq_handler DebugMon_Handler
mbed_official 47:02833c62d054 239 def_irq_handler PendSV_Handler
mbed_official 47:02833c62d054 240 def_irq_handler SysTick_Handler
mbed_official 47:02833c62d054 241 def_irq_handler Default_Handler
mbed_official 47:02833c62d054 242
mbed_official 47:02833c62d054 243 def_irq_handler DAC_IRQHandler
mbed_official 47:02833c62d054 244 def_irq_handler M0CORE_IRQHandler
mbed_official 47:02833c62d054 245 def_irq_handler DMA_IRQHandler
mbed_official 47:02833c62d054 246 def_irq_handler FLASHEEPROM_IRQHandler
mbed_official 47:02833c62d054 247 def_irq_handler ETHERNET_IRQHandler
mbed_official 47:02833c62d054 248 def_irq_handler SDIO_IRQHandler
mbed_official 47:02833c62d054 249 def_irq_handler LCD_IRQHandler
mbed_official 47:02833c62d054 250 def_irq_handler USB0_IRQHandler
mbed_official 47:02833c62d054 251 def_irq_handler USB1_IRQHandler
mbed_official 47:02833c62d054 252 def_irq_handler SCT_IRQHandler
mbed_official 47:02833c62d054 253 def_irq_handler RITIMER_IRQHandler
mbed_official 47:02833c62d054 254 def_irq_handler TIMER0_IRQHandler
mbed_official 47:02833c62d054 255 def_irq_handler TIMER1_IRQHandler
mbed_official 47:02833c62d054 256 def_irq_handler TIMER2_IRQHandler
mbed_official 47:02833c62d054 257 def_irq_handler TIMER3_IRQHandler
mbed_official 47:02833c62d054 258 def_irq_handler MCPWM_IRQHandler
mbed_official 47:02833c62d054 259 def_irq_handler ADC0_IRQHandler
mbed_official 47:02833c62d054 260 def_irq_handler I2C0_IRQHandler
mbed_official 47:02833c62d054 261 def_irq_handler I2C1_IRQHandler
mbed_official 47:02833c62d054 262 def_irq_handler SPI_IRQHandler
mbed_official 47:02833c62d054 263 def_irq_handler ADC1_IRQHandler
mbed_official 47:02833c62d054 264 def_irq_handler SSP0_IRQHandler
mbed_official 47:02833c62d054 265 def_irq_handler SSP1_IRQHandler
mbed_official 47:02833c62d054 266 def_irq_handler USART0_IRQHandler
mbed_official 47:02833c62d054 267 def_irq_handler UART1_IRQHandler
mbed_official 47:02833c62d054 268 def_irq_handler USART2_IRQHandler
mbed_official 47:02833c62d054 269 def_irq_handler USART3_IRQHandler
mbed_official 47:02833c62d054 270 def_irq_handler I2S0_IRQHandler
mbed_official 47:02833c62d054 271 def_irq_handler I2S1_IRQHandler
mbed_official 47:02833c62d054 272 def_irq_handler SPIFI_IRQHandler
mbed_official 47:02833c62d054 273 def_irq_handler SGPIO_IRQHandler
mbed_official 47:02833c62d054 274 def_irq_handler PIN_INT0_IRQHandler
mbed_official 47:02833c62d054 275 def_irq_handler PIN_INT1_IRQHandler
mbed_official 47:02833c62d054 276 def_irq_handler PIN_INT2_IRQHandler
mbed_official 47:02833c62d054 277 def_irq_handler PIN_INT3_IRQHandler
mbed_official 47:02833c62d054 278 def_irq_handler PIN_INT4_IRQHandler
mbed_official 47:02833c62d054 279 def_irq_handler PIN_INT5_IRQHandler
mbed_official 47:02833c62d054 280 def_irq_handler PIN_INT6_IRQHandler
mbed_official 47:02833c62d054 281 def_irq_handler PIN_INT7_IRQHandler
mbed_official 47:02833c62d054 282 def_irq_handler GINT0_IRQHandler
mbed_official 47:02833c62d054 283 def_irq_handler GINT1_IRQHandler
mbed_official 47:02833c62d054 284 def_irq_handler EVENTROUTER_IRQHandler
mbed_official 47:02833c62d054 285 def_irq_handler C_CAN1_IRQHandler
mbed_official 47:02833c62d054 286 def_irq_handler ATIMER_IRQHandler
mbed_official 47:02833c62d054 287 def_irq_handler RTC_IRQHandler
mbed_official 47:02833c62d054 288 def_irq_handler WWDT_IRQHandler
mbed_official 47:02833c62d054 289 def_irq_handler C_CAN0_IRQHandler
mbed_official 47:02833c62d054 290 def_irq_handler QEI_IRQHandler
mbed_official 47:02833c62d054 291
mbed_official 47:02833c62d054 292 .end