Skip to content

Commit 8f04458

Browse files
committed
[L0] Update CMSIS Cortex-Mx Device Peripheral Access Layer System Source File
Signed-off-by: Frederic Pillon <[email protected]>
1 parent e502bcc commit 8f04458

File tree

1 file changed

+27
-30
lines changed

1 file changed

+27
-30
lines changed

system/STM32L0xx/system_stm32l0xx.c

Lines changed: 27 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,33 @@
6464
*/
6565
/************************* Miscellaneous Configuration ************************/
6666

67-
/*!< Uncomment the following line if you need to relocate your vector Table in
68-
Internal SRAM. */
69-
/* #define VECT_TAB_SRAM */
7067
#ifndef VECT_TAB_OFFSET
7168
#define VECT_TAB_OFFSET 0x00U /*!< Vector Table base offset field.
7269
This value must be a multiple of 0x100. */
70+
#else
71+
define USER_VECT_TAB_ADDRESS
7372
#endif
73+
74+
/* Note: Following vector table addresses must be defined in line with linker
75+
configuration. */
76+
/*!< Uncomment the following line if you need to relocate the vector table
77+
anywhere in Flash or Sram, else the vector table is kept at the automatic
78+
remap of boot address selected */
79+
/* #define USER_VECT_TAB_ADDRESS */
80+
81+
#if defined(USER_VECT_TAB_ADDRESS)
82+
/*!< Uncomment the following line if you need to relocate your vector Table
83+
in Sram else user remap will be done in Flash. */
84+
/* #define VECT_TAB_SRAM */
85+
#if defined(VECT_TAB_SRAM)
86+
#define VECT_TAB_BASE_ADDRESS SRAM_BASE /*!< Vector Table base address field.
87+
This value must be a multiple of 0x200. */
88+
#else
89+
#define VECT_TAB_BASE_ADDRESS FLASH_BASE /*!< Vector Table base address field.
90+
This value must be a multiple of 0x200. */
91+
#endif /* VECT_TAB_SRAM */
92+
#endif /* USER_VECT_TAB_ADDRESS */
93+
7494
/******************************************************************************/
7595
/**
7696
* @}
@@ -123,37 +143,14 @@
123143
*/
124144
void SystemInit (void)
125145
{
126-
/*!< Set MSION bit */
127-
RCC->CR |= (uint32_t)0x00000100U;
128-
129-
/*!< Reset SW[1:0], HPRE[3:0], PPRE1[2:0], PPRE2[2:0], MCOSEL[2:0] and MCOPRE[2:0] bits */
130-
RCC->CFGR &= (uint32_t) 0x88FF400CU;
131-
132-
/*!< Reset HSION, HSIDIVEN, HSEON, CSSON and PLLON bits */
133-
RCC->CR &= (uint32_t)0xFEF6FFF6U;
134-
135-
/*!< Reset HSI48ON bit */
136-
RCC->CRRCR &= (uint32_t)0xFFFFFFFEU;
137-
138-
/*!< Reset HSEBYP bit */
139-
RCC->CR &= (uint32_t)0xFFFBFFFFU;
140-
141-
/*!< Reset PLLSRC, PLLMUL[3:0] and PLLDIV[1:0] bits */
142-
RCC->CFGR &= (uint32_t)0xFF02FFFFU;
143-
144-
/*!< Disable all interrupts */
145-
RCC->CIER = 0x00000000U;
146-
147146
/* Configure the Vector Table location add offset address ------------------*/
148-
#ifdef VECT_TAB_SRAM
149-
SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */
150-
#else
151-
SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */
152-
#endif
147+
#if defined (USER_VECT_TAB_ADDRESS)
148+
SCB->VTOR = VECT_TAB_BASE_ADDRESS | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */
149+
#endif /* USER_VECT_TAB_ADDRESS */
153150
}
154151

155152
/**
156-
* @brief Update SystemCoreClock according to Clock Register Values
153+
* @brief Update SystemCoreClock variable according to Clock Register Values.
157154
* The SystemCoreClock variable contains the core clock (HCLK), it can
158155
* be used by the user application to setup the SysTick timer or configure
159156
* other parameters.

0 commit comments

Comments
 (0)