mbed library sources
Dependents: frdm_kl05z_gpio_test
Fork of mbed-src by
targets/cmsis/TARGET_Freescale/TARGET_KLXX/TARGET_KL25Z/TOOLCHAIN_GCC_CW_NEWLIB/startup_MKL25Z4.s@82:0b31dbcd4769, 2014-01-31 (annotated)
- Committer:
- mbed_official
- Date:
- Fri Jan 31 10:00:06 2014 +0000
- Revision:
- 82:0b31dbcd4769
Synchronized with git revision 74409cbd593d1daab530a57baaa563f30b04b018
Full URL: https://github.com/mbedmicro/mbed/commit/74409cbd593d1daab530a57baaa563f30b04b018/
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 82:0b31dbcd4769 | 1 | /* File: startup_ARMCM0.S |
mbed_official | 82:0b31dbcd4769 | 2 | * Purpose: startup file for Cortex-M0 devices. Should use with |
mbed_official | 82:0b31dbcd4769 | 3 | * GCC for ARM Embedded Processors |
mbed_official | 82:0b31dbcd4769 | 4 | * Version: V1.2 |
mbed_official | 82:0b31dbcd4769 | 5 | * Date: 15 Nov 2011 |
mbed_official | 82:0b31dbcd4769 | 6 | * |
mbed_official | 82:0b31dbcd4769 | 7 | * Copyright (c) 2011, ARM Limited |
mbed_official | 82:0b31dbcd4769 | 8 | * All rights reserved. |
mbed_official | 82:0b31dbcd4769 | 9 | * |
mbed_official | 82:0b31dbcd4769 | 10 | * Redistribution and use in source and binary forms, with or without |
mbed_official | 82:0b31dbcd4769 | 11 | * modification, are permitted provided that the following conditions are met: |
mbed_official | 82:0b31dbcd4769 | 12 | * Redistributions of source code must retain the above copyright |
mbed_official | 82:0b31dbcd4769 | 13 | notice, this list of conditions and the following disclaimer. |
mbed_official | 82:0b31dbcd4769 | 14 | * Redistributions in binary form must reproduce the above copyright |
mbed_official | 82:0b31dbcd4769 | 15 | notice, this list of conditions and the following disclaimer in the |
mbed_official | 82:0b31dbcd4769 | 16 | documentation and/or other materials provided with the distribution. |
mbed_official | 82:0b31dbcd4769 | 17 | * Neither the name of the ARM Limited nor the |
mbed_official | 82:0b31dbcd4769 | 18 | names of its contributors may be used to endorse or promote products |
mbed_official | 82:0b31dbcd4769 | 19 | derived from this software without specific prior written permission. |
mbed_official | 82:0b31dbcd4769 | 20 | * |
mbed_official | 82:0b31dbcd4769 | 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
mbed_official | 82:0b31dbcd4769 | 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
mbed_official | 82:0b31dbcd4769 | 23 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
mbed_official | 82:0b31dbcd4769 | 24 | * DISCLAIMED. IN NO EVENT SHALL ARM LIMITED BE LIABLE FOR ANY |
mbed_official | 82:0b31dbcd4769 | 25 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
mbed_official | 82:0b31dbcd4769 | 26 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
mbed_official | 82:0b31dbcd4769 | 27 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
mbed_official | 82:0b31dbcd4769 | 28 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
mbed_official | 82:0b31dbcd4769 | 29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
mbed_official | 82:0b31dbcd4769 | 30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
mbed_official | 82:0b31dbcd4769 | 31 | */ |
mbed_official | 82:0b31dbcd4769 | 32 | .syntax unified |
mbed_official | 82:0b31dbcd4769 | 33 | .arch armv6-m |
mbed_official | 82:0b31dbcd4769 | 34 | |
mbed_official | 82:0b31dbcd4769 | 35 | /* Memory Model |
mbed_official | 82:0b31dbcd4769 | 36 | The HEAP starts at the end of the DATA section and grows upward. |
mbed_official | 82:0b31dbcd4769 | 37 | |
mbed_official | 82:0b31dbcd4769 | 38 | The STACK starts at the end of the RAM and grows downward. |
mbed_official | 82:0b31dbcd4769 | 39 | |
mbed_official | 82:0b31dbcd4769 | 40 | The HEAP and stack STACK are only checked at compile time: |
mbed_official | 82:0b31dbcd4769 | 41 | (DATA_SIZE + HEAP_SIZE + STACK_SIZE) < RAM_SIZE |
mbed_official | 82:0b31dbcd4769 | 42 | |
mbed_official | 82:0b31dbcd4769 | 43 | This is just a check for the bare minimum for the Heap+Stack area before |
mbed_official | 82:0b31dbcd4769 | 44 | aborting compilation, it is not the run time limit: |
mbed_official | 82:0b31dbcd4769 | 45 | Heap_Size + Stack_Size = 0x80 + 0x80 = 0x100 |
mbed_official | 82:0b31dbcd4769 | 46 | */ |
mbed_official | 82:0b31dbcd4769 | 47 | .section .stack |
mbed_official | 82:0b31dbcd4769 | 48 | .align 3 |
mbed_official | 82:0b31dbcd4769 | 49 | #ifdef __STACK_SIZE |
mbed_official | 82:0b31dbcd4769 | 50 | .equ Stack_Size, __STACK_SIZE |
mbed_official | 82:0b31dbcd4769 | 51 | #else |
mbed_official | 82:0b31dbcd4769 | 52 | .equ Stack_Size, 0x80 |
mbed_official | 82:0b31dbcd4769 | 53 | #endif |
mbed_official | 82:0b31dbcd4769 | 54 | .globl __StackTop |
mbed_official | 82:0b31dbcd4769 | 55 | .globl __StackLimit |
mbed_official | 82:0b31dbcd4769 | 56 | __StackLimit: |
mbed_official | 82:0b31dbcd4769 | 57 | .space Stack_Size |
mbed_official | 82:0b31dbcd4769 | 58 | .size __StackLimit, . - __StackLimit |
mbed_official | 82:0b31dbcd4769 | 59 | __StackTop: |
mbed_official | 82:0b31dbcd4769 | 60 | .size __StackTop, . - __StackTop |
mbed_official | 82:0b31dbcd4769 | 61 | |
mbed_official | 82:0b31dbcd4769 | 62 | .section .heap |
mbed_official | 82:0b31dbcd4769 | 63 | .align 3 |
mbed_official | 82:0b31dbcd4769 | 64 | #ifdef __HEAP_SIZE |
mbed_official | 82:0b31dbcd4769 | 65 | .equ Heap_Size, __HEAP_SIZE |
mbed_official | 82:0b31dbcd4769 | 66 | #else |
mbed_official | 82:0b31dbcd4769 | 67 | .equ Heap_Size, 0x80 |
mbed_official | 82:0b31dbcd4769 | 68 | #endif |
mbed_official | 82:0b31dbcd4769 | 69 | .globl __HeapBase |
mbed_official | 82:0b31dbcd4769 | 70 | .globl __HeapLimit |
mbed_official | 82:0b31dbcd4769 | 71 | __HeapBase: |
mbed_official | 82:0b31dbcd4769 | 72 | .space Heap_Size |
mbed_official | 82:0b31dbcd4769 | 73 | .size __HeapBase, . - __HeapBase |
mbed_official | 82:0b31dbcd4769 | 74 | __HeapLimit: |
mbed_official | 82:0b31dbcd4769 | 75 | .size __HeapLimit, . - __HeapLimit |
mbed_official | 82:0b31dbcd4769 | 76 | |
mbed_official | 82:0b31dbcd4769 | 77 | .section .isr_vector |
mbed_official | 82:0b31dbcd4769 | 78 | .align 2 |
mbed_official | 82:0b31dbcd4769 | 79 | .globl __isr_vector |
mbed_official | 82:0b31dbcd4769 | 80 | __isr_vector: |
mbed_official | 82:0b31dbcd4769 | 81 | .long __StackTop /* Top of Stack */ |
mbed_official | 82:0b31dbcd4769 | 82 | .long Reset_Handler /* Reset Handler */ |
mbed_official | 82:0b31dbcd4769 | 83 | .long NMI_Handler /* NMI Handler */ |
mbed_official | 82:0b31dbcd4769 | 84 | .long HardFault_Handler /* Hard Fault Handler */ |
mbed_official | 82:0b31dbcd4769 | 85 | .long 0 /* Reserved */ |
mbed_official | 82:0b31dbcd4769 | 86 | .long 0 /* Reserved */ |
mbed_official | 82:0b31dbcd4769 | 87 | .long 0 /* Reserved */ |
mbed_official | 82:0b31dbcd4769 | 88 | .long 0 /* Reserved */ |
mbed_official | 82:0b31dbcd4769 | 89 | .long 0 /* Reserved */ |
mbed_official | 82:0b31dbcd4769 | 90 | .long 0 /* Reserved */ |
mbed_official | 82:0b31dbcd4769 | 91 | .long 0 /* Reserved */ |
mbed_official | 82:0b31dbcd4769 | 92 | .long SVC_Handler /* SVCall Handler */ |
mbed_official | 82:0b31dbcd4769 | 93 | .long 0 /* Reserved */ |
mbed_official | 82:0b31dbcd4769 | 94 | .long 0 /* Reserved */ |
mbed_official | 82:0b31dbcd4769 | 95 | .long PendSV_Handler /* PendSV Handler */ |
mbed_official | 82:0b31dbcd4769 | 96 | .long SysTick_Handler /* SysTick Handler */ |
mbed_official | 82:0b31dbcd4769 | 97 | |
mbed_official | 82:0b31dbcd4769 | 98 | /* External interrupts */ |
mbed_official | 82:0b31dbcd4769 | 99 | .long DMA0_IRQHandler /* DMA channel 0 transfer complete interrupt */ |
mbed_official | 82:0b31dbcd4769 | 100 | .long DMA1_IRQHandler /* DMA channel 1 transfer complete interrupt */ |
mbed_official | 82:0b31dbcd4769 | 101 | .long DMA2_IRQHandler /* DMA channel 2 transfer complete interrupt */ |
mbed_official | 82:0b31dbcd4769 | 102 | .long DMA3_IRQHandler /* DMA channel 3 transfer complete interrupt */ |
mbed_official | 82:0b31dbcd4769 | 103 | .long Reserved20_IRQHandler /* Reserved interrupt 20 */ |
mbed_official | 82:0b31dbcd4769 | 104 | .long FTFA_IRQHandler /* FTFA interrupt */ |
mbed_official | 82:0b31dbcd4769 | 105 | .long LVD_LVW_IRQHandler /* Low Voltage Detect, Low Voltage Warning */ |
mbed_official | 82:0b31dbcd4769 | 106 | .long LLW_IRQHandler /* Low Leakage Wakeup */ |
mbed_official | 82:0b31dbcd4769 | 107 | .long I2C0_IRQHandler /* I2C0 interrupt */ |
mbed_official | 82:0b31dbcd4769 | 108 | .long I2C1_IRQHandler /* I2C0 interrupt 25 */ |
mbed_official | 82:0b31dbcd4769 | 109 | .long SPI0_IRQHandler /* SPI0 interrupt */ |
mbed_official | 82:0b31dbcd4769 | 110 | .long SPI1_IRQHandler /* SPI1 interrupt */ |
mbed_official | 82:0b31dbcd4769 | 111 | .long UART0_IRQHandler /* UART0 status/error interrupt */ |
mbed_official | 82:0b31dbcd4769 | 112 | .long UART1_IRQHandler /* UART1 status/error interrupt */ |
mbed_official | 82:0b31dbcd4769 | 113 | .long UART2_IRQHandler /* UART2 status/error interrupt */ |
mbed_official | 82:0b31dbcd4769 | 114 | .long ADC0_IRQHandler /* ADC0 interrupt */ |
mbed_official | 82:0b31dbcd4769 | 115 | .long CMP0_IRQHandler /* CMP0 interrupt */ |
mbed_official | 82:0b31dbcd4769 | 116 | .long TPM0_IRQHandler /* TPM0 fault, overflow and channels interrupt */ |
mbed_official | 82:0b31dbcd4769 | 117 | .long TPM1_IRQHandler /* TPM1 fault, overflow and channels interrupt */ |
mbed_official | 82:0b31dbcd4769 | 118 | .long TPM2_IRQHandler /* TPM2 fault, overflow and channels interrupt */ |
mbed_official | 82:0b31dbcd4769 | 119 | .long RTC_IRQHandler /* RTC interrupt */ |
mbed_official | 82:0b31dbcd4769 | 120 | .long RTC_Seconds_IRQHandler /* RTC seconds interrupt */ |
mbed_official | 82:0b31dbcd4769 | 121 | .long PIT_IRQHandler /* PIT timer interrupt */ |
mbed_official | 82:0b31dbcd4769 | 122 | .long Reserved39_IRQHandler /* Reserved interrupt 39 */ |
mbed_official | 82:0b31dbcd4769 | 123 | .long USB0_IRQHandler /* USB0 interrupt */ |
mbed_official | 82:0b31dbcd4769 | 124 | .long DAC0_IRQHandler /* DAC interrupt */ |
mbed_official | 82:0b31dbcd4769 | 125 | .long TSI0_IRQHandler /* TSI0 interrupt */ |
mbed_official | 82:0b31dbcd4769 | 126 | .long MCG_IRQHandler /* MCG interrupt */ |
mbed_official | 82:0b31dbcd4769 | 127 | .long LPTimer_IRQHandler /* LPTimer interrupt */ |
mbed_official | 82:0b31dbcd4769 | 128 | .long Reserved45_IRQHandler /* Reserved interrupt 45 */ |
mbed_official | 82:0b31dbcd4769 | 129 | .long PORTA_IRQHandler /* Port A interrupt */ |
mbed_official | 82:0b31dbcd4769 | 130 | .long PORTD_IRQHandler /* Port D interrupt */ |
mbed_official | 82:0b31dbcd4769 | 131 | |
mbed_official | 82:0b31dbcd4769 | 132 | .size __isr_vector, . - __isr_vector |
mbed_official | 82:0b31dbcd4769 | 133 | |
mbed_official | 82:0b31dbcd4769 | 134 | .section .text.Reset_Handler |
mbed_official | 82:0b31dbcd4769 | 135 | .thumb |
mbed_official | 82:0b31dbcd4769 | 136 | .thumb_func |
mbed_official | 82:0b31dbcd4769 | 137 | .align 2 |
mbed_official | 82:0b31dbcd4769 | 138 | .globl Reset_Handler |
mbed_official | 82:0b31dbcd4769 | 139 | .type Reset_Handler, %function |
mbed_official | 82:0b31dbcd4769 | 140 | Reset_Handler: |
mbed_official | 82:0b31dbcd4769 | 141 | /* Loop to copy data from read only memory to RAM. The ranges |
mbed_official | 82:0b31dbcd4769 | 142 | * of copy from/to are specified by following symbols evaluated in |
mbed_official | 82:0b31dbcd4769 | 143 | * linker script. |
mbed_official | 82:0b31dbcd4769 | 144 | * __etext: End of code section, i.e., begin of data sections to copy from. |
mbed_official | 82:0b31dbcd4769 | 145 | * __data_start__/__data_end__: RAM address range that data should be |
mbed_official | 82:0b31dbcd4769 | 146 | * copied to. Both must be aligned to 4 bytes boundary. */ |
mbed_official | 82:0b31dbcd4769 | 147 | |
mbed_official | 82:0b31dbcd4769 | 148 | ldr r1, =__etext |
mbed_official | 82:0b31dbcd4769 | 149 | ldr r2, =__data_start__ |
mbed_official | 82:0b31dbcd4769 | 150 | ldr r3, =__data_end__ |
mbed_official | 82:0b31dbcd4769 | 151 | |
mbed_official | 82:0b31dbcd4769 | 152 | subs r3, r2 |
mbed_official | 82:0b31dbcd4769 | 153 | ble .flash_to_ram_loop_end |
mbed_official | 82:0b31dbcd4769 | 154 | |
mbed_official | 82:0b31dbcd4769 | 155 | movs r4, 0 |
mbed_official | 82:0b31dbcd4769 | 156 | .flash_to_ram_loop: |
mbed_official | 82:0b31dbcd4769 | 157 | ldr r0, [r1,r4] |
mbed_official | 82:0b31dbcd4769 | 158 | str r0, [r2,r4] |
mbed_official | 82:0b31dbcd4769 | 159 | adds r4, 4 |
mbed_official | 82:0b31dbcd4769 | 160 | cmp r4, r3 |
mbed_official | 82:0b31dbcd4769 | 161 | blt .flash_to_ram_loop |
mbed_official | 82:0b31dbcd4769 | 162 | .flash_to_ram_loop_end: |
mbed_official | 82:0b31dbcd4769 | 163 | |
mbed_official | 82:0b31dbcd4769 | 164 | ldr r0, =SystemInit |
mbed_official | 82:0b31dbcd4769 | 165 | blx r0 |
mbed_official | 82:0b31dbcd4769 | 166 | ldr r0, =_start |
mbed_official | 82:0b31dbcd4769 | 167 | bx r0 |
mbed_official | 82:0b31dbcd4769 | 168 | .pool |
mbed_official | 82:0b31dbcd4769 | 169 | .size Reset_Handler, . - Reset_Handler |
mbed_official | 82:0b31dbcd4769 | 170 | |
mbed_official | 82:0b31dbcd4769 | 171 | .text |
mbed_official | 82:0b31dbcd4769 | 172 | /* Macro to define default handlers. Default handler |
mbed_official | 82:0b31dbcd4769 | 173 | * will be weak symbol and just dead loops. They can be |
mbed_official | 82:0b31dbcd4769 | 174 | * overwritten by other handlers */ |
mbed_official | 82:0b31dbcd4769 | 175 | .macro def_default_handler handler_name |
mbed_official | 82:0b31dbcd4769 | 176 | .align 1 |
mbed_official | 82:0b31dbcd4769 | 177 | .thumb_func |
mbed_official | 82:0b31dbcd4769 | 178 | .weak \handler_name |
mbed_official | 82:0b31dbcd4769 | 179 | .type \handler_name, %function |
mbed_official | 82:0b31dbcd4769 | 180 | \handler_name : |
mbed_official | 82:0b31dbcd4769 | 181 | b . |
mbed_official | 82:0b31dbcd4769 | 182 | .size \handler_name, . - \handler_name |
mbed_official | 82:0b31dbcd4769 | 183 | .endm |
mbed_official | 82:0b31dbcd4769 | 184 | |
mbed_official | 82:0b31dbcd4769 | 185 | def_default_handler NMI_Handler |
mbed_official | 82:0b31dbcd4769 | 186 | def_default_handler HardFault_Handler |
mbed_official | 82:0b31dbcd4769 | 187 | def_default_handler SVC_Handler |
mbed_official | 82:0b31dbcd4769 | 188 | def_default_handler PendSV_Handler |
mbed_official | 82:0b31dbcd4769 | 189 | def_default_handler SysTick_Handler |
mbed_official | 82:0b31dbcd4769 | 190 | def_default_handler DMA0_IRQHandler |
mbed_official | 82:0b31dbcd4769 | 191 | def_default_handler DMA1_IRQHandler |
mbed_official | 82:0b31dbcd4769 | 192 | def_default_handler DMA2_IRQHandler |
mbed_official | 82:0b31dbcd4769 | 193 | def_default_handler DMA3_IRQHandler |
mbed_official | 82:0b31dbcd4769 | 194 | def_default_handler Reserved20_IRQHandler |
mbed_official | 82:0b31dbcd4769 | 195 | def_default_handler FTFA_IRQHandler |
mbed_official | 82:0b31dbcd4769 | 196 | def_default_handler LVD_LVW_IRQHandler |
mbed_official | 82:0b31dbcd4769 | 197 | def_default_handler LLW_IRQHandler |
mbed_official | 82:0b31dbcd4769 | 198 | def_default_handler I2C0_IRQHandler |
mbed_official | 82:0b31dbcd4769 | 199 | def_default_handler I2C1_IRQHandler |
mbed_official | 82:0b31dbcd4769 | 200 | def_default_handler SPI0_IRQHandler |
mbed_official | 82:0b31dbcd4769 | 201 | def_default_handler SPI1_IRQHandler |
mbed_official | 82:0b31dbcd4769 | 202 | def_default_handler UART0_IRQHandler |
mbed_official | 82:0b31dbcd4769 | 203 | def_default_handler UART1_IRQHandler |
mbed_official | 82:0b31dbcd4769 | 204 | def_default_handler UART2_IRQHandler |
mbed_official | 82:0b31dbcd4769 | 205 | def_default_handler ADC0_IRQHandler |
mbed_official | 82:0b31dbcd4769 | 206 | def_default_handler CMP0_IRQHandler |
mbed_official | 82:0b31dbcd4769 | 207 | def_default_handler TPM0_IRQHandler |
mbed_official | 82:0b31dbcd4769 | 208 | def_default_handler TPM1_IRQHandler |
mbed_official | 82:0b31dbcd4769 | 209 | def_default_handler TPM2_IRQHandler |
mbed_official | 82:0b31dbcd4769 | 210 | def_default_handler RTC_IRQHandler |
mbed_official | 82:0b31dbcd4769 | 211 | def_default_handler RTC_Seconds_IRQHandler |
mbed_official | 82:0b31dbcd4769 | 212 | def_default_handler PIT_IRQHandler |
mbed_official | 82:0b31dbcd4769 | 213 | def_default_handler Reserved39_IRQHandler |
mbed_official | 82:0b31dbcd4769 | 214 | def_default_handler USB0_IRQHandler |
mbed_official | 82:0b31dbcd4769 | 215 | def_default_handler DAC0_IRQHandler |
mbed_official | 82:0b31dbcd4769 | 216 | def_default_handler TSI0_IRQHandler |
mbed_official | 82:0b31dbcd4769 | 217 | def_default_handler MCG_IRQHandler |
mbed_official | 82:0b31dbcd4769 | 218 | def_default_handler LPTimer_IRQHandler |
mbed_official | 82:0b31dbcd4769 | 219 | def_default_handler Reserved45_IRQHandler |
mbed_official | 82:0b31dbcd4769 | 220 | def_default_handler PORTA_IRQHandler |
mbed_official | 82:0b31dbcd4769 | 221 | def_default_handler PORTD_IRQHandler |
mbed_official | 82:0b31dbcd4769 | 222 | |
mbed_official | 82:0b31dbcd4769 | 223 | .weak DEF_IRQHandler |
mbed_official | 82:0b31dbcd4769 | 224 | .set DEF_IRQHandler, Default_Handler |
mbed_official | 82:0b31dbcd4769 | 225 | |
mbed_official | 82:0b31dbcd4769 | 226 | .end |