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:
Fri Oct 24 09:15:06 2014 +0100
Revision:
365:7ced7d9d5ffe
Child:
514:7668256dbe61
Synchronized with git revision 3dfb03322653b12ab2e485aadfff8653ecea2429

Full URL: https://github.com/mbedmicro/mbed/commit/3dfb03322653b12ab2e485aadfff8653ecea2429/

Toolchain: LPC824 - new Toolchain support by GCC_ARM for LPC824

Who changed what in which revision?

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