mirror of https://github.com/ARMmbed/mbed-os.git
Change the check for vector table relocation
Allows the user to specify his own VTOR location. Fixes PRMBED-1065.pull/17/merge
parent
5f0bd9d283
commit
14409cd7fd
|
@ -7,13 +7,14 @@
|
|||
|
||||
#define NVIC_NUM_VECTORS (16 + 32) // CORE + MCU Peripherals
|
||||
#define NVIC_RAM_VECTOR_ADDRESS (0x1FFFFC00) // Vectors positioned at start of RAM
|
||||
#define NVIC_FLASH_VECTOR_ADDRESS (0x0) // Initial vector position in flash
|
||||
|
||||
void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) {
|
||||
static volatile uint32_t *vectors = (uint32_t*)NVIC_RAM_VECTOR_ADDRESS;
|
||||
uint32_t i;
|
||||
|
||||
// Copy and switch to dynamic vectors if the first time called
|
||||
if (SCB->VTOR != NVIC_RAM_VECTOR_ADDRESS) {
|
||||
if (SCB->VTOR == NVIC_FLASH_VECTOR_ADDRESS) {
|
||||
uint32_t *old_vectors = (uint32_t*)SCB->VTOR;
|
||||
for (i=0; i<NVIC_NUM_VECTORS; i++) {
|
||||
vectors[i] = old_vectors[i];
|
||||
|
|
|
@ -7,13 +7,14 @@
|
|||
|
||||
#define NVIC_NUM_VECTORS (16 + 32) // CORE + MCU Peripherals
|
||||
#define NVIC_RAM_VECTOR_ADDRESS (0x1FFFF000) // Vectors positioned at start of RAM
|
||||
#define NVIC_FLASH_VECTOR_ADDRESS (0x0) // Initial vector position in flash
|
||||
|
||||
void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) {
|
||||
static volatile uint32_t* vectors = (uint32_t*)NVIC_RAM_VECTOR_ADDRESS;
|
||||
int i;
|
||||
|
||||
// Copy and switch to dynamic vectors if first time called
|
||||
if (SCB->VTOR != NVIC_RAM_VECTOR_ADDRESS) {
|
||||
if (SCB->VTOR == NVIC_FLASH_VECTOR_ADDRESS) {
|
||||
uint32_t *old_vectors = (uint32_t*)SCB->VTOR;
|
||||
for (i=0; i<NVIC_NUM_VECTORS; i++) {
|
||||
vectors[i] = old_vectors[i];
|
||||
|
|
|
@ -7,12 +7,13 @@
|
|||
|
||||
#define NVIC_NUM_VECTORS (16 + 32) // CORE + MCU Peripherals
|
||||
#define NVIC_RAM_VECTOR_ADDRESS (0x10000000) // Location of vectors in RAM
|
||||
#define NVIC_FLASH_VECTOR_ADDRESS (0x0) // Initial vector position in flash
|
||||
|
||||
void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) {
|
||||
static volatile uint32_t* vectors = (uint32_t*)NVIC_RAM_VECTOR_ADDRESS;
|
||||
int i;
|
||||
// Copy and switch to dynamic vectors if first time called
|
||||
if (SCB->VTOR != NVIC_RAM_VECTOR_ADDRESS) {
|
||||
if (SCB->VTOR == NVIC_FLASH_VECTOR_ADDRESS) {
|
||||
uint32_t *old_vectors = (uint32_t*)SCB->VTOR;
|
||||
for (i=0; i<NVIC_NUM_VECTORS; i++) {
|
||||
vectors[i] = old_vectors[i];
|
||||
|
|
|
@ -7,12 +7,13 @@
|
|||
|
||||
#define NVIC_NUM_VECTORS (16 + 33) // CORE + MCU Peripherals
|
||||
#define NVIC_RAM_VECTOR_ADDRESS (0x10000000) // Location of vectors in RAM
|
||||
#define NVIC_FLASH_VECTOR_ADDRESS (0x0) // Initial vector position in flash
|
||||
|
||||
void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) {
|
||||
static volatile uint32_t* vectors = (uint32_t*)NVIC_RAM_VECTOR_ADDRESS;
|
||||
int i;
|
||||
// Copy and switch to dynamic vectors if first time called
|
||||
if (SCB->VTOR != NVIC_RAM_VECTOR_ADDRESS) {
|
||||
if (SCB->VTOR == NVIC_FLASH_VECTOR_ADDRESS) {
|
||||
uint32_t *old_vectors = (uint32_t*)SCB->VTOR;
|
||||
for (i=0; i<NVIC_NUM_VECTORS; i++) {
|
||||
vectors[i] = old_vectors[i];
|
||||
|
|
|
@ -7,12 +7,13 @@
|
|||
|
||||
#define NVIC_NUM_VECTORS (16 + 41) // CORE + MCU Peripherals
|
||||
#define NVIC_RAM_VECTOR_ADDRESS (0x10000000) // Location of vectors in RAM
|
||||
#define NVIC_FLASH_VECTOR_ADDRESS (0x0) // Initial vector position in flash
|
||||
|
||||
void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) {
|
||||
static volatile uint32_t* vectors = (uint32_t*)NVIC_RAM_VECTOR_ADDRESS;
|
||||
int i;
|
||||
// Copy and switch to dynamic vectors if first time called
|
||||
if (SCB->VTOR != NVIC_RAM_VECTOR_ADDRESS) {
|
||||
if (SCB->VTOR == NVIC_FLASH_VECTOR_ADDRESS) {
|
||||
uint32_t *old_vectors = (uint32_t*)SCB->VTOR;
|
||||
for (i=0; i<NVIC_NUM_VECTORS; i++) {
|
||||
vectors[i] = old_vectors[i];
|
||||
|
|
|
@ -8,16 +8,22 @@
|
|||
#define NVIC_NUM_VECTORS (16 + 53) // CORE + MCU Peripherals
|
||||
#define NVIC_RAM_VECTOR_ADDRESS (0x10000000) // Location of vectors in RAM
|
||||
|
||||
// The LPC43xx can boot from multiple memories (internal Flash, external NOR,
|
||||
// external SPIFI) so we don't know the initial value of VTOR. Thus we use
|
||||
// a variable to keep track if the vector table was relocated or not
|
||||
static unsigned char vtor_relocated;
|
||||
|
||||
void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) {
|
||||
static volatile uint32_t* vectors = (uint32_t*)NVIC_RAM_VECTOR_ADDRESS;
|
||||
int i;
|
||||
// Copy and switch to dynamic vectors if first time called
|
||||
if (SCB->VTOR != NVIC_RAM_VECTOR_ADDRESS) {
|
||||
if (!vtor_relocated) {
|
||||
uint32_t *old_vectors = (uint32_t*)SCB->VTOR;
|
||||
for (i=0; i<NVIC_NUM_VECTORS; i++) {
|
||||
vectors[i] = old_vectors[i];
|
||||
}
|
||||
SCB->VTOR = (uint32_t)vectors;
|
||||
vtor_relocated = 1;
|
||||
}
|
||||
|
||||
vectors[IRQn + 16] = vector;
|
||||
|
|
|
@ -7,13 +7,14 @@
|
|||
|
||||
#define NVIC_NUM_VECTORS (16 + 32) // CORE + MCU Peripherals
|
||||
#define NVIC_RAM_VECTOR_ADDRESS (0x10000000) // Vectors positioned at start of RAM
|
||||
#define NVIC_FLASH_VECTOR_ADDRESS (0x0) // Initial vector position in flash
|
||||
|
||||
void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) {
|
||||
static volatile uint32_t* vectors = (uint32_t*)NVIC_RAM_VECTOR_ADDRESS;
|
||||
int i;
|
||||
|
||||
// Copy and switch to dynamic vectors if first time called
|
||||
if (SCB->VTOR != NVIC_RAM_VECTOR_ADDRESS) {
|
||||
if (SCB->VTOR == NVIC_FLASH_VECTOR_ADDRESS) {
|
||||
uint32_t *old_vectors = (uint32_t*)SCB->VTOR;
|
||||
for (i=0; i<NVIC_NUM_VECTORS; i++) {
|
||||
vectors[i] = old_vectors[i];
|
||||
|
|
|
@ -7,12 +7,13 @@
|
|||
|
||||
#define NVIC_NUM_VECTORS (16 + 81) // CORE + MCU Peripherals
|
||||
#define NVIC_RAM_VECTOR_ADDRESS (0x20000000) // Location of vectors in RAM
|
||||
#define NVIC_FLASH_VECTOR_ADDRESS (0x0) // Initial vector position in flash
|
||||
|
||||
void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) {
|
||||
static volatile uint32_t* vectors = (uint32_t*)NVIC_RAM_VECTOR_ADDRESS;
|
||||
int i;
|
||||
// Copy and switch to dynamic vectors if first time called
|
||||
if (SCB->VTOR != NVIC_RAM_VECTOR_ADDRESS) {
|
||||
if (SCB->VTOR == NVIC_FLASH_VECTOR_ADDRESS) {
|
||||
uint32_t *old_vectors = (uint32_t*)SCB->VTOR;
|
||||
for (i=0; i<NVIC_NUM_VECTORS; i++) {
|
||||
vectors[i] = old_vectors[i];
|
||||
|
|
Loading…
Reference in New Issue