1; <<< Use Configuration Wizard in Context Menu >>> 2;****************************************************************************** 3; 4; Startup.s - Startup code for Stellaris. 5; 6; Copyright (c) 2006-2008 Luminary Micro, Inc. All rights reserved. 7; 8; Software License Agreement 9; 10; Luminary Micro, Inc. (LMI) is supplying this software for use solely and 11; exclusively on LMI's microcontroller products. 12; 13; The software is owned by LMI and/or its suppliers, and is protected under 14; applicable copyright laws. All rights are reserved. You may not combine 15; this software with "viral" open-source software in order to form a larger 16; program. Any use in violation of the foregoing restrictions may subject 17; the user to criminal sanctions under applicable laws, as well as to civil 18; liability for the breach of the terms and conditions of this license. 19; 20; THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED 21; OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF 22; MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. 23; LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR 24; CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. 25; 26; This is part of revision 2523 of the Stellaris Peripheral Driver Library. 27; 28;****************************************************************************** 29 30;****************************************************************************** 31; 32; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> 33; 34;****************************************************************************** 35Stack EQU 0x00000100 36 37;****************************************************************************** 38; 39; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> 40; 41;****************************************************************************** 42Heap EQU 0x00000000 43 44;****************************************************************************** 45; 46; Allocate space for the stack. 47; 48;****************************************************************************** 49 AREA STACK, NOINIT, READWRITE, ALIGN=3 50StackMem 51 SPACE Stack 52__initial_sp 53 54;****************************************************************************** 55; 56; Allocate space for the heap. 57; 58;****************************************************************************** 59 AREA HEAP, NOINIT, READWRITE, ALIGN=3 60__heap_base 61HeapMem 62 SPACE Heap 63__heap_limit 64 65 IMPORT PendSV_Handler 66 IMPORT rt_hw_timer_handler 67 IMPORT rt_hw_uart_isr_1 68 IMPORT rt_hw_eth_handler 69 IMPORT HardFault_Handler 70 71;****************************************************************************** 72; 73; Indicate that the code in this file preserves 8-byte alignment of the stack. 74; 75;****************************************************************************** 76 PRESERVE8 77 78;****************************************************************************** 79; 80; Place code into the reset code section. 81; 82;****************************************************************************** 83 AREA RESET, CODE, READONLY 84 THUMB 85 86;****************************************************************************** 87; 88; The vector table. 89; 90;****************************************************************************** 91 EXPORT __Vectors 92__Vectors 93 DCD StackMem + Stack ; Top of Stack 94 DCD Reset_Handler ; Reset Handler 95 DCD NmiSR ; NMI Handler 96 DCD HardFault_Handler ; Hard Fault Handler 97 DCD IntDefaultHandler ; MPU Fault Handler 98 DCD IntDefaultHandler ; Bus Fault Handler 99 DCD IntDefaultHandler ; Usage Fault Handler 100 DCD 0 ; Reserved 101 DCD 0 ; Reserved 102 DCD 0 ; Reserved 103 DCD 0 ; Reserved 104 DCD IntDefaultHandler ; SVCall Handler 105 DCD IntDefaultHandler ; Debug Monitor Handler 106 DCD 0 ; Reserved 107 DCD PendSV_Handler ; PendSV Handler 108 DCD rt_hw_timer_handler ; SysTick Handler 109 DCD IntDefaultHandler ; GPIO Port A 110 DCD IntDefaultHandler ; GPIO Port B 111 DCD IntDefaultHandler ; GPIO Port C 112 DCD IntDefaultHandler ; GPIO Port D 113 DCD IntDefaultHandler ; GPIO Port E 114 DCD rt_hw_uart_isr_1 ; UART0 115 DCD IntDefaultHandler ; UART1 116 DCD IntDefaultHandler ; SSI 117 DCD IntDefaultHandler ; I2C 118 DCD IntDefaultHandler ; PWM Fault 119 DCD IntDefaultHandler ; PWM Generator 0 120 DCD IntDefaultHandler ; PWM Generator 1 121 DCD IntDefaultHandler ; PWM Generator 2 122 DCD IntDefaultHandler ; Quadrature Encoder 123 DCD IntDefaultHandler ; ADC Sequence 0 124 DCD IntDefaultHandler ; ADC Sequence 1 125 DCD IntDefaultHandler ; ADC Sequence 2 126 DCD IntDefaultHandler ; ADC Sequence 3 127 DCD IntDefaultHandler ; Watchdog 128 DCD IntDefaultHandler ; Timer 0A 129 DCD IntDefaultHandler ; Timer 0B 130 DCD IntDefaultHandler ; Timer 1A 131 DCD IntDefaultHandler ; Timer 1B 132 DCD IntDefaultHandler ; Timer 2A 133 DCD IntDefaultHandler ; Timer 2B 134 DCD IntDefaultHandler ; Comp 0 135 DCD IntDefaultHandler ; Comp 1 136 DCD IntDefaultHandler ; Comp 2 137 DCD IntDefaultHandler ; System Control 138 DCD 0x881 ; Flash Control 139 DCD IntDefaultHandler ; GPIO Port F 140 DCD IntDefaultHandler ; GPIO Port G 141 DCD IntDefaultHandler ; GPIO Port H 142 DCD IntDefaultHandler ; UART2 Rx and Tx 143 DCD IntDefaultHandler ; SSI1 Rx and Tx 144 DCD IntDefaultHandler ; Timer 3 subtimer A 145 DCD IntDefaultHandler ; Timer 3 subtimer B 146 DCD IntDefaultHandler ; I2C1 Master and Slave 147 DCD IntDefaultHandler ; Quadrature Encoder 1 148 DCD IntDefaultHandler ; CAN0 149 DCD IntDefaultHandler ; CAN1 150 DCD IntDefaultHandler ; CAN2 151 DCD rt_hw_eth_handler ; Ethernet 152 DCD IntDefaultHandler ; Hibernate 153 DCD IntDefaultHandler ; USB0 154 DCD IntDefaultHandler ; PWM Generator 3 155 DCD IntDefaultHandler ; uDMA Software Transfer 156 DCD IntDefaultHandler ; uDMA Error 157 158;****************************************************************************** 159; 160; This is the code that gets called when the processor first starts execution 161; following a reset event. 162; 163;****************************************************************************** 164 EXPORT Reset_Handler 165Reset_Handler 166 ; 167 ; Call the C library enty point that handles startup. This will copy 168 ; the .data section initializers from flash to SRAM and zero fill the 169 ; .bss section. 170 ; 171 IMPORT __main 172 B __main 173 174;****************************************************************************** 175; 176; This is the code that gets called when the processor receives a NMI. This 177; simply enters an infinite loop, preserving the system state for examination 178; by a debugger. 179; 180;****************************************************************************** 181NmiSR 182 B NmiSR 183 184;****************************************************************************** 185; 186; This is the code that gets called when the processor receives a fault 187; interrupt. This simply enters an infinite loop, preserving the system state 188; for examination by a debugger. 189; 190;****************************************************************************** 191FaultISR 192 B FaultISR 193 194;****************************************************************************** 195; 196; This is the code that gets called when the processor receives an unexpected 197; interrupt. This simply enters an infinite loop, preserving the system state 198; for examination by a debugger. 199; 200;****************************************************************************** 201IntDefaultHandler 202 B IntDefaultHandler 203 204;****************************************************************************** 205; 206; Make sure the end of this section is aligned. 207; 208;****************************************************************************** 209 ALIGN 210 211;****************************************************************************** 212; 213; Some code in the normal code section for initializing the heap and stack. 214; 215;****************************************************************************** 216 AREA |.text|, CODE, READONLY 217 218;****************************************************************************** 219; 220; The function expected of the C library startup code for defining the stack 221; and heap memory locations. For the C library version of the startup code, 222; provide this function so that the C library initialization code can find out 223; the location of the stack and heap. 224; 225;****************************************************************************** 226 IF :DEF: __MICROLIB 227 EXPORT __initial_sp 228 EXPORT __heap_base 229 EXPORT __heap_limit 230 ELSE 231 IMPORT __use_two_region_memory 232 EXPORT __user_initial_stackheap 233__user_initial_stackheap 234 LDR R0, =HeapMem 235 LDR R1, =(StackMem + Stack) 236 LDR R2, =(HeapMem + Heap) 237 LDR R3, =StackMem 238 BX LR 239 ENDIF 240 241;****************************************************************************** 242; 243; Make sure the end of this section is aligned. 244; 245;****************************************************************************** 246 ALIGN 247 248;****************************************************************************** 249; 250; Tell the assembler that we're done. 251; 252;****************************************************************************** 253 END 254