mbed library sources

Dependents:   Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more

Superseded

This library was superseded by mbed-dev - https://os.mbed.com/users/mbed_official/code/mbed-dev/.

Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.

If you are looking for a stable and tested release, please import one of the official mbed library releases:

Import librarymbed

The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Committer:
mbed_official
Date:
Wed Jul 01 08:15:11 2015 +0100
Revision:
577:15494b56c2f3
Synchronized with git revision 7766e75dd858812cd79aedb3080349715f55dd56

Full URL: https://github.com/mbedmicro/mbed/commit/7766e75dd858812cd79aedb3080349715f55dd56/

GCC asm updates

Who changed what in which revision?

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