mbed library sources: Modified to operate FRDM-KL25Z at 48MHz from internal 32kHz oscillator (nothing else changed).

Fork of mbed-src by mbed official

The only file that changed is: mbed-src-FLL48/targets/cmsis/TARGET_Freescale/TARGET_KL25Z/system_MKL25Z4.h

Committer:
bogdanm
Date:
Tue Sep 10 15:14:19 2013 +0300
Revision:
20:4263a77256ae
Sync with git revision 171dda705c947bf910926a0b73d6a4797802554d

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bogdanm 20:4263a77256ae 1 /* File: startup_ARMCM0.S
bogdanm 20:4263a77256ae 2 * Purpose: startup file for Cortex-M0 devices. Should use with
bogdanm 20:4263a77256ae 3 * GCC for ARM Embedded Processors
bogdanm 20:4263a77256ae 4 * Version: V1.2
bogdanm 20:4263a77256ae 5 * Date: 15 Nov 2011
bogdanm 20:4263a77256ae 6 *
bogdanm 20:4263a77256ae 7 * Copyright (c) 2011, ARM Limited
bogdanm 20:4263a77256ae 8 * All rights reserved.
bogdanm 20:4263a77256ae 9 *
bogdanm 20:4263a77256ae 10 * Redistribution and use in source and binary forms, with or without
bogdanm 20:4263a77256ae 11 * modification, are permitted provided that the following conditions are met:
bogdanm 20:4263a77256ae 12 * Redistributions of source code must retain the above copyright
bogdanm 20:4263a77256ae 13 notice, this list of conditions and the following disclaimer.
bogdanm 20:4263a77256ae 14 * Redistributions in binary form must reproduce the above copyright
bogdanm 20:4263a77256ae 15 notice, this list of conditions and the following disclaimer in the
bogdanm 20:4263a77256ae 16 documentation and/or other materials provided with the distribution.
bogdanm 20:4263a77256ae 17 * Neither the name of the ARM Limited nor the
bogdanm 20:4263a77256ae 18 names of its contributors may be used to endorse or promote products
bogdanm 20:4263a77256ae 19 derived from this software without specific prior written permission.
bogdanm 20:4263a77256ae 20 *
bogdanm 20:4263a77256ae 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
bogdanm 20:4263a77256ae 22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
bogdanm 20:4263a77256ae 23 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
bogdanm 20:4263a77256ae 24 * DISCLAIMED. IN NO EVENT SHALL ARM LIMITED BE LIABLE FOR ANY
bogdanm 20:4263a77256ae 25 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
bogdanm 20:4263a77256ae 26 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
bogdanm 20:4263a77256ae 27 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
bogdanm 20:4263a77256ae 28 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
bogdanm 20:4263a77256ae 29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
bogdanm 20:4263a77256ae 30 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
bogdanm 20:4263a77256ae 31 */
bogdanm 20:4263a77256ae 32 .syntax unified
bogdanm 20:4263a77256ae 33 .arch armv6-m
bogdanm 20:4263a77256ae 34
bogdanm 20:4263a77256ae 35 /* Memory Model
bogdanm 20:4263a77256ae 36 The HEAP starts at the end of the DATA section and grows upward.
bogdanm 20:4263a77256ae 37
bogdanm 20:4263a77256ae 38 The STACK starts at the end of the RAM and grows downward.
bogdanm 20:4263a77256ae 39
bogdanm 20:4263a77256ae 40 The HEAP and stack STACK are only checked at compile time:
bogdanm 20:4263a77256ae 41 (DATA_SIZE + HEAP_SIZE + STACK_SIZE) < RAM_SIZE
bogdanm 20:4263a77256ae 42
bogdanm 20:4263a77256ae 43 This is just a check for the bare minimum for the Heap+Stack area before
bogdanm 20:4263a77256ae 44 aborting compilation, it is not the run time limit:
bogdanm 20:4263a77256ae 45 Heap_Size + Stack_Size = 0x80 + 0x80 = 0x100
bogdanm 20:4263a77256ae 46 */
bogdanm 20:4263a77256ae 47 .section .stack
bogdanm 20:4263a77256ae 48 .align 3
bogdanm 20:4263a77256ae 49 #ifdef __STACK_SIZE
bogdanm 20:4263a77256ae 50 .equ Stack_Size, __STACK_SIZE
bogdanm 20:4263a77256ae 51 #else
bogdanm 20:4263a77256ae 52 .equ Stack_Size, 0x80
bogdanm 20:4263a77256ae 53 #endif
bogdanm 20:4263a77256ae 54 .globl __StackTop
bogdanm 20:4263a77256ae 55 .globl __StackLimit
bogdanm 20:4263a77256ae 56 __StackLimit:
bogdanm 20:4263a77256ae 57 .space Stack_Size
bogdanm 20:4263a77256ae 58 .size __StackLimit, . - __StackLimit
bogdanm 20:4263a77256ae 59 __StackTop:
bogdanm 20:4263a77256ae 60 .size __StackTop, . - __StackTop
bogdanm 20:4263a77256ae 61
bogdanm 20:4263a77256ae 62 .section .heap
bogdanm 20:4263a77256ae 63 .align 3
bogdanm 20:4263a77256ae 64 #ifdef __HEAP_SIZE
bogdanm 20:4263a77256ae 65 .equ Heap_Size, __HEAP_SIZE
bogdanm 20:4263a77256ae 66 #else
bogdanm 20:4263a77256ae 67 .equ Heap_Size, 0x80
bogdanm 20:4263a77256ae 68 #endif
bogdanm 20:4263a77256ae 69 .globl __HeapBase
bogdanm 20:4263a77256ae 70 .globl __HeapLimit
bogdanm 20:4263a77256ae 71 __HeapBase:
bogdanm 20:4263a77256ae 72 .space Heap_Size
bogdanm 20:4263a77256ae 73 .size __HeapBase, . - __HeapBase
bogdanm 20:4263a77256ae 74 __HeapLimit:
bogdanm 20:4263a77256ae 75 .size __HeapLimit, . - __HeapLimit
bogdanm 20:4263a77256ae 76
bogdanm 20:4263a77256ae 77 .section .isr_vector
bogdanm 20:4263a77256ae 78 .align 2
bogdanm 20:4263a77256ae 79 .globl __isr_vector
bogdanm 20:4263a77256ae 80 __isr_vector:
bogdanm 20:4263a77256ae 81 .long __StackTop /* Top of Stack */
bogdanm 20:4263a77256ae 82 .long Reset_Handler /* Reset Handler */
bogdanm 20:4263a77256ae 83 .long NMI_Handler /* NMI Handler */
bogdanm 20:4263a77256ae 84 .long HardFault_Handler /* Hard Fault Handler */
bogdanm 20:4263a77256ae 85 .long 0 /* Reserved */
bogdanm 20:4263a77256ae 86 .long 0 /* Reserved */
bogdanm 20:4263a77256ae 87 .long 0 /* Reserved */
bogdanm 20:4263a77256ae 88 .long 0 /* Reserved */
bogdanm 20:4263a77256ae 89 .long 0 /* Reserved */
bogdanm 20:4263a77256ae 90 .long 0 /* Reserved */
bogdanm 20:4263a77256ae 91 .long 0 /* Reserved */
bogdanm 20:4263a77256ae 92 .long SVC_Handler /* SVCall Handler */
bogdanm 20:4263a77256ae 93 .long 0 /* Reserved */
bogdanm 20:4263a77256ae 94 .long 0 /* Reserved */
bogdanm 20:4263a77256ae 95 .long PendSV_Handler /* PendSV Handler */
bogdanm 20:4263a77256ae 96 .long SysTick_Handler /* SysTick Handler */
bogdanm 20:4263a77256ae 97
bogdanm 20:4263a77256ae 98 /* LPC11xx interrupts */
bogdanm 20:4263a77256ae 99 .long WAKEUP_IRQHandler /* 16 0 Wake-up on pin PIO0_0 */
bogdanm 20:4263a77256ae 100 .long WAKEUP_IRQHandler /* 17 1 Wake-up on pin PIO0_1 */
bogdanm 20:4263a77256ae 101 .long WAKEUP_IRQHandler /* 18 2 Wake-up on pin PIO0_2 */
bogdanm 20:4263a77256ae 102 .long WAKEUP_IRQHandler /* 19 3 Wake-up on pin PIO0_3 */
bogdanm 20:4263a77256ae 103 .long WAKEUP_IRQHandler /* 20 4 Wake-up on pin PIO0_4 */
bogdanm 20:4263a77256ae 104 .long WAKEUP_IRQHandler /* 21 5 Wake-up on pin PIO0_5 */
bogdanm 20:4263a77256ae 105 .long WAKEUP_IRQHandler /* 22 6 Wake-up on pin PIO0_6 */
bogdanm 20:4263a77256ae 106 .long WAKEUP_IRQHandler /* 23 7 Wake-up on pin PIO0_7 */
bogdanm 20:4263a77256ae 107 .long WAKEUP_IRQHandler /* 24 8 Wake-up on pin PIO0_8 */
bogdanm 20:4263a77256ae 108 .long WAKEUP_IRQHandler /* 25 9 Wake-up on pin PIO0_9 */
bogdanm 20:4263a77256ae 109 .long WAKEUP_IRQHandler /* 26 10 Wake-up on pin PIO0_10 */
bogdanm 20:4263a77256ae 110 .long WAKEUP_IRQHandler /* 27 11 Wake-up on pin PIO0_11 */
bogdanm 20:4263a77256ae 111 .long WAKEUP_IRQHandler /* 28 12 Wake-up on pin PIO1_0 */
bogdanm 20:4263a77256ae 112 .long Default_Handler /* 29 13 */
bogdanm 20:4263a77256ae 113 .long SSP1_IRQHandler /* 30 14 SSP1 */
bogdanm 20:4263a77256ae 114 .long I2C_IRQHandler /* 31 15 I2C0 SI (state change) */
bogdanm 20:4263a77256ae 115 .long TIMER16_0_IRQHandler /* 32 16 CT16B0 16 bit timer 0 */
bogdanm 20:4263a77256ae 116 .long TIMER16_1_IRQHandler /* 33 17 CT16B1 16 bit timer 1 */
bogdanm 20:4263a77256ae 117 .long TIMER32_0_IRQHandler /* 34 18 CT32B0 32 bit timer 0 */
bogdanm 20:4263a77256ae 118 .long TIMER32_1_IRQHandler /* 35 19 CT32B1 32 bit timer 1 */
bogdanm 20:4263a77256ae 119 .long SSP0_IRQHandler /* 36 20 SSP */
bogdanm 20:4263a77256ae 120 .long UART_IRQHandler /* 37 21 UART */
bogdanm 20:4263a77256ae 121 .long Default_Handler /* 38 22 */
bogdanm 20:4263a77256ae 122 .long Default_Handler /* 39 23 */
bogdanm 20:4263a77256ae 123 .long ADC_IRQHandler /* 40 24 ADC end of conversion */
bogdanm 20:4263a77256ae 124 .long WDT_IRQHandler /* 41 25 Watchdog interrupt (WDINT) */
bogdanm 20:4263a77256ae 125 .long BOD_IRQHandler /* 42 26 BOD Brown-out detect */
bogdanm 20:4263a77256ae 126 .long Default_Handler /* 43 27 */
bogdanm 20:4263a77256ae 127 .long PIOINT3_IRQHandler /* 44 28 PIO_3 GPIO interrupt status of port 3 */
bogdanm 20:4263a77256ae 128 .long PIOINT2_IRQHandler /* 45 29 PIO_2 GPIO interrupt status of port 2 */
bogdanm 20:4263a77256ae 129 .long PIOINT1_IRQHandler /* 46 30 PIO_1 GPIO interrupt status of port 1 */
bogdanm 20:4263a77256ae 130 .long PIOINT0_IRQHandler /* 47 31 PIO_0 GPIO interrupt status of port 0 */
bogdanm 20:4263a77256ae 131
bogdanm 20:4263a77256ae 132 .size __isr_vector, . - __isr_vector
bogdanm 20:4263a77256ae 133
bogdanm 20:4263a77256ae 134 .section .text.Reset_Handler
bogdanm 20:4263a77256ae 135 .thumb
bogdanm 20:4263a77256ae 136 .thumb_func
bogdanm 20:4263a77256ae 137 .align 2
bogdanm 20:4263a77256ae 138 .globl Reset_Handler
bogdanm 20:4263a77256ae 139 .type Reset_Handler, %function
bogdanm 20:4263a77256ae 140 Reset_Handler:
bogdanm 20:4263a77256ae 141 /* Loop to copy data from read only memory to RAM. The ranges
bogdanm 20:4263a77256ae 142 * of copy from/to are specified by following symbols evaluated in
bogdanm 20:4263a77256ae 143 * linker script.
bogdanm 20:4263a77256ae 144 * __etext: End of code section, i.e., begin of data sections to copy from.
bogdanm 20:4263a77256ae 145 * __data_start__/__data_end__: RAM address range that data should be
bogdanm 20:4263a77256ae 146 * copied to. Both must be aligned to 4 bytes boundary. */
bogdanm 20:4263a77256ae 147
bogdanm 20:4263a77256ae 148 ldr r1, =__etext
bogdanm 20:4263a77256ae 149 ldr r2, =__data_start__
bogdanm 20:4263a77256ae 150 ldr r3, =__data_end__
bogdanm 20:4263a77256ae 151
bogdanm 20:4263a77256ae 152 subs r3, r2
bogdanm 20:4263a77256ae 153 ble .flash_to_ram_loop_end
bogdanm 20:4263a77256ae 154
bogdanm 20:4263a77256ae 155 movs r4, 0
bogdanm 20:4263a77256ae 156 .flash_to_ram_loop:
bogdanm 20:4263a77256ae 157 ldr r0, [r1,r4]
bogdanm 20:4263a77256ae 158 str r0, [r2,r4]
bogdanm 20:4263a77256ae 159 adds r4, 4
bogdanm 20:4263a77256ae 160 cmp r4, r3
bogdanm 20:4263a77256ae 161 blt .flash_to_ram_loop
bogdanm 20:4263a77256ae 162 .flash_to_ram_loop_end:
bogdanm 20:4263a77256ae 163
bogdanm 20:4263a77256ae 164 ldr r0, =SystemInit
bogdanm 20:4263a77256ae 165 blx r0
bogdanm 20:4263a77256ae 166 ldr r0, =_start
bogdanm 20:4263a77256ae 167 bx r0
bogdanm 20:4263a77256ae 168 .pool
bogdanm 20:4263a77256ae 169 .size Reset_Handler, . - Reset_Handler
bogdanm 20:4263a77256ae 170
bogdanm 20:4263a77256ae 171 .text
bogdanm 20:4263a77256ae 172 /* Macro to define default handlers. Default handler
bogdanm 20:4263a77256ae 173 * will be weak symbol and just dead loops. They can be
bogdanm 20:4263a77256ae 174 * overwritten by other handlers */
bogdanm 20:4263a77256ae 175 .macro def_default_handler handler_name
bogdanm 20:4263a77256ae 176 .align 1
bogdanm 20:4263a77256ae 177 .thumb_func
bogdanm 20:4263a77256ae 178 .weak \handler_name
bogdanm 20:4263a77256ae 179 .type \handler_name, %function
bogdanm 20:4263a77256ae 180 \handler_name :
bogdanm 20:4263a77256ae 181 b .
bogdanm 20:4263a77256ae 182 .size \handler_name, . - \handler_name
bogdanm 20:4263a77256ae 183 .endm
bogdanm 20:4263a77256ae 184
bogdanm 20:4263a77256ae 185 def_default_handler NMI_Handler
bogdanm 20:4263a77256ae 186 def_default_handler HardFault_Handler
bogdanm 20:4263a77256ae 187 def_default_handler SVC_Handler
bogdanm 20:4263a77256ae 188 def_default_handler PendSV_Handler
bogdanm 20:4263a77256ae 189 def_default_handler SysTick_Handler
bogdanm 20:4263a77256ae 190 def_default_handler Default_Handler
bogdanm 20:4263a77256ae 191
bogdanm 20:4263a77256ae 192 def_default_handler WAKEUP_IRQHandler
bogdanm 20:4263a77256ae 193 def_default_handler SSP1_IRQHandler
bogdanm 20:4263a77256ae 194 def_default_handler I2C_IRQHandler
bogdanm 20:4263a77256ae 195 def_default_handler TIMER16_0_IRQHandler
bogdanm 20:4263a77256ae 196 def_default_handler TIMER16_1_IRQHandler
bogdanm 20:4263a77256ae 197 def_default_handler TIMER32_0_IRQHandler
bogdanm 20:4263a77256ae 198 def_default_handler TIMER32_1_IRQHandler
bogdanm 20:4263a77256ae 199 def_default_handler SSP0_IRQHandler
bogdanm 20:4263a77256ae 200 def_default_handler UART_IRQHandler
bogdanm 20:4263a77256ae 201 def_default_handler ADC_IRQHandler
bogdanm 20:4263a77256ae 202 def_default_handler WDT_IRQHandler
bogdanm 20:4263a77256ae 203 def_default_handler BOD_IRQHandler
bogdanm 20:4263a77256ae 204 def_default_handler PIOINT3_IRQHandler
bogdanm 20:4263a77256ae 205 def_default_handler PIOINT2_IRQHandler
bogdanm 20:4263a77256ae 206 def_default_handler PIOINT1_IRQHandler
bogdanm 20:4263a77256ae 207 def_default_handler PIOINT0_IRQHandler
bogdanm 20:4263a77256ae 208
bogdanm 20:4263a77256ae 209 .weak DEF_IRQHandler
bogdanm 20:4263a77256ae 210 .set DEF_IRQHandler, Default_Handler
bogdanm 20:4263a77256ae 211
bogdanm 20:4263a77256ae 212 .end
bogdanm 20:4263a77256ae 213