1/* --------------------------------------------------------------------------*/ 2/* @file: startup_LPC810.S */ 3/* @purpose: CMSIS Cortex-M0+ Core Device Startup File */ 4/* LPC810 */ 5/* @version: 1.2 */ 6/* @date: 2017-6-8 */ 7/* --------------------------------------------------------------------------*/ 8/* */ 9/* Copyright 1997-2016 Freescale Semiconductor, Inc. */ 10/* Copyright 2016-2020 NXP */ 11/* All rights reserved. */ 12/* */ 13/* SPDX-License-Identifier: BSD-3-Clause */ 14/*****************************************************************************/ 15/* Version: GCC for ARM Embedded Processors */ 16/*****************************************************************************/ 17 18 19 .syntax unified 20 .arch armv6-m 21 22 .section .isr_vector, "a" 23 .align 2 24 .globl __Vectors 25__Vectors: 26 .long __StackTop /* Top of Stack */ 27 .long Reset_Handler /* Reset Handler */ 28 .long NMI_Handler /* NMI Handler */ 29 .long HardFault_Handler /* Hard Fault Handler */ 30 .long 0 /* Reserved */ 31 .long 0 /* Reserved */ 32 .long 0 /* Reserved */ 33 .long 0 /* Reserved */ 34 .long 0 /* Reserved */ 35 .long 0 /* Reserved */ 36 .long 0 /* Reserved */ 37 .long SVC_Handler /* SVCall Handler */ 38 .long 0 /* Reserved */ 39 .long 0 /* Reserved */ 40 .long PendSV_Handler /* PendSV Handler */ 41 .long SysTick_Handler /* SysTick Handler */ 42 43 /* External Interrupts */ 44 .long SPI0_IRQHandler /* SPI0 interrupt */ 45 .long SPI1_IRQHandler /* SPI1 interrupt */ 46 .long Reserved18_IRQHandler /* Reserved interrupt */ 47 .long USART0_IRQHandler /* USART0 interrupt */ 48 .long USART1_IRQHandler /* USART1 interrupt */ 49 .long USART2_IRQHandler /* USART2 interrupt */ 50 .long Reserved22_IRQHandler /* Reserved interrupt */ 51 .long Reserved23_IRQHandler /* Reserved interrupt */ 52 .long I2C0_IRQHandler /* I2C0 interrupt */ 53 .long SCT0_IRQHandler /* State configurable timer interrupt */ 54 .long MRT0_IRQHandler /* Multi-rate timer interrupt */ 55 .long CMP_IRQHandler /* Analog comparator interrupt or Capacitive Touch interrupt */ 56 .long WDT_IRQHandler /* Windowed watchdog timer interrupt */ 57 .long BOD_IRQHandler /* BOD interrupts */ 58 .long Reserved30_IRQHandler /* Reserved interrupt */ 59 .long WKT_IRQHandler /* Self-wake-up timer interrupt */ 60 .long Reserved32_IRQHandler /* Reserved interrupt */ 61 .long Reserved33_IRQHandler /* Reserved interrupt */ 62 .long Reserved34_IRQHandler /* Reserved interrupt */ 63 .long Reserved35_IRQHandler /* Reserved interrupt */ 64 .long Reserved36_IRQHandler /* Reserved interrupt */ 65 .long Reserved37_IRQHandler /* Reserved interrupt */ 66 .long Reserved38_IRQHandler /* Reserved interrupt */ 67 .long Reserved39_IRQHandler /* Reserved interrupt */ 68 .long PIN_INT0_IRQHandler /* Pin interrupt 0 or pattern match engine slice 0 interrupt */ 69 .long PIN_INT1_IRQHandler /* Pin interrupt 1 or pattern match engine slice 1 interrupt */ 70 .long PIN_INT2_IRQHandler /* Pin interrupt 2 or pattern match engine slice 2 interrupt */ 71 .long PIN_INT3_IRQHandler /* Pin interrupt 3 or pattern match engine slice 3 interrupt */ 72 .long PIN_INT4_IRQHandler /* Pin interrupt 4 or pattern match engine slice 4 interrupt */ 73 .long PIN_INT5_IRQHandler /* Pin interrupt 5 or pattern match engine slice 5 interrupt */ 74 .long PIN_INT6_IRQHandler /* Pin interrupt 6 or pattern match engine slice 6 interrupt */ 75 .long PIN_INT7_IRQHandler /* Pin interrupt 7 or pattern match engine slice 7 interrupt */ 76 77 .size __Vectors, . - __Vectors 78 79/* Variable to store CRP value in. No code read protection enabled by default 80 * Code Read Protection level (CRP) 81 * CRP_Level: 82 * <0xFFFFFFFF=> Disabled 83 * <0x4E697370=> NO_ISP 84 * <0x12345678=> CRP1 85 * <0x87654321=> CRP2 86 * <0x43218765=> CRP3 87 */ 88 #ifndef NO_CRP 89 .section .crp, "a" 90 .long 0xFFFFFFFF 91 #endif 92 93 .text 94 .thumb 95 96/* Reset Handler */ 97 .thumb_func 98 .align 2 99 .globl Reset_Handler 100 .weak Reset_Handler 101 .type Reset_Handler, %function 102Reset_Handler: 103 cpsid i /* Mask interrupts */ 104 105#ifndef __NO_SYSTEM_INIT 106 ldr r0,=SystemInit 107 blx r0 108#endif 109/* Loop to copy data from read only memory to RAM. The ranges 110 * of copy from/to are specified by following symbols evaluated in 111 * linker script. 112 * __etext: End of code section, i.e., begin of data sections to copy from. 113 * __data_start__/__data_end__: RAM address range that data should be 114 * copied to. Both must be aligned to 4 bytes boundary. */ 115 116 ldr r1, =__etext 117 ldr r2, =__data_start__ 118 ldr r3, =__data_end__ 119 120 subs r3, r2 121 ble .LC0 122 123.LC1: 124 subs r3, 4 125 ldr r0, [r1,r3] 126 str r0, [r2,r3] 127 bgt .LC1 128.LC0: 129 130#ifdef __STARTUP_CLEAR_BSS 131/* This part of work usually is done in C library startup code. Otherwise, 132 * define this macro to enable it in this startup. 133 * 134 * Loop to zero out BSS section, which uses following symbols 135 * in linker script: 136 * __bss_start__: start of BSS section. Must align to 4 137 * __bss_end__: end of BSS section. Must align to 4 138 */ 139 ldr r1, =__bss_start__ 140 ldr r2, =__bss_end__ 141 142 subs r2, r1 143 ble .LC3 144 145 movs r0, 0 146.LC2: 147 str r0, [r1, r2] 148 subs r2, 4 149 bge .LC2 150.LC3: 151#endif 152 cpsie i /* Unmask interrupts */ 153 154#ifndef __START 155#define __START _start 156#endif 157#ifndef __ATOLLIC__ 158 ldr r0,=__START 159 blx r0 160#else 161 ldr r0,=__libc_init_array 162 blx r0 163 ldr r0,=main 164 bx r0 165#endif 166 .pool 167 .size Reset_Handler, . - Reset_Handler 168 169 .align 1 170 .thumb_func 171 .weak DefaultISR 172 .type DefaultISR, %function 173DefaultISR: 174 ldr r0, =DefaultISR 175 bx r0 176 .size DefaultISR, . - DefaultISR 177 178 .align 1 179 .thumb_func 180 .weak NMI_Handler 181 .type NMI_Handler, %function 182NMI_Handler: 183 ldr r0,=NMI_Handler 184 bx r0 185 .size NMI_Handler, . - NMI_Handler 186 187 .align 1 188 .thumb_func 189 .weak HardFault_Handler 190 .type HardFault_Handler, %function 191HardFault_Handler: 192 ldr r0,=HardFault_Handler 193 bx r0 194 .size HardFault_Handler, . - HardFault_Handler 195 196 .align 1 197 .thumb_func 198 .weak SVC_Handler 199 .type SVC_Handler, %function 200SVC_Handler: 201 ldr r0,=SVC_Handler 202 bx r0 203 .size SVC_Handler, . - SVC_Handler 204 205 .align 1 206 .thumb_func 207 .weak PendSV_Handler 208 .type PendSV_Handler, %function 209PendSV_Handler: 210 ldr r0,=PendSV_Handler 211 bx r0 212 .size PendSV_Handler, . - PendSV_Handler 213 214 .align 1 215 .thumb_func 216 .weak SysTick_Handler 217 .type SysTick_Handler, %function 218SysTick_Handler: 219 ldr r0,=SysTick_Handler 220 bx r0 221 .size SysTick_Handler, . - SysTick_Handler 222 223 .align 1 224 .thumb_func 225 .weak SPI0_IRQHandler 226 .type SPI0_IRQHandler, %function 227SPI0_IRQHandler: 228 ldr r0,=SPI0_DriverIRQHandler 229 bx r0 230 .size SPI0_IRQHandler, . - SPI0_IRQHandler 231 232 .align 1 233 .thumb_func 234 .weak SPI1_IRQHandler 235 .type SPI1_IRQHandler, %function 236SPI1_IRQHandler: 237 ldr r0,=SPI1_DriverIRQHandler 238 bx r0 239 .size SPI1_IRQHandler, . - SPI1_IRQHandler 240 241 .align 1 242 .thumb_func 243 .weak Reserved18_IRQHandler 244 .type Reserved18_IRQHandler, %function 245Reserved18_IRQHandler: 246 ldr r0,=Reserved18_DriverIRQHandler 247 bx r0 248 .size Reserved18_IRQHandler, . - Reserved18_IRQHandler 249 250 .align 1 251 .thumb_func 252 .weak USART0_IRQHandler 253 .type USART0_IRQHandler, %function 254USART0_IRQHandler: 255 ldr r0,=USART0_DriverIRQHandler 256 bx r0 257 .size USART0_IRQHandler, . - USART0_IRQHandler 258 259 .align 1 260 .thumb_func 261 .weak USART1_IRQHandler 262 .type USART1_IRQHandler, %function 263USART1_IRQHandler: 264 ldr r0,=USART1_DriverIRQHandler 265 bx r0 266 .size USART1_IRQHandler, . - USART1_IRQHandler 267 268 .align 1 269 .thumb_func 270 .weak USART2_IRQHandler 271 .type USART2_IRQHandler, %function 272USART2_IRQHandler: 273 ldr r0,=USART2_DriverIRQHandler 274 bx r0 275 .size USART2_IRQHandler, . - USART2_IRQHandler 276 277 .align 1 278 .thumb_func 279 .weak Reserved22_IRQHandler 280 .type Reserved22_IRQHandler, %function 281Reserved22_IRQHandler: 282 ldr r0,=Reserved22_DriverIRQHandler 283 bx r0 284 .size Reserved22_IRQHandler, . - Reserved22_IRQHandler 285 286 .align 1 287 .thumb_func 288 .weak Reserved23_IRQHandler 289 .type Reserved23_IRQHandler, %function 290Reserved23_IRQHandler: 291 ldr r0,=Reserved23_DriverIRQHandler 292 bx r0 293 .size Reserved23_IRQHandler, . - Reserved23_IRQHandler 294 295 .align 1 296 .thumb_func 297 .weak I2C0_IRQHandler 298 .type I2C0_IRQHandler, %function 299I2C0_IRQHandler: 300 ldr r0,=I2C0_DriverIRQHandler 301 bx r0 302 .size I2C0_IRQHandler, . - I2C0_IRQHandler 303 304 .align 1 305 .thumb_func 306 .weak SCT0_IRQHandler 307 .type SCT0_IRQHandler, %function 308SCT0_IRQHandler: 309 ldr r0,=SCT0_DriverIRQHandler 310 bx r0 311 .size SCT0_IRQHandler, . - SCT0_IRQHandler 312 313 .align 1 314 .thumb_func 315 .weak MRT0_IRQHandler 316 .type MRT0_IRQHandler, %function 317MRT0_IRQHandler: 318 ldr r0,=MRT0_DriverIRQHandler 319 bx r0 320 .size MRT0_IRQHandler, . - MRT0_IRQHandler 321 322 .align 1 323 .thumb_func 324 .weak CMP_IRQHandler 325 .type CMP_IRQHandler, %function 326CMP_IRQHandler: 327 ldr r0,=CMP_DriverIRQHandler 328 bx r0 329 .size CMP_IRQHandler, . - CMP_IRQHandler 330 331 .align 1 332 .thumb_func 333 .weak WDT_IRQHandler 334 .type WDT_IRQHandler, %function 335WDT_IRQHandler: 336 ldr r0,=WDT_DriverIRQHandler 337 bx r0 338 .size WDT_IRQHandler, . - WDT_IRQHandler 339 340 .align 1 341 .thumb_func 342 .weak BOD_IRQHandler 343 .type BOD_IRQHandler, %function 344BOD_IRQHandler: 345 ldr r0,=BOD_DriverIRQHandler 346 bx r0 347 .size BOD_IRQHandler, . - BOD_IRQHandler 348 349 .align 1 350 .thumb_func 351 .weak Reserved30_IRQHandler 352 .type Reserved30_IRQHandler, %function 353Reserved30_IRQHandler: 354 ldr r0,=Reserved30_DriverIRQHandler 355 bx r0 356 .size Reserved30_IRQHandler, . - Reserved30_IRQHandler 357 358 .align 1 359 .thumb_func 360 .weak WKT_IRQHandler 361 .type WKT_IRQHandler, %function 362WKT_IRQHandler: 363 ldr r0,=WKT_DriverIRQHandler 364 bx r0 365 .size WKT_IRQHandler, . - WKT_IRQHandler 366 367 .align 1 368 .thumb_func 369 .weak Reserved32_IRQHandler 370 .type Reserved32_IRQHandler, %function 371Reserved32_IRQHandler: 372 ldr r0,=Reserved32_DriverIRQHandler 373 bx r0 374 .size Reserved32_IRQHandler, . - Reserved32_IRQHandler 375 376 .align 1 377 .thumb_func 378 .weak Reserved33_IRQHandler 379 .type Reserved33_IRQHandler, %function 380Reserved33_IRQHandler: 381 ldr r0,=Reserved33_DriverIRQHandler 382 bx r0 383 .size Reserved33_IRQHandler, . - Reserved33_IRQHandler 384 385 .align 1 386 .thumb_func 387 .weak Reserved34_IRQHandler 388 .type Reserved34_IRQHandler, %function 389Reserved34_IRQHandler: 390 ldr r0,=Reserved34_DriverIRQHandler 391 bx r0 392 .size Reserved34_IRQHandler, . - Reserved34_IRQHandler 393 394 .align 1 395 .thumb_func 396 .weak Reserved35_IRQHandler 397 .type Reserved35_IRQHandler, %function 398Reserved35_IRQHandler: 399 ldr r0,=Reserved35_DriverIRQHandler 400 bx r0 401 .size Reserved35_IRQHandler, . - Reserved35_IRQHandler 402 403 .align 1 404 .thumb_func 405 .weak Reserved36_IRQHandler 406 .type Reserved36_IRQHandler, %function 407Reserved36_IRQHandler: 408 ldr r0,=Reserved36_DriverIRQHandler 409 bx r0 410 .size Reserved36_IRQHandler, . - Reserved36_IRQHandler 411 412 .align 1 413 .thumb_func 414 .weak Reserved37_IRQHandler 415 .type Reserved37_IRQHandler, %function 416Reserved37_IRQHandler: 417 ldr r0,=Reserved37_DriverIRQHandler 418 bx r0 419 .size Reserved37_IRQHandler, . - Reserved37_IRQHandler 420 421 .align 1 422 .thumb_func 423 .weak Reserved38_IRQHandler 424 .type Reserved38_IRQHandler, %function 425Reserved38_IRQHandler: 426 ldr r0,=Reserved38_DriverIRQHandler 427 bx r0 428 .size Reserved38_IRQHandler, . - Reserved38_IRQHandler 429 430 .align 1 431 .thumb_func 432 .weak Reserved39_IRQHandler 433 .type Reserved39_IRQHandler, %function 434Reserved39_IRQHandler: 435 ldr r0,=Reserved39_DriverIRQHandler 436 bx r0 437 .size Reserved39_IRQHandler, . - Reserved39_IRQHandler 438 439 .align 1 440 .thumb_func 441 .weak PIN_INT0_IRQHandler 442 .type PIN_INT0_IRQHandler, %function 443PIN_INT0_IRQHandler: 444 ldr r0,=PIN_INT0_DriverIRQHandler 445 bx r0 446 .size PIN_INT0_IRQHandler, . - PIN_INT0_IRQHandler 447 448 .align 1 449 .thumb_func 450 .weak PIN_INT1_IRQHandler 451 .type PIN_INT1_IRQHandler, %function 452PIN_INT1_IRQHandler: 453 ldr r0,=PIN_INT1_DriverIRQHandler 454 bx r0 455 .size PIN_INT1_IRQHandler, . - PIN_INT1_IRQHandler 456 457 .align 1 458 .thumb_func 459 .weak PIN_INT2_IRQHandler 460 .type PIN_INT2_IRQHandler, %function 461PIN_INT2_IRQHandler: 462 ldr r0,=PIN_INT2_DriverIRQHandler 463 bx r0 464 .size PIN_INT2_IRQHandler, . - PIN_INT2_IRQHandler 465 466 .align 1 467 .thumb_func 468 .weak PIN_INT3_IRQHandler 469 .type PIN_INT3_IRQHandler, %function 470PIN_INT3_IRQHandler: 471 ldr r0,=PIN_INT3_DriverIRQHandler 472 bx r0 473 .size PIN_INT3_IRQHandler, . - PIN_INT3_IRQHandler 474 475 .align 1 476 .thumb_func 477 .weak PIN_INT4_IRQHandler 478 .type PIN_INT4_IRQHandler, %function 479PIN_INT4_IRQHandler: 480 ldr r0,=PIN_INT4_DriverIRQHandler 481 bx r0 482 .size PIN_INT4_IRQHandler, . - PIN_INT4_IRQHandler 483 484 .align 1 485 .thumb_func 486 .weak PIN_INT5_IRQHandler 487 .type PIN_INT5_IRQHandler, %function 488PIN_INT5_IRQHandler: 489 ldr r0,=PIN_INT5_DriverIRQHandler 490 bx r0 491 .size PIN_INT5_IRQHandler, . - PIN_INT5_IRQHandler 492 493 .align 1 494 .thumb_func 495 .weak PIN_INT6_IRQHandler 496 .type PIN_INT6_IRQHandler, %function 497PIN_INT6_IRQHandler: 498 ldr r0,=PIN_INT6_DriverIRQHandler 499 bx r0 500 .size PIN_INT6_IRQHandler, . - PIN_INT6_IRQHandler 501 502 .align 1 503 .thumb_func 504 .weak PIN_INT7_IRQHandler 505 .type PIN_INT7_IRQHandler, %function 506PIN_INT7_IRQHandler: 507 ldr r0,=PIN_INT7_DriverIRQHandler 508 bx r0 509 .size PIN_INT7_IRQHandler, . - PIN_INT7_IRQHandler 510 511/* Macro to define default handlers. Default handler 512 * will be weak symbol and just dead loops. They can be 513 * overwritten by other handlers */ 514 .macro def_irq_handler handler_name 515 .weak \handler_name 516 .set \handler_name, DefaultISR 517 .endm 518 def_irq_handler SPI0_DriverIRQHandler 519 def_irq_handler SPI1_DriverIRQHandler 520 def_irq_handler Reserved18_DriverIRQHandler 521 def_irq_handler USART0_DriverIRQHandler 522 def_irq_handler USART1_DriverIRQHandler 523 def_irq_handler USART2_DriverIRQHandler 524 def_irq_handler Reserved22_DriverIRQHandler 525 def_irq_handler Reserved23_DriverIRQHandler 526 def_irq_handler I2C0_DriverIRQHandler 527 def_irq_handler SCT0_DriverIRQHandler 528 def_irq_handler MRT0_DriverIRQHandler 529 def_irq_handler CMP_DriverIRQHandler 530 def_irq_handler WDT_DriverIRQHandler 531 def_irq_handler BOD_DriverIRQHandler 532 def_irq_handler Reserved30_DriverIRQHandler 533 def_irq_handler WKT_DriverIRQHandler 534 def_irq_handler Reserved32_DriverIRQHandler 535 def_irq_handler Reserved33_DriverIRQHandler 536 def_irq_handler Reserved34_DriverIRQHandler 537 def_irq_handler Reserved35_DriverIRQHandler 538 def_irq_handler Reserved36_DriverIRQHandler 539 def_irq_handler Reserved37_DriverIRQHandler 540 def_irq_handler Reserved38_DriverIRQHandler 541 def_irq_handler Reserved39_DriverIRQHandler 542 def_irq_handler PIN_INT0_DriverIRQHandler 543 def_irq_handler PIN_INT1_DriverIRQHandler 544 def_irq_handler PIN_INT2_DriverIRQHandler 545 def_irq_handler PIN_INT3_DriverIRQHandler 546 def_irq_handler PIN_INT4_DriverIRQHandler 547 def_irq_handler PIN_INT5_DriverIRQHandler 548 def_irq_handler PIN_INT6_DriverIRQHandler 549 def_irq_handler PIN_INT7_DriverIRQHandler 550 551 .end 552