1; <<< Use Configuration Wizard in Context Menu >>> 2;****************************************************************************** 3; 4; startup_rvmdk.S - Startup code for use with Keil's uVision. 5; 6; Copyright (c) 2013-2017 Texas Instruments Incorporated. All rights reserved. 7; Software License Agreement 8; 9; Texas Instruments (TI) is supplying this software for use solely and 10; exclusively on TI's microcontroller products. The software is owned by 11; TI and/or its suppliers, and is protected under applicable copyright 12; laws. You may not combine this software with "viral" open-source 13; software in order to form a larger program. 14; 15; THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS. 16; NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT 17; NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18; A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY 19; CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL 20; DAMAGES, FOR ANY REASON WHATSOEVER. 21; 22; This is part of revision 2.1.4.178 of the DK-TM4C129X Firmware Package. 23; 24;****************************************************************************** 25 26;****************************************************************************** 27; 28; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8> 29; 30;****************************************************************************** 31Stack EQU 0x00000200 32 33;****************************************************************************** 34; 35; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8> 36; 37;****************************************************************************** 38Heap EQU 0x00000000 39 40;****************************************************************************** 41; 42; Allocate space for the stack. 43; 44;****************************************************************************** 45 AREA STACK, NOINIT, READWRITE, ALIGN=3 46StackMem 47 SPACE Stack 48__initial_sp 49 50;****************************************************************************** 51; 52; Allocate space for the heap. 53; 54;****************************************************************************** 55 AREA HEAP, NOINIT, READWRITE, ALIGN=3 56__heap_base 57HeapMem 58 SPACE Heap 59__heap_limit 60 61;****************************************************************************** 62; 63; Indicate that the code in this file preserves 8-byte alignment of the stack. 64; 65;****************************************************************************** 66 PRESERVE8 67 68;****************************************************************************** 69; 70; Place code into the reset code section. 71; 72;****************************************************************************** 73 AREA RESET, CODE, READONLY 74 THUMB 75 76;****************************************************************************** 77; 78; The vector table. 79; 80;****************************************************************************** 81 EXPORT __Vectors 82__Vectors 83 DCD StackMem + Stack ; Top of Stack 84 DCD Reset_Handler ; Reset Handler 85 DCD NmiSR ; NMI Handler 86 DCD FaultISR ; Hard Fault Handler 87 DCD IntDefaultHandler ; The MPU fault handler 88 DCD IntDefaultHandler ; The bus fault handler 89 DCD IntDefaultHandler ; The usage fault handler 90 DCD 0 ; Reserved 91 DCD 0 ; Reserved 92 DCD 0 ; Reserved 93 DCD 0 ; Reserved 94 DCD IntDefaultHandler ; SVCall handler 95 DCD IntDefaultHandler ; Debug monitor handler 96 DCD 0 ; Reserved 97 DCD IntDefaultHandler ; The PendSV handler 98 DCD IntDefaultHandler ; The SysTick handler 99 DCD IntDefaultHandler ; GPIO Port A 100 DCD IntDefaultHandler ; GPIO Port B 101 DCD IntDefaultHandler ; GPIO Port C 102 DCD IntDefaultHandler ; GPIO Port D 103 DCD IntDefaultHandler ; GPIO Port E 104 DCD IntDefaultHandler ; UART0 Rx and Tx 105 DCD IntDefaultHandler ; UART1 Rx and Tx 106 DCD IntDefaultHandler ; SSI0 Rx and Tx 107 DCD IntDefaultHandler ; I2C0 Master and Slave 108 DCD IntDefaultHandler ; PWM Fault 109 DCD IntDefaultHandler ; PWM Generator 0 110 DCD IntDefaultHandler ; PWM Generator 1 111 DCD IntDefaultHandler ; PWM Generator 2 112 DCD IntDefaultHandler ; Quadrature Encoder 0 113 DCD IntDefaultHandler ; ADC Sequence 0 114 DCD IntDefaultHandler ; ADC Sequence 1 115 DCD IntDefaultHandler ; ADC Sequence 2 116 DCD IntDefaultHandler ; ADC Sequence 3 117 DCD IntDefaultHandler ; Watchdog timer 118 DCD IntDefaultHandler ; Timer 0 subtimer A 119 DCD IntDefaultHandler ; Timer 0 subtimer B 120 DCD IntDefaultHandler ; Timer 1 subtimer A 121 DCD IntDefaultHandler ; Timer 1 subtimer B 122 DCD IntDefaultHandler ; Timer 2 subtimer A 123 DCD IntDefaultHandler ; Timer 2 subtimer B 124 DCD IntDefaultHandler ; Analog Comparator 0 125 DCD IntDefaultHandler ; Analog Comparator 1 126 DCD IntDefaultHandler ; Analog Comparator 2 127 DCD IntDefaultHandler ; System Control (PLL, OSC, BO) 128 DCD IntDefaultHandler ; FLASH Control 129 DCD IntDefaultHandler ; GPIO Port F 130 DCD IntDefaultHandler ; GPIO Port G 131 DCD IntDefaultHandler ; GPIO Port H 132 DCD IntDefaultHandler ; UART2 Rx and Tx 133 DCD IntDefaultHandler ; SSI1 Rx and Tx 134 DCD IntDefaultHandler ; Timer 3 subtimer A 135 DCD IntDefaultHandler ; Timer 3 subtimer B 136 DCD IntDefaultHandler ; I2C1 Master and Slave 137 DCD IntDefaultHandler ; CAN0 138 DCD IntDefaultHandler ; CAN1 139 DCD IntDefaultHandler ; Ethernet 140 DCD IntDefaultHandler ; Hibernate 141 DCD IntDefaultHandler ; USB0 142 DCD IntDefaultHandler ; PWM Generator 3 143 DCD IntDefaultHandler ; uDMA Software Transfer 144 DCD IntDefaultHandler ; uDMA Error 145 DCD IntDefaultHandler ; ADC1 Sequence 0 146 DCD IntDefaultHandler ; ADC1 Sequence 1 147 DCD IntDefaultHandler ; ADC1 Sequence 2 148 DCD IntDefaultHandler ; ADC1 Sequence 3 149 DCD IntDefaultHandler ; External Bus Interface 0 150 DCD IntDefaultHandler ; GPIO Port J 151 DCD IntDefaultHandler ; GPIO Port K 152 DCD IntDefaultHandler ; GPIO Port L 153 DCD IntDefaultHandler ; SSI2 Rx and Tx 154 DCD IntDefaultHandler ; SSI3 Rx and Tx 155 DCD IntDefaultHandler ; UART3 Rx and Tx 156 DCD IntDefaultHandler ; UART4 Rx and Tx 157 DCD IntDefaultHandler ; UART5 Rx and Tx 158 DCD IntDefaultHandler ; UART6 Rx and Tx 159 DCD IntDefaultHandler ; UART7 Rx and Tx 160 DCD IntDefaultHandler ; I2C2 Master and Slave 161 DCD IntDefaultHandler ; I2C3 Master and Slave 162 DCD IntDefaultHandler ; Timer 4 subtimer A 163 DCD IntDefaultHandler ; Timer 4 subtimer B 164 DCD IntDefaultHandler ; Timer 5 subtimer A 165 DCD IntDefaultHandler ; Timer 5 subtimer B 166 DCD IntDefaultHandler ; FPU 167 DCD 0 ; Reserved 168 DCD 0 ; Reserved 169 DCD IntDefaultHandler ; I2C4 Master and Slave 170 DCD IntDefaultHandler ; I2C5 Master and Slave 171 DCD IntDefaultHandler ; GPIO Port M 172 DCD IntDefaultHandler ; GPIO Port N 173 DCD 0 ; Reserved 174 DCD IntDefaultHandler ; Tamper 175 DCD IntDefaultHandler ; GPIO Port P (Summary or P0) 176 DCD IntDefaultHandler ; GPIO Port P1 177 DCD IntDefaultHandler ; GPIO Port P2 178 DCD IntDefaultHandler ; GPIO Port P3 179 DCD IntDefaultHandler ; GPIO Port P4 180 DCD IntDefaultHandler ; GPIO Port P5 181 DCD IntDefaultHandler ; GPIO Port P6 182 DCD IntDefaultHandler ; GPIO Port P7 183 DCD IntDefaultHandler ; GPIO Port Q (Summary or Q0) 184 DCD IntDefaultHandler ; GPIO Port Q1 185 DCD IntDefaultHandler ; GPIO Port Q2 186 DCD IntDefaultHandler ; GPIO Port Q3 187 DCD IntDefaultHandler ; GPIO Port Q4 188 DCD IntDefaultHandler ; GPIO Port Q5 189 DCD IntDefaultHandler ; GPIO Port Q6 190 DCD IntDefaultHandler ; GPIO Port Q7 191 DCD IntDefaultHandler ; GPIO Port R 192 DCD IntDefaultHandler ; GPIO Port S 193 DCD IntDefaultHandler ; SHA/MD5 0 194 DCD IntDefaultHandler ; AES 0 195 DCD IntDefaultHandler ; DES3DES 0 196 DCD IntDefaultHandler ; LCD Controller 0 197 DCD IntDefaultHandler ; Timer 6 subtimer A 198 DCD IntDefaultHandler ; Timer 6 subtimer B 199 DCD IntDefaultHandler ; Timer 7 subtimer A 200 DCD IntDefaultHandler ; Timer 7 subtimer B 201 DCD IntDefaultHandler ; I2C6 Master and Slave 202 DCD IntDefaultHandler ; I2C7 Master and Slave 203 DCD IntDefaultHandler ; HIM Scan Matrix Keyboard 0 204 DCD IntDefaultHandler ; One Wire 0 205 DCD IntDefaultHandler ; HIM PS/2 0 206 DCD IntDefaultHandler ; HIM LED Sequencer 0 207 DCD IntDefaultHandler ; HIM Consumer IR 0 208 DCD IntDefaultHandler ; I2C8 Master and Slave 209 DCD IntDefaultHandler ; I2C9 Master and Slave 210 DCD IntDefaultHandler ; GPIO Port T 211 212;****************************************************************************** 213; 214; This is the code that gets called when the processor first starts execution 215; following a reset event. 216; 217;****************************************************************************** 218 EXPORT Reset_Handler 219Reset_Handler 220 ; 221 ; Enable the floating-point unit. This must be done here to handle the 222 ; case where main() uses floating-point and the function prologue saves 223 ; floating-point registers (which will fault if floating-point is not 224 ; enabled). Any configuration of the floating-point unit using 225 ; DriverLib APIs must be done here prior to the floating-point unit 226 ; being enabled. 227 ; 228 ; Note that this does not use DriverLib since it might not be included 229 ; in this project. 230 ; 231 MOVW R0, #0xED88 232 MOVT R0, #0xE000 233 LDR R1, [R0] 234 ORR R1, #0x00F00000 235 STR R1, [R0] 236 237 ; 238 ; Call the C library enty point that handles startup. This will copy 239 ; the .data section initializers from flash to SRAM and zero fill the 240 ; .bss section. 241 ; 242 IMPORT __main 243 B __main 244 245;****************************************************************************** 246; 247; This is the code that gets called when the processor receives a NMI. This 248; simply enters an infinite loop, preserving the system state for examination 249; by a debugger. 250; 251;****************************************************************************** 252NmiSR 253 B NmiSR 254 255;****************************************************************************** 256; 257; This is the code that gets called when the processor receives a fault 258; interrupt. This simply enters an infinite loop, preserving the system state 259; for examination by a debugger. 260; 261;****************************************************************************** 262FaultISR 263 B FaultISR 264 265;****************************************************************************** 266; 267; This is the code that gets called when the processor receives an unexpected 268; interrupt. This simply enters an infinite loop, preserving the system state 269; for examination by a debugger. 270; 271;****************************************************************************** 272IntDefaultHandler 273 B IntDefaultHandler 274 275;****************************************************************************** 276; 277; Make sure the end of this section is aligned. 278; 279;****************************************************************************** 280 ALIGN 281 282;****************************************************************************** 283; 284; Some code in the normal code section for initializing the heap and stack. 285; 286;****************************************************************************** 287 AREA |.text|, CODE, READONLY 288 289;****************************************************************************** 290; 291; The function expected of the C library startup code for defining the stack 292; and heap memory locations. For the C library version of the startup code, 293; provide this function so that the C library initialization code can find out 294; the location of the stack and heap. 295; 296;****************************************************************************** 297 IF :DEF: __MICROLIB 298 EXPORT __initial_sp 299 EXPORT __heap_base 300 EXPORT __heap_limit 301 ELSE 302 IMPORT __use_two_region_memory 303 EXPORT __user_initial_stackheap 304__user_initial_stackheap 305 LDR R0, =HeapMem 306 LDR R1, =(StackMem + Stack) 307 LDR R2, =(HeapMem + Heap) 308 LDR R3, =StackMem 309 BX LR 310 ENDIF 311 312;****************************************************************************** 313; 314; Make sure the end of this section is aligned. 315; 316;****************************************************************************** 317 ALIGN 318 319;****************************************************************************** 320; 321; Tell the assembler that we're done. 322; 323;****************************************************************************** 324 END 325