File tree Expand file tree Collapse file tree 14 files changed +7
-39
lines changed
libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32F0 Expand file tree Collapse file tree 14 files changed +7
-39
lines changed Original file line number Diff line number Diff line change 33
33
#define NVIC_RAM_VECTOR_ADDRESS (0x20000000) // Vectors positioned at start of RAM
34
34
#define NVIC_FLASH_VECTOR_ADDRESS (0x08000000) // Initial vector position in flash
35
35
36
- int NVIC_vtor_remap = 0 ; // To keep track that the vectors remap is done
37
-
38
36
void NVIC_SetVector (IRQn_Type IRQn , uint32_t vector ) {
39
37
int i ;
40
38
41
39
// Copy and switch to dynamic vectors if first time called
42
- if (NVIC_vtor_remap == 0 ) {
40
+ if (( SYSCFG -> CFGR1 & SYSCFG_CFGR1_MEM_MODE ) != SYSCFG_CFGR1_MEM_MODE ) {
43
41
uint32_t * old_vectors = (uint32_t * )NVIC_FLASH_VECTOR_ADDRESS ;
44
42
for (i = 0 ; i < NVIC_NUM_VECTORS ; i ++ ) {
45
43
* ((uint32_t * )(NVIC_RAM_VECTOR_ADDRESS + (i * 4 ))) = old_vectors [i ];
46
44
}
47
45
SYSCFG -> CFGR1 |= SYSCFG_CFGR1_MEM_MODE ; // Embedded SRAM mapped at 0x00000000
48
- NVIC_vtor_remap = 1 ; // The vectors remap is done
49
46
}
50
47
51
48
// Set the vector
Original file line number Diff line number Diff line change @@ -160,7 +160,6 @@ uint8_t SetSysClock_PLL_HSI(void);
160
160
* @{
161
161
*/
162
162
163
- extern int NVIC_vtor_remap ;
164
163
165
164
/**
166
165
* @brief Setup the microcontroller system.
@@ -229,7 +228,6 @@ void SystemInit(void)
229
228
230
229
/* Configure the Cube driver */
231
230
SystemCoreClock = 8000000 ; // At this stage the HSI is used as system clock
232
- NVIC_vtor_remap = 0 ; // Because it is not cleared the first time we enter in NVIC_SetVector()
233
231
HAL_Init ();
234
232
235
233
/* Configure the System clock source, PLL Multiplier and Divider factors,
Original file line number Diff line number Diff line change 33
33
#define NVIC_RAM_VECTOR_ADDRESS (0x20000000) // Vectors positioned at start of RAM
34
34
#define NVIC_FLASH_VECTOR_ADDRESS (0x08000000) // Initial vector position in flash
35
35
36
- int NVIC_vtor_remap = 0 ; // To keep track that the vectors remap is done
37
36
38
37
void NVIC_SetVector (IRQn_Type IRQn , uint32_t vector ) {
39
38
int i ;
40
39
41
40
// Copy and switch to dynamic vectors if first time called
42
- if (NVIC_vtor_remap == 0 ) {
41
+ if (( SYSCFG -> CFGR1 & SYSCFG_CFGR1_MEM_MODE ) != SYSCFG_CFGR1_MEM_MODE ) {
43
42
uint32_t * old_vectors = (uint32_t * )NVIC_FLASH_VECTOR_ADDRESS ;
44
43
for (i = 0 ; i < NVIC_NUM_VECTORS ; i ++ ) {
45
44
* ((uint32_t * )(NVIC_RAM_VECTOR_ADDRESS + (i * 4 ))) = old_vectors [i ];
46
45
}
47
46
SYSCFG -> CFGR1 |= SYSCFG_CFGR1_MEM_MODE ; // Embedded SRAM mapped at 0x00000000
48
- NVIC_vtor_remap = 1 ; // The vectors remap is done
49
47
}
50
48
51
49
// Set the vector
Original file line number Diff line number Diff line change @@ -161,7 +161,6 @@ uint8_t SetSysClock_PLL_HSI(void);
161
161
* @{
162
162
*/
163
163
164
- extern int NVIC_vtor_remap ;
165
164
166
165
/**
167
166
* @brief Setup the microcontroller system.
@@ -230,7 +229,6 @@ void SystemInit(void)
230
229
231
230
/* Configure the Cube driver */
232
231
SystemCoreClock = 8000000 ; // At this stage the HSI is used as system clock
233
- NVIC_vtor_remap = 0 ; // Because it is not cleared the first time we enter in NVIC_SetVector()
234
232
HAL_Init ();
235
233
236
234
/* Configure the System clock source, PLL Multiplier and Divider factors,
Original file line number Diff line number Diff line change 33
33
#define NVIC_RAM_VECTOR_ADDRESS (0x20000000) // Vectors positioned at start of RAM
34
34
#define NVIC_FLASH_VECTOR_ADDRESS (0x08000000) // Initial vector position in flash
35
35
36
- int NVIC_vtor_remap = 0 ; // To keep track that the vectors remap is done
37
36
38
37
void NVIC_SetVector (IRQn_Type IRQn , uint32_t vector ) {
39
38
int i ;
40
39
41
40
// Copy and switch to dynamic vectors if first time called
42
- if (NVIC_vtor_remap == 0 ) {
41
+ if (( SYSCFG -> CFGR1 & SYSCFG_CFGR1_MEM_MODE ) != SYSCFG_CFGR1_MEM_MODE ) {
43
42
uint32_t * old_vectors = (uint32_t * )NVIC_FLASH_VECTOR_ADDRESS ;
44
43
for (i = 0 ; i < NVIC_NUM_VECTORS ; i ++ ) {
45
44
* ((uint32_t * )(NVIC_RAM_VECTOR_ADDRESS + (i * 4 ))) = old_vectors [i ];
46
45
}
47
46
SYSCFG -> CFGR1 |= SYSCFG_CFGR1_MEM_MODE ; // Embedded SRAM mapped at 0x00000000
48
- NVIC_vtor_remap = 1 ; // The vectors remap is done
49
47
}
50
48
51
49
// Set the vector
Original file line number Diff line number Diff line change @@ -161,7 +161,6 @@ uint8_t SetSysClock_PLL_HSI(void);
161
161
* @{
162
162
*/
163
163
164
- extern int NVIC_vtor_remap ;
165
164
166
165
/**
167
166
* @brief Setup the microcontroller system.
@@ -230,7 +229,6 @@ void SystemInit(void)
230
229
231
230
/* Configure the Cube driver */
232
231
SystemCoreClock = 8000000 ; // At this stage the HSI is used as system clock
233
- NVIC_vtor_remap = 0 ; // Because it is not cleared the first time we enter in NVIC_SetVector()
234
232
HAL_Init ();
235
233
236
234
/* Configure the System clock source, PLL Multiplier and Divider factors,
Original file line number Diff line number Diff line change 33
33
#define NVIC_RAM_VECTOR_ADDRESS (0x20000000) // Vectors positioned at start of RAM
34
34
#define NVIC_FLASH_VECTOR_ADDRESS (0x08000000) // Initial vector position in flash
35
35
36
- int NVIC_vtor_remap = 0 ; // To keep track that the vectors remap is done
37
36
38
37
void NVIC_SetVector (IRQn_Type IRQn , uint32_t vector ) {
39
38
int i ;
40
39
41
40
// Copy and switch to dynamic vectors if first time called
42
- if (NVIC_vtor_remap == 0 ) {
41
+ if (( SYSCFG -> CFGR1 & SYSCFG_CFGR1_MEM_MODE ) != SYSCFG_CFGR1_MEM_MODE ) {
43
42
uint32_t * old_vectors = (uint32_t * )NVIC_FLASH_VECTOR_ADDRESS ;
44
43
for (i = 0 ; i < NVIC_NUM_VECTORS ; i ++ ) {
45
44
* ((uint32_t * )(NVIC_RAM_VECTOR_ADDRESS + (i * 4 ))) = old_vectors [i ];
46
45
}
47
46
SYSCFG -> CFGR1 |= SYSCFG_CFGR1_MEM_MODE ; // Embedded SRAM mapped at 0x00000000
48
- NVIC_vtor_remap = 1 ; // The vectors remap is done
49
47
}
50
48
51
49
// Set the vector
Original file line number Diff line number Diff line change @@ -161,7 +161,6 @@ uint8_t SetSysClock_PLL_HSI(void);
161
161
* @{
162
162
*/
163
163
164
- extern int NVIC_vtor_remap ;
165
164
166
165
/**
167
166
* @brief Setup the microcontroller system.
@@ -230,7 +229,6 @@ void SystemInit(void)
230
229
231
230
/* Configure the Cube driver */
232
231
SystemCoreClock = 8000000 ; // At this stage the HSI is used as system clock
233
- NVIC_vtor_remap = 0 ; // Because it is not cleared the first time we enter in NVIC_SetVector()
234
232
HAL_Init ();
235
233
236
234
/* Configure the System clock source, PLL Multiplier and Divider factors,
Original file line number Diff line number Diff line change 33
33
#define NVIC_RAM_VECTOR_ADDRESS (0x20000000) // Vectors positioned at start of RAM
34
34
#define NVIC_FLASH_VECTOR_ADDRESS (0x08000000) // Initial vector position in flash
35
35
36
- int NVIC_vtor_remap = 0 ; // To keep track that the vectors remap is done
37
36
38
37
void NVIC_SetVector (IRQn_Type IRQn , uint32_t vector ) {
39
38
int i ;
40
39
41
40
// Copy and switch to dynamic vectors if first time called
42
- if (NVIC_vtor_remap == 0 ) {
41
+ if (( SYSCFG -> CFGR1 & SYSCFG_CFGR1_MEM_MODE ) != SYSCFG_CFGR1_MEM_MODE ) {
43
42
uint32_t * old_vectors = (uint32_t * )NVIC_FLASH_VECTOR_ADDRESS ;
44
43
for (i = 0 ; i < NVIC_NUM_VECTORS ; i ++ ) {
45
44
* ((uint32_t * )(NVIC_RAM_VECTOR_ADDRESS + (i * 4 ))) = old_vectors [i ];
46
45
}
47
46
SYSCFG -> CFGR1 |= SYSCFG_CFGR1_MEM_MODE ; // Embedded SRAM mapped at 0x00000000
48
- NVIC_vtor_remap = 1 ; // The vectors remap is done
49
47
}
50
48
51
49
// Set the vector
Original file line number Diff line number Diff line change @@ -161,7 +161,6 @@ uint8_t SetSysClock_PLL_HSI(void);
161
161
* @{
162
162
*/
163
163
164
- extern int NVIC_vtor_remap ;
165
164
166
165
/**
167
166
* @brief Setup the microcontroller system.
@@ -230,7 +229,6 @@ void SystemInit(void)
230
229
231
230
/* Configure the Cube driver */
232
231
SystemCoreClock = 8000000 ; // At this stage the HSI is used as system clock
233
- NVIC_vtor_remap = 0 ; // Because it is not cleared the first time we enter in NVIC_SetVector()
234
232
HAL_Init ();
235
233
236
234
/* Configure the System clock source, PLL Multiplier and Divider factors,
Original file line number Diff line number Diff line change 33
33
#define NVIC_RAM_VECTOR_ADDRESS (0x20000000) // Vectors positioned at start of RAM
34
34
#define NVIC_FLASH_VECTOR_ADDRESS (0x08000000) // Initial vector position in flash
35
35
36
- int NVIC_vtor_remap = 0 ; // To keep track that the vectors remap is done
37
36
38
37
void NVIC_SetVector (IRQn_Type IRQn , uint32_t vector ) {
39
38
int i ;
40
39
41
40
// Copy and switch to dynamic vectors if first time called
42
- if (NVIC_vtor_remap == 0 ) {
41
+ if (( SYSCFG -> CFGR1 & SYSCFG_CFGR1_MEM_MODE ) != SYSCFG_CFGR1_MEM_MODE ) {
43
42
uint32_t * old_vectors = (uint32_t * )NVIC_FLASH_VECTOR_ADDRESS ;
44
43
for (i = 0 ; i < NVIC_NUM_VECTORS ; i ++ ) {
45
44
* ((uint32_t * )(NVIC_RAM_VECTOR_ADDRESS + (i * 4 ))) = old_vectors [i ];
46
45
}
47
46
SYSCFG -> CFGR1 |= SYSCFG_CFGR1_MEM_MODE ; // Embedded SRAM mapped at 0x00000000
48
- NVIC_vtor_remap = 1 ; // The vectors remap is done
49
47
}
50
48
51
49
// Set the vector
Original file line number Diff line number Diff line change @@ -161,8 +161,6 @@ uint8_t SetSysClock_PLL_HSI(void);
161
161
* @{
162
162
*/
163
163
164
- extern int NVIC_vtor_remap ;
165
-
166
164
/**
167
165
* @brief Setup the microcontroller system.
168
166
* Initialize the default HSI clock source, vector table location and the PLL configuration is reset.
@@ -230,7 +228,6 @@ void SystemInit(void)
230
228
231
229
/* Configure the Cube driver */
232
230
SystemCoreClock = 8000000 ; // At this stage the HSI is used as system clock
233
- NVIC_vtor_remap = 0 ; // Because it is not cleared the first time we enter in NVIC_SetVector()
234
231
HAL_Init ();
235
232
236
233
/* Configure the System clock source, PLL Multiplier and Divider factors,
Original file line number Diff line number Diff line change 33
33
#define NVIC_RAM_VECTOR_ADDRESS (0x20000000) // Vectors positioned at start of RAM
34
34
#define NVIC_FLASH_VECTOR_ADDRESS (0x08000000) // Initial vector position in flash
35
35
36
- int NVIC_vtor_remap = 0 ; // To keep track that the vectors remap is done
37
-
38
36
void NVIC_SetVector (IRQn_Type IRQn , uint32_t vector ) {
39
37
int i ;
40
38
41
39
// Copy and switch to dynamic vectors if first time called
42
- if (NVIC_vtor_remap == 0 ) {
40
+ if (( SYSCFG -> CFGR1 & SYSCFG_CFGR1_MEM_MODE ) != SYSCFG_CFGR1_MEM_MODE ) {
43
41
uint32_t * old_vectors = (uint32_t * )NVIC_FLASH_VECTOR_ADDRESS ;
44
42
for (i = 0 ; i < NVIC_NUM_VECTORS ; i ++ ) {
45
43
* ((uint32_t * )(NVIC_RAM_VECTOR_ADDRESS + (i * 4 ))) = old_vectors [i ];
46
44
}
47
45
SYSCFG -> CFGR1 |= SYSCFG_CFGR1_MEM_MODE ; // Embedded SRAM mapped at 0x00000000
48
- NVIC_vtor_remap = 1 ; // The vectors remap is done
49
46
}
50
47
51
48
// Set the vector
Original file line number Diff line number Diff line change @@ -161,8 +161,6 @@ uint8_t SetSysClock_PLL_HSI(void);
161
161
* @{
162
162
*/
163
163
164
- extern int NVIC_vtor_remap ;
165
-
166
164
/**
167
165
* @brief Setup the microcontroller system.
168
166
* Initialize the default HSI clock source, vector table location and the PLL configuration is reset.
@@ -230,7 +228,6 @@ void SystemInit(void)
230
228
231
229
/* Configure the Cube driver */
232
230
SystemCoreClock = 8000000 ; // At this stage the HSI is used as system clock
233
- NVIC_vtor_remap = 0 ; // Because it is not cleared the first time we enter in NVIC_SetVector()
234
231
HAL_Init ();
235
232
236
233
/* Configure the System clock source, PLL Multiplier and Divider factors,
You can’t perform that action at this time.
0 commit comments