Skip to content

Commit 8c7668d

Browse files
committed
[WB] Update the system source file
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
1 parent 2208479 commit 8c7668d

File tree

1 file changed

+24
-14
lines changed

1 file changed

+24
-14
lines changed

system/STM32WBxx/system_stm32wbxx.c

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@
6363
* <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
6464
* All rights reserved.</center></h2>
6565
*
66-
* This software component is licensed by ST under BSD 3-Clause license,
66+
* This software component is licensed by ST under Apache License, Version 2.0,
6767
* the "License"; You may not use this file except in compliance with the
6868
* License. You may obtain a copy of the License at:
69-
* opensource.org/licenses/BSD-3-Clause
69+
* opensource.org/licenses/Apache-2.0
7070
*
7171
******************************************************************************
7272
*/
@@ -101,17 +101,30 @@
101101
* @{
102102
*/
103103

104-
/*!< Uncomment the following line if you need to relocate your vector Table in
105-
Internal SRAM. */
106-
/* #define VECT_TAB_SRAM */
107104
#ifndef VECT_TAB_OFFSET
108-
#define VECT_TAB_OFFSET 0x0U /*!< Vector Table base offset field.
105+
#define VECT_TAB_OFFSET 0x00000000U /*!< Vector Table base offset field.
109106
This value must be a multiple of 0x200. */
107+
#else
108+
#define USER_VECT_TAB_ADDRESS
110109
#endif
111-
#ifndef VECT_TAB_BASE_ADDRESS
112-
#define VECT_TAB_BASE_ADDRESS SRAM1_BASE /*!< Vector Table base offset field.
110+
111+
/* Note: Following vector table addresses must be defined in line with linker
112+
configuration. */
113+
/*!< Define USER_VECT_TAB_ADDRESS if you need to relocate CPU1 CM4 and/or CPU2
114+
CM0+ vector table anywhere in Sram or Flash. Else vector table will be kept
115+
at address 0x00 which correspond to automatic remap of boot address selected */
116+
#if defined(USER_VECT_TAB_ADDRESS)
117+
/*!< Define VECT_TAB_SRAM for user vector table remap in Sram else user remap
118+
will be done in Flash. */
119+
#if defined(VECT_TAB_SRAM)
120+
#define VECT_TAB_BASE_ADDRESS SRAM1_BASE /*!< Vector Table base address field.
121+
This value must be a multiple of 0x200. */
122+
#else
123+
#define VECT_TAB_BASE_ADDRESS FLASH_BASE /*!< Vector Table base address field.
113124
This value must be a multiple of 0x200. */
114125
#endif
126+
#endif
127+
115128
/**
116129
* @}
117130
*/
@@ -144,7 +157,7 @@
144157
const uint32_t MSIRangeTable[16UL] = {100000UL, 200000UL, 400000UL, 800000UL, 1000000UL, 2000000UL, \
145158
4000000UL, 8000000UL, 16000000UL, 24000000UL, 32000000UL, 48000000UL, 0UL, 0UL, 0UL, 0UL}; /* 0UL values are incorrect cases */
146159

147-
#if defined(STM32WB55xx) || defined(STM32WB5Mxx) || defined(STM32WB35xx)
160+
#if defined(STM32WB55xx) || defined(STM32WB5Mxx) || defined(STM32WB35xx) || defined (STM32WB15xx) || defined (STM32WB10xx)
148161
const uint32_t SmpsPrescalerTable[4UL][6UL]={{1UL,3UL,2UL,2UL,1UL,2UL}, \
149162
{2UL,6UL,4UL,3UL,2UL,4UL}, \
150163
{4UL,12UL,8UL,6UL,4UL,8UL}, \
@@ -174,12 +187,9 @@
174187
*/
175188
void SystemInit(void)
176189
{
190+
#if defined(USER_VECT_TAB_ADDRESS)
177191
/* Configure the Vector Table location add offset address ------------------*/
178-
#if defined(VECT_TAB_SRAM) && defined(VECT_TAB_BASE_ADDRESS)
179-
/* program in SRAMx */
180-
SCB->VTOR = VECT_TAB_BASE_ADDRESS | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAMx for CPU1 */
181-
#else /* program in FLASH */
182-
SCB->VTOR = VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */
192+
SCB->VTOR = VECT_TAB_BASE_ADDRESS | VECT_TAB_OFFSET;
183193
#endif
184194

185195
/* FPU settings ------------------------------------------------------------*/

0 commit comments

Comments
 (0)