mirror of
git://git.code.sf.net/p/openocd/code
synced 2025-07-19 05:55:41 +10:00
With the old checkpatch we cannot use the correct format for the SPDX tags in the file .c, in fact the C99 comments are not allowed and we had to use the block comment. With the new checkpatch, let's switch to the correct SPDX format. Change created automatically through the command: sed -i \ 's,^/\* *\(SPDX-License-Identifier: .*[^ ]\) *\*/$,// \1,' \ $(find src/ contrib/ -name \*.c) Change-Id: I6da16506baa7af718947562505dd49606d124171 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7153 Tested-by: jenkins
97 lines
3.2 KiB
C
97 lines
3.2 KiB
C
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
/******************************************************************************
|
|
*
|
|
* Copyright (C) 2012-2018 Texas Instruments Incorporated - http://www.ti.com/
|
|
*
|
|
******************************************************************************/
|
|
|
|
#include <stdint.h>
|
|
|
|
/* Entry point for the application. */
|
|
extern int main();
|
|
|
|
/* Reserve space for the system stack. */
|
|
extern uint32_t __stack_top;
|
|
|
|
typedef void(*pFunc)(void);
|
|
|
|
/* Interrupt handler prototypes */
|
|
void default_handler(void);
|
|
void reset_handler(void);
|
|
|
|
/*
|
|
* The vector table. Note that the proper constructs must be placed on this to
|
|
* ensure that it ends up at physical address 0x0000.0000 or at the start of
|
|
* the program if located at a start address other than 0.
|
|
*/
|
|
void (* const intr_vectors[])(void) __attribute__((section(".intvecs"))) = {
|
|
(pFunc)&__stack_top, /* The initial stack pointer */
|
|
reset_handler, /* The reset handler */
|
|
default_handler, /* The NMI handler */
|
|
default_handler, /* The hard fault handler */
|
|
default_handler, /* The MPU fault handler */
|
|
default_handler, /* The bus fault handler */
|
|
default_handler, /* The usage fault handler */
|
|
0, /* Reserved */
|
|
0, /* Reserved */
|
|
0, /* Reserved */
|
|
0, /* Reserved */
|
|
default_handler, /* SVCall handler */
|
|
default_handler, /* Debug monitor handler */
|
|
0, /* Reserved */
|
|
default_handler, /* The PendSV handler */
|
|
default_handler /* The SysTick handler */
|
|
};
|
|
|
|
/*
|
|
* The following are constructs created by the linker, indicating where
|
|
* the "data" and "bss" segments reside in memory. The initializers for
|
|
* the "data" segment resides immediately following the "text" segment.
|
|
*/
|
|
extern uint32_t __bss_start__;
|
|
extern uint32_t __bss_end__;
|
|
|
|
/*
|
|
* This is the code that gets called when the processor first starts execution
|
|
* following a reset event. Only the absolutely necessary set is performed,
|
|
* after which the application supplied entry() routine is called. Any fancy
|
|
* actions (such as making decisions based on the reset cause register, and
|
|
* resetting the bits in that register) are left solely in the hands of the
|
|
* application.
|
|
*/
|
|
__attribute__((section(".reset"))) __attribute__((naked))
|
|
void reset_handler(void)
|
|
{
|
|
/* Set stack pointer */
|
|
__asm(" MOVW.W r0, #0x1700\n"
|
|
" MOVT.W r0, #0x0100\n"
|
|
" mov sp, r0\n");
|
|
|
|
/* Zero fill the bss segment. */
|
|
__asm(" ldr r0, =__bss_start__\n"
|
|
" ldr r1, =__bss_end__\n"
|
|
" mov r2, #0\n"
|
|
" .thumb_func\n"
|
|
"zero_loop:\n"
|
|
" cmp r0, r1\n"
|
|
" it lt\n"
|
|
" strlt r2, [r0], #4\n"
|
|
" blt zero_loop");
|
|
|
|
/* Call the application's entry point. */
|
|
main();
|
|
}
|
|
|
|
/*
|
|
* This is the code that gets called when the processor receives an unexpected
|
|
* interrupt. This simply enters an infinite loop, preserving the system state
|
|
* for examination by a debugger.
|
|
*/
|
|
void default_handler(void)
|
|
{
|
|
/* Enter an infinite loop. */
|
|
while (1)
|
|
;
|
|
}
|