Skip to content

Commit 07cddbf

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 429d2e6 + 4302720 commit 07cddbf

File tree

27 files changed

+654
-135
lines changed

27 files changed

+654
-135
lines changed

libraries/mbed/common/stdio.cpp renamed to libraries/mbed/common/retarget.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "FileSystemLike.h"
1919
#include "FilePath.h"
2020
#include "serial_api.h"
21+
#include "toolchain.h"
2122
#include <errno.h>
2223

2324
#if defined(__ARMCC_VERSION)
@@ -386,4 +387,9 @@ namespace __gnu_cxx {
386387
error("Exception");
387388
}
388389
}
390+
extern "C" WEAK void __cxa_pure_virtual(void);
391+
extern "C" WEAK void __cxa_pure_virtual(void) {
392+
exit(1);
393+
}
394+
389395
#endif

libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_KL05Z/cmsis_nvic.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,21 @@
77

88
#define NVIC_NUM_VECTORS (16 + 32) // CORE + MCU Peripherals
99
#define NVIC_RAM_VECTOR_ADDRESS (0x1FFFFC00) // Vectors positioned at start of RAM
10+
#define NVIC_FLASH_VECTOR_ADDRESS (0x0) // Initial vector position in flash
1011

1112
void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) {
12-
static volatile uint32_t *vectors = (uint32_t*)NVIC_RAM_VECTOR_ADDRESS;
13+
uint32_t *vectors = (uint32_t*)SCB->VTOR;
1314
uint32_t i;
1415

1516
// Copy and switch to dynamic vectors if the first time called
16-
if (SCB->VTOR != NVIC_RAM_VECTOR_ADDRESS) {
17-
uint32_t *old_vectors = (uint32_t*)SCB->VTOR;
17+
if (SCB->VTOR == NVIC_FLASH_VECTOR_ADDRESS) {
18+
uint32_t *old_vectors = vectors;
19+
vectors = (uint32_t*)NVIC_RAM_VECTOR_ADDRESS;
1820
for (i=0; i<NVIC_NUM_VECTORS; i++) {
1921
vectors[i] = old_vectors[i];
2022
}
21-
SCB->VTOR = (uint32_t)vectors;
23+
SCB->VTOR = (uint32_t)NVIC_RAM_VECTOR_ADDRESS;
2224
}
23-
2425
vectors[IRQn + 16] = vector;
2526
}
2627

libraries/mbed/targets/cmsis/TARGET_Freescale/TARGET_KL25Z/cmsis_nvic.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,21 @@
77

88
#define NVIC_NUM_VECTORS (16 + 32) // CORE + MCU Peripherals
99
#define NVIC_RAM_VECTOR_ADDRESS (0x1FFFF000) // Vectors positioned at start of RAM
10+
#define NVIC_FLASH_VECTOR_ADDRESS (0x0) // Initial vector position in flash
1011

1112
void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) {
12-
static volatile uint32_t* vectors = (uint32_t*)NVIC_RAM_VECTOR_ADDRESS;
13-
int i;
14-
15-
// Copy and switch to dynamic vectors if first time called
16-
if (SCB->VTOR != NVIC_RAM_VECTOR_ADDRESS) {
17-
uint32_t *old_vectors = (uint32_t*)SCB->VTOR;
13+
uint32_t *vectors = (uint32_t*)SCB->VTOR;
14+
uint32_t i;
15+
16+
// Copy and switch to dynamic vectors if the first time called
17+
if (SCB->VTOR == NVIC_FLASH_VECTOR_ADDRESS) {
18+
uint32_t *old_vectors = vectors;
19+
vectors = (uint32_t*)NVIC_RAM_VECTOR_ADDRESS;
1820
for (i=0; i<NVIC_NUM_VECTORS; i++) {
1921
vectors[i] = old_vectors[i];
2022
}
21-
SCB->VTOR = (uint32_t)vectors;
23+
SCB->VTOR = (uint32_t)NVIC_RAM_VECTOR_ADDRESS;
2224
}
23-
2425
vectors[IRQn + 16] = vector;
2526
}
2627

libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC13XX/cmsis_nvic.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,21 @@
77

88
#define NVIC_NUM_VECTORS (16 + 32) // CORE + MCU Peripherals
99
#define NVIC_RAM_VECTOR_ADDRESS (0x10000000) // Location of vectors in RAM
10+
#define NVIC_FLASH_VECTOR_ADDRESS (0x0) // Initial vector position in flash
1011

1112
void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) {
12-
static volatile uint32_t* vectors = (uint32_t*)NVIC_RAM_VECTOR_ADDRESS;
13-
int i;
14-
// Copy and switch to dynamic vectors if first time called
15-
if (SCB->VTOR != NVIC_RAM_VECTOR_ADDRESS) {
16-
uint32_t *old_vectors = (uint32_t*)SCB->VTOR;
13+
uint32_t *vectors = (uint32_t*)SCB->VTOR;
14+
uint32_t i;
15+
16+
// Copy and switch to dynamic vectors if the first time called
17+
if (SCB->VTOR == NVIC_FLASH_VECTOR_ADDRESS) {
18+
uint32_t *old_vectors = vectors;
19+
vectors = (uint32_t*)NVIC_RAM_VECTOR_ADDRESS;
1720
for (i=0; i<NVIC_NUM_VECTORS; i++) {
1821
vectors[i] = old_vectors[i];
1922
}
20-
SCB->VTOR = (uint32_t)vectors;
23+
SCB->VTOR = (uint32_t)NVIC_RAM_VECTOR_ADDRESS;
2124
}
22-
2325
vectors[IRQn + 16] = vector;
2426
}
2527

libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC176X/cmsis_nvic.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,21 @@
77

88
#define NVIC_NUM_VECTORS (16 + 33) // CORE + MCU Peripherals
99
#define NVIC_RAM_VECTOR_ADDRESS (0x10000000) // Location of vectors in RAM
10+
#define NVIC_FLASH_VECTOR_ADDRESS (0x0) // Initial vector position in flash
1011

1112
void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) {
12-
static volatile uint32_t* vectors = (uint32_t*)NVIC_RAM_VECTOR_ADDRESS;
13-
int i;
14-
// Copy and switch to dynamic vectors if first time called
15-
if (SCB->VTOR != NVIC_RAM_VECTOR_ADDRESS) {
16-
uint32_t *old_vectors = (uint32_t*)SCB->VTOR;
13+
uint32_t *vectors = (uint32_t*)SCB->VTOR;
14+
uint32_t i;
15+
16+
// Copy and switch to dynamic vectors if the first time called
17+
if (SCB->VTOR == NVIC_FLASH_VECTOR_ADDRESS) {
18+
uint32_t *old_vectors = vectors;
19+
vectors = (uint32_t*)NVIC_RAM_VECTOR_ADDRESS;
1720
for (i=0; i<NVIC_NUM_VECTORS; i++) {
1821
vectors[i] = old_vectors[i];
1922
}
20-
SCB->VTOR = (uint32_t)vectors;
23+
SCB->VTOR = (uint32_t)NVIC_RAM_VECTOR_ADDRESS;
2124
}
22-
2325
vectors[IRQn + 16] = vector;
2426
}
2527

libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC408X/cmsis_nvic.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,21 @@
77

88
#define NVIC_NUM_VECTORS (16 + 41) // CORE + MCU Peripherals
99
#define NVIC_RAM_VECTOR_ADDRESS (0x10000000) // Location of vectors in RAM
10+
#define NVIC_FLASH_VECTOR_ADDRESS (0x0) // Initial vector position in flash
1011

1112
void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) {
12-
static volatile uint32_t* vectors = (uint32_t*)NVIC_RAM_VECTOR_ADDRESS;
13-
int i;
14-
// Copy and switch to dynamic vectors if first time called
15-
if (SCB->VTOR != NVIC_RAM_VECTOR_ADDRESS) {
16-
uint32_t *old_vectors = (uint32_t*)SCB->VTOR;
13+
uint32_t *vectors = (uint32_t*)SCB->VTOR;
14+
uint32_t i;
15+
16+
// Copy and switch to dynamic vectors if the first time called
17+
if (SCB->VTOR == NVIC_FLASH_VECTOR_ADDRESS) {
18+
uint32_t *old_vectors = vectors;
19+
vectors = (uint32_t*)NVIC_RAM_VECTOR_ADDRESS;
1720
for (i=0; i<NVIC_NUM_VECTORS; i++) {
1821
vectors[i] = old_vectors[i];
1922
}
20-
SCB->VTOR = (uint32_t)vectors;
23+
SCB->VTOR = (uint32_t)NVIC_RAM_VECTOR_ADDRESS;
2124
}
22-
2325
vectors[IRQn + 16] = vector;
2426
}
2527

libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC43XX/cmsis_nvic.c

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,25 @@
88
#define NVIC_NUM_VECTORS (16 + 53) // CORE + MCU Peripherals
99
#define NVIC_RAM_VECTOR_ADDRESS (0x10000000) // Location of vectors in RAM
1010

11+
// The LPC43xx can boot from multiple memories (internal Flash, external NOR,
12+
// external SPIFI) so we don't know the initial value of VTOR. Thus we use
13+
// a variable to keep track if the vector table was relocated or not
14+
static unsigned char vtor_relocated;
15+
1116
void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) {
12-
static volatile uint32_t* vectors = (uint32_t*)NVIC_RAM_VECTOR_ADDRESS;
13-
int i;
17+
uint32_t *vectors = (uint32_t*)SCB->VTOR;
18+
uint32_t i;
19+
1420
// Copy and switch to dynamic vectors if first time called
15-
if (SCB->VTOR != NVIC_RAM_VECTOR_ADDRESS) {
16-
uint32_t *old_vectors = (uint32_t*)SCB->VTOR;
21+
if (!vtor_relocated) {
22+
uint32_t *old_vectors = vectors;
23+
vectors = (uint32_t*)NVIC_RAM_VECTOR_ADDRESS;
1724
for (i=0; i<NVIC_NUM_VECTORS; i++) {
1825
vectors[i] = old_vectors[i];
1926
}
20-
SCB->VTOR = (uint32_t)vectors;
27+
SCB->VTOR = (uint32_t)NVIC_RAM_VECTOR_ADDRESS;
28+
vtor_relocated = 1;
2129
}
22-
2330
vectors[IRQn + 16] = vector;
2431
}
2532

libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC81X/cmsis_nvic.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,21 @@
77

88
#define NVIC_NUM_VECTORS (16 + 32) // CORE + MCU Peripherals
99
#define NVIC_RAM_VECTOR_ADDRESS (0x10000000) // Vectors positioned at start of RAM
10+
#define NVIC_FLASH_VECTOR_ADDRESS (0x0) // Initial vector position in flash
1011

1112
void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) {
12-
static volatile uint32_t* vectors = (uint32_t*)NVIC_RAM_VECTOR_ADDRESS;
13-
int i;
14-
15-
// Copy and switch to dynamic vectors if first time called
16-
if (SCB->VTOR != NVIC_RAM_VECTOR_ADDRESS) {
17-
uint32_t *old_vectors = (uint32_t*)SCB->VTOR;
13+
uint32_t *vectors = (uint32_t*)SCB->VTOR;
14+
uint32_t i;
15+
16+
// Copy and switch to dynamic vectors if the first time called
17+
if (SCB->VTOR == NVIC_FLASH_VECTOR_ADDRESS) {
18+
uint32_t *old_vectors = vectors;
19+
vectors = (uint32_t*)NVIC_RAM_VECTOR_ADDRESS;
1820
for (i=0; i<NVIC_NUM_VECTORS; i++) {
1921
vectors[i] = old_vectors[i];
2022
}
21-
SCB->VTOR = (uint32_t)vectors;
23+
SCB->VTOR = (uint32_t)NVIC_RAM_VECTOR_ADDRESS;
2224
}
23-
2425
vectors[IRQn + 16] = vector;
2526
}
2627

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
; *************************************************************
2+
; *** Scatter-Loading Description File generated by uVision ***
3+
; *************************************************************
4+
5+
LR_IROM1 0x08000000 0x00100000 { ; load region size_region
6+
ER_IROM1 0x08000000 0x00100000 { ; load address = execution address
7+
*.o (RESET, +First)
8+
*(InRoot$$Sections)
9+
.ANY (+RO)
10+
}
11+
RW_IRAM1 0x10000000 0x00010000 { ; CCM
12+
}
13+
RW_IRAM2 0x20000188 0x0001FE78 {
14+
.ANY (+RW +ZI)
15+
}
16+
}
17+

0 commit comments

Comments
 (0)