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