1 /* SPDX-License-Identifier: BSD-3-Clause */
3 /******************************************************************************
5 * Copyright (C) 2012-2018 Texas Instruments Incorporated - http://www.ti.com/
7 ******************************************************************************/
11 /* Entry point for the application. */
14 /* Reserve space for the system stack. */
15 extern uint32_t __stack_top;
17 typedef void(*pFunc)(void);
19 /* Interrupt handler prototypes */
20 void default_handler(void);
21 void reset_handler(void);
24 * The vector table. Note that the proper constructs must be placed on this to
25 * ensure that it ends up at physical address 0x0000.0000 or at the start of
26 * the program if located at a start address other than 0.
28 void (* const intr_vectors[])(void) __attribute__((section(".intvecs"))) = {
29 (pFunc)&__stack_top, /* The initial stack pointer */
30 reset_handler, /* The reset handler */
31 default_handler, /* The NMI handler */
32 default_handler, /* The hard fault handler */
33 default_handler, /* The MPU fault handler */
34 default_handler, /* The bus fault handler */
35 default_handler, /* The usage fault handler */
40 default_handler, /* SVCall handler */
41 default_handler, /* Debug monitor handler */
43 default_handler, /* The PendSV handler */
44 default_handler /* The SysTick handler */
48 * The following are constructs created by the linker, indicating where
49 * the "data" and "bss" segments reside in memory. The initializers for
50 * the "data" segment resides immediately following the "text" segment.
52 extern uint32_t __bss_start__;
53 extern uint32_t __bss_end__;
56 * This is the code that gets called when the processor first starts execution
57 * following a reset event. Only the absolutely necessary set is performed,
58 * after which the application supplied entry() routine is called. Any fancy
59 * actions (such as making decisions based on the reset cause register, and
60 * resetting the bits in that register) are left solely in the hands of the
63 __attribute__((section(".reset"))) __attribute__((naked))
64 void reset_handler(void)
66 /* Set stack pointer */
67 __asm(" MOVW.W r0, #0x1700\n"
68 " MOVT.W r0, #0x0100\n"
71 /* Zero fill the bss segment. */
72 __asm(" ldr r0, =__bss_start__\n"
73 " ldr r1, =__bss_end__\n"
79 " strlt r2, [r0], #4\n"
82 /* Call the application's entry point. */
87 * This is the code that gets called when the processor receives an unexpected
88 * interrupt. This simply enters an infinite loop, preserving the system state
89 * for examination by a debugger.
91 void default_handler(void)
93 /* Enter an infinite loop. */