|
64 | 64 | */
|
65 | 65 | /************************* Miscellaneous Configuration ************************/
|
66 | 66 |
|
67 |
| -/*!< Uncomment the following line if you need to relocate your vector Table in |
68 |
| - Internal SRAM. */ |
69 |
| -/* #define VECT_TAB_SRAM */ |
70 | 67 | #ifndef VECT_TAB_OFFSET
|
71 | 68 | #define VECT_TAB_OFFSET 0x00U /*!< Vector Table base offset field.
|
72 | 69 | This value must be a multiple of 0x100. */
|
| 70 | +#else |
| 71 | +define USER_VECT_TAB_ADDRESS |
73 | 72 | #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 | + |
74 | 94 | /******************************************************************************/
|
75 | 95 | /**
|
76 | 96 | * @}
|
|
123 | 143 | */
|
124 | 144 | void SystemInit (void)
|
125 | 145 | {
|
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 |
| - |
147 | 146 | /* 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 */ |
153 | 150 | }
|
154 | 151 |
|
155 | 152 | /**
|
156 |
| - * @brief Update SystemCoreClock according to Clock Register Values |
| 153 | + * @brief Update SystemCoreClock variable according to Clock Register Values. |
157 | 154 | * The SystemCoreClock variable contains the core clock (HCLK), it can
|
158 | 155 | * be used by the user application to setup the SysTick timer or configure
|
159 | 156 | * other parameters.
|
|
0 commit comments