diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-12-18 10:11:51 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-12-23 09:19:17 +0100 |
commit | 272534eb725f2486b7a32b39d998202a101bd36e (patch) | |
tree | 1cd2ae81d871698e49093fb0ec2488d88e0593d9 /bsps/arm/include | |
parent | arm: Add support for Arm PMSAv8-32 (diff) | |
download | rtems-272534eb725f2486b7a32b39d998202a101bd36e.tar.bz2 |
bsps/arm: Set VBAR in start.S
Set the VBAR to the vector table in the start section before
bsp_start_hook_0() is called to earlier handle exceptions in RTEMS.
Set the VBAR to the normal vector table in start.S for the main
processor. Secondary processors set it in bsp_start_hook_0().
Update #4202.
Diffstat (limited to 'bsps/arm/include')
-rw-r--r-- | bsps/arm/include/bsp/arm-a8core-start.h | 55 | ||||
-rw-r--r-- | bsps/arm/include/bsp/arm-a9mpcore-start.h | 28 |
2 files changed, 4 insertions, 79 deletions
diff --git a/bsps/arm/include/bsp/arm-a8core-start.h b/bsps/arm/include/bsp/arm-a8core-start.h deleted file mode 100644 index d9b7274018..0000000000 --- a/bsps/arm/include/bsp/arm-a8core-start.h +++ /dev/null @@ -1,55 +0,0 @@ -/** - * @file - * - * @ingroup RTEMSBSPsARMShared - * - * @brief A8CORE_START Support - */ - -/* - * Copyright (c) 2014 Chris Johns <chrisj@rtems.org>. All rights reserved. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#ifndef LIBBSP_ARM_SHARED_ARM_A8CORE_START_H -#define LIBBSP_ARM_SHARED_ARM_A8CORE_START_H - -#include <libcpu/arm-cp15.h> - -#include <bsp.h> -#include <bsp/start.h> -#include <bsp/arm-errata.h> - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -BSP_START_TEXT_SECTION static inline void arm_a8core_start_set_vector_base(void) -{ - /* - * Do not use bsp_vector_table_begin == 0, since this will get optimized away. - */ - if (bsp_vector_table_end != bsp_vector_table_size) { - uint32_t ctrl; - - arm_cp15_set_vector_base_address(bsp_vector_table_begin); - - ctrl = arm_cp15_get_control(); - ctrl &= ~ARM_CP15_CTRL_V; - arm_cp15_set_control(ctrl); - } -} - -BSP_START_TEXT_SECTION static inline void arm_a8core_start_hook_1(void) -{ - arm_a8core_start_set_vector_base(); -} - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* LIBBSP_ARM_SHARED_ARM_A8CORE_START_H */ diff --git a/bsps/arm/include/bsp/arm-a9mpcore-start.h b/bsps/arm/include/bsp/arm-a9mpcore-start.h index 5f870acec7..f377745c56 100644 --- a/bsps/arm/include/bsp/arm-a9mpcore-start.h +++ b/bsps/arm/include/bsp/arm-a9mpcore-start.h @@ -30,6 +30,7 @@ #include <bsp.h> #include <bsp/start.h> #include <bsp/arm-a9mpcore-regs.h> +#include <bsp/arm-cp15-start.h> #include <bsp/arm-errata.h> #include <dev/irq/arm-gic-irq.h> @@ -37,27 +38,6 @@ extern "C" { #endif /* __cplusplus */ -BSP_START_TEXT_SECTION static inline void -arm_a9mpcore_start_set_vector_base(void) -{ - /* - * Do not use bsp_vector_table_begin == 0, since this will get optimized away. - */ - if (bsp_vector_table_end != bsp_vector_table_size) { - uint32_t ctrl; - - /* - * For now we assume that every Cortex-A9 MPCore has the Security Extensions. - * Later it might be necessary to evaluate the ID_PFR1 register. - */ - arm_cp15_set_vector_base_address(bsp_vector_table_begin); - - ctrl = arm_cp15_get_control(); - ctrl &= ~ARM_CP15_CTRL_V; - arm_cp15_set_control(ctrl); - } -} - BSP_START_TEXT_SECTION static inline void arm_a9mpcore_start_scu_invalidate( volatile a9mpcore_scu *scu, uint32_t cpu_id, @@ -88,10 +68,11 @@ arm_a9mpcore_start_on_secondary_processor(void) { uint32_t ctrl; - arm_a9mpcore_start_set_vector_base(); - arm_gic_irq_initialize_secondary_cpu(); + /* Change the VBAR from the start to the normal vector table */ + arm_cp15_set_vector_base_address(bsp_vector_table_begin); + ctrl = arm_cp15_start_setup_mmu_and_cache( 0, ARM_CP15_CTRL_AFE | ARM_CP15_CTRL_Z @@ -194,7 +175,6 @@ BSP_START_TEXT_SECTION static inline void arm_a9mpcore_start_global_timer(void) BSP_START_TEXT_SECTION static inline void arm_a9mpcore_start_hook_1(void) { arm_a9mpcore_start_global_timer(); - arm_a9mpcore_start_set_vector_base(); } #ifdef __cplusplus |