From 6ebca5756c4204bbb8f5205c9accc66f2aa65ed1 Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Mon, 25 Apr 2016 13:52:55 +0000 Subject: Moved VTOS initialization in startup files. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9364 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/common/startup/ARMCMx/compilers/GCC/crt0_v7m.S | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'os/common/startup/ARMCMx/compilers/GCC/crt0_v7m.S') diff --git a/os/common/startup/ARMCMx/compilers/GCC/crt0_v7m.S b/os/common/startup/ARMCMx/compilers/GCC/crt0_v7m.S index 5f9668efb..3abfc1813 100644 --- a/os/common/startup/ARMCMx/compilers/GCC/crt0_v7m.S +++ b/os/common/startup/ARMCMx/compilers/GCC/crt0_v7m.S @@ -43,6 +43,7 @@ #define FPCCR_ASPEN (1 << 31) #define FPCCR_LSPEN (1 << 30) +#define SCB_VTOR 0xE000ED08 #define SCB_CPACR 0xE000ED88 #define SCB_FPCCR 0xE000EF34 #define SCB_FPDSCR 0xE000EF3C @@ -51,6 +52,14 @@ /* Module pre-compile time settings. */ /*===========================================================================*/ +/** + * @brief VTOR special register initialization. + * @details VTOR is initialized to point to the vectors table. + */ +#if !defined(CRT0_VTOR_INIT) || defined(__DOXYGEN__) +#define CRT0_VTOR_INIT TRUE +#endif + /** * @brief FPU initialization switch. */ @@ -175,6 +184,13 @@ Reset_Handler: ldr r0, =__process_stack_end__ msr PSP, r0 +#if CRT0_VTOR_INIT == TRUE + ldr r0, =_vectors + movw r1, #SCB_VTOR & 0xFFFF + movt r1, #SCB_VTOR >> 16 + str r0, [r1] +#endif + #if CRT0_INIT_FPU == TRUE /* FPU FPCCR initialization.*/ movw r0, #CRT0_FPCCR_INIT & 0xFFFF -- cgit v1.2.3