Skip to content

Commit ad3de30

Browse files
committed
system: G0: update STM32G0xx system
Allow VECT_TAB_OFFSET redefinition. Signed-off-by: Frederic Pillon <[email protected]>
1 parent bc22d00 commit ad3de30

File tree

1 file changed

+33
-18
lines changed

1 file changed

+33
-18
lines changed

Diff for: system/STM32G0xx/system_stm32g0xx.c

+33-18
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,15 @@
5353
******************************************************************************
5454
* @attention
5555
*
56-
* <h2><center>&copy; Copyright (c) 2018 STMicroelectronics.
57-
* All rights reserved.</center></h2>
56+
* Copyright (c) 2018-2021 STMicroelectronics.
57+
* All rights reserved.
5858
*
59-
* This software component is licensed by ST under Apache License, Version 2.0,
60-
* the "License"; You may not use this file except in compliance with the
61-
* License. You may obtain a copy of the License at:
62-
* opensource.org/licenses/Apache-2.0
59+
* This software is licensed under terms that can be found in the LICENSE file
60+
* in the root directory of this software component.
61+
* If no LICENSE file comes with this software, it is provided AS-IS.
6362
*
6463
******************************************************************************
6564
*/
66-
6765
/** @addtogroup CMSIS
6866
* @{
6967
*/
@@ -95,13 +93,32 @@
9593
*/
9694

9795
/************************* Miscellaneous Configuration ************************/
98-
/*!< Uncomment the following line if you need to relocate your vector Table in
99-
Internal SRAM. */
100-
/* #define VECT_TAB_SRAM */
10196
#ifndef VECT_TAB_OFFSET
102-
#define VECT_TAB_OFFSET 0x0U /*!< Vector Table base offset field.
103-
This value must be a multiple of 0x100. */
97+
#define VECT_TAB_OFFSET 0x00000000U /*!< Vector Table base offset field.
98+
This value must be a multiple of 0x200. */
99+
#else
100+
#define USER_VECT_TAB_ADDRESS
104101
#endif
102+
103+
/* Note: Following vector table addresses must be defined in line with linker
104+
configuration. */
105+
/*!< Uncomment the following line if you need to relocate the vector table
106+
anywhere in Flash or Sram, else the vector table is kept at the automatic
107+
remap of boot address selected */
108+
/* #define USER_VECT_TAB_ADDRESS */
109+
110+
#if defined(USER_VECT_TAB_ADDRESS)
111+
/*!< Uncomment the following line if you need to relocate your vector Table
112+
in Sram else user remap will be done in Flash. */
113+
/* #define VECT_TAB_SRAM */
114+
#if defined(VECT_TAB_SRAM)
115+
#define VECT_TAB_BASE_ADDRESS SRAM_BASE /*!< Vector Table base address field.
116+
This value must be a multiple of 0x200. */
117+
#else
118+
#define VECT_TAB_BASE_ADDRESS FLASH_BASE /*!< Vector Table base address field.
119+
This value must be a multiple of 0x200. */
120+
#endif /* VECT_TAB_SRAM */
121+
#endif /* USER_VECT_TAB_ADDRESS */
105122
/******************************************************************************/
106123
/**
107124
* @}
@@ -154,12 +171,10 @@
154171
*/
155172
void SystemInit(void)
156173
{
157-
/* Configure the Vector Table location add offset address ------------------*/
158-
#ifdef VECT_TAB_SRAM
159-
SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */
160-
#else
161-
SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */
162-
#endif
174+
/* Configure the Vector Table location -------------------------------------*/
175+
#if defined(USER_VECT_TAB_ADDRESS)
176+
SCB->VTOR = VECT_TAB_BASE_ADDRESS | VECT_TAB_OFFSET; /* Vector Table Relocation */
177+
#endif /* USER_VECT_TAB_ADDRESS */
163178
}
164179

165180
/**

0 commit comments

Comments
 (0)