Skip to content

Commit 9f757b4

Browse files
committed
Review system Timer config
Set TICK_INT_PRIORITY to 0 (Highest priority) by default, it can be redefined. Time base configuration function (HAL_InitTick ()) is called automatically at the beginning of the program after reset by HAL_Init() or at any time when clock is configured, by HAL_RCC_ClockConfig(). The HAL_SYSTICK_Config()function calls the SysTick_Config() function which is a CMSIS function that: Configures the SysTick Reload register with value passed as function parameter. Configures the SysTick IRQ priority to the TICK_INT_PRIORITY. Resets the SysTick Counter register. Configures the SysTick Counter clock source to be Core Clock Source (HCLK). Enables the SysTick Interrupt. Starts the SysTick Counter. So, SystemClock_Config() (variant.cpp) does not need to be set explicitly. Signed-off-by: Frederic.Pillon <[email protected]>
1 parent 6159139 commit 9f757b4

File tree

62 files changed

+12
-423
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+12
-423
lines changed

Diff for: system/STM32F0xx/stm32f0xx_hal_conf_default.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ in voltage and temperature. */
167167
*/
168168
#define VDD_VALUE 3300U /*!< Value of VDD in mv */
169169
#if !defined (TICK_INT_PRIORITY)
170-
#define TICK_INT_PRIORITY ((uint32_t)(1U<<__NVIC_PRIO_BITS) - 1U) /*!< tick interrupt priority (lowest by default) */
170+
#define TICK_INT_PRIORITY 0x00U /*!< tick interrupt priority */
171171
#endif
172172
#if !defined (USE_RTOS)
173173
#define USE_RTOS 0U

Diff for: system/STM32F1xx/stm32f1xx_hal_conf_default.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ extern "C" {
144144
*/
145145
#define VDD_VALUE 3300U /*!< Value of VDD in mv */
146146
#if !defined (TICK_INT_PRIORITY)
147-
#define TICK_INT_PRIORITY 0x0FU /*!< tick interrupt priority */
147+
#define TICK_INT_PRIORITY 0x00U /*!< tick interrupt priority */
148148
#endif
149149
#if !defined (USE_RTOS)
150150
#define USE_RTOS 0U

Diff for: system/STM32F2xx/stm32f2xx_hal_conf_default.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ in voltage and temperature.*/
150150
*/
151151
#define VDD_VALUE 3300U /*!< Value of VDD in mv */
152152
#if !defined (TICK_INT_PRIORITY)
153-
#define TICK_INT_PRIORITY 0x0FU /*!< tick interrupt priority */
153+
#define TICK_INT_PRIORITY 0x00U /*!< tick interrupt priority */
154154
#endif
155155
#if !defined (USE_RTOS)
156156
#define USE_RTOS 0U

Diff for: system/STM32F3xx/stm32f3xx_hal_conf_default.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ in voltage and temperature. */
167167
*/
168168
#define VDD_VALUE (3300U) /*!< Value of VDD in mv */
169169
#if !defined (TICK_INT_PRIORITY)
170-
#define TICK_INT_PRIORITY ((uint32_t)(1U<<__NVIC_PRIO_BITS) - 1U) /*!< tick interrupt priority (lowest by default) */
170+
#define TICK_INT_PRIORITY 0x00U /*!< tick interrupt priority */
171171
#endif
172172
#if !defined (USE_RTOS)
173173
#define USE_RTOS 0U

Diff for: system/STM32F4xx/stm32f4xx_hal_conf_default.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ in voltage and temperature. */
148148
*/
149149
#define VDD_VALUE 3300U /*!< Value of VDD in mv */
150150
#if !defined (TICK_INT_PRIORITY)
151-
#define TICK_INT_PRIORITY 0x0FU /*!< tick interrupt priority */
151+
#define TICK_INT_PRIORITY 0x00U /*!< tick interrupt priority */
152152
#endif
153153
#if !defined (USE_RTOS)
154154
#define USE_RTOS 0U

Diff for: system/STM32F7xx/stm32f7xx_hal_conf_default.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ in voltage and temperature. */
148148
*/
149149
#define VDD_VALUE 3300U /*!< Value of VDD in mv */
150150
#if !defined (TICK_INT_PRIORITY)
151-
#define TICK_INT_PRIORITY 0x0FU /*!< tick interrupt priority */
151+
#define TICK_INT_PRIORITY 0x00U /*!< tick interrupt priority */
152152
#endif
153153
#if !defined (USE_RTOS)
154154
#define USE_RTOS 0U

Diff for: system/STM32G0xx/stm32g0xx_hal_conf_default.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ in voltage and temperature.*/
150150
*/
151151
#define VDD_VALUE (3300UL) /*!< Value of VDD in mv */
152152
#if !defined (TICK_INT_PRIORITY)
153-
#define TICK_INT_PRIORITY ((1UL<<__NVIC_PRIO_BITS) - 1UL) /*!< tick interrupt priority */
153+
#define TICK_INT_PRIORITY 0x00U /*!< tick interrupt priority */
154154
#endif
155155
#if !defined (USE_RTOS)
156156
#define USE_RTOS 0U

Diff for: system/STM32H7xx/stm32h7xx_hal_conf_default.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ in voltage and temperature.*/
161161
*/
162162
#define VDD_VALUE ((uint32_t)3300) /*!< Value of VDD in mv */
163163
#if !defined (TICK_INT_PRIORITY)
164-
#define TICK_INT_PRIORITY ((uint32_t)0x0F) /*!< tick interrupt priority */
164+
#define TICK_INT_PRIORITY ((uint32_t)0x00) /*!< tick interrupt priority */
165165
#endif
166166
#if !defined (USE_RTOS)
167167
#define USE_RTOS 0

Diff for: system/STM32L0xx/stm32l0xx_hal_conf_default.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ in voltage and temperature.*/
141141
*/
142142
#define VDD_VALUE ((uint32_t)3300U) /*!< Value of VDD in mv */
143143
#if !defined (TICK_INT_PRIORITY)
144-
#define TICK_INT_PRIORITY (((uint32_t)1U<<__NVIC_PRIO_BITS) - 1U) /*!< tick interrupt priority */
144+
#define TICK_INT_PRIORITY 0x00U /*!< tick interrupt priority */
145145
#endif
146146
#if !defined (USE_RTOS)
147147
#define USE_RTOS 0U

Diff for: system/STM32L1xx/stm32l1xx_hal_conf_default.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ in voltage and temperature.*/
131131
*/
132132
#define VDD_VALUE (3300U) /*!< Value of VDD in mv */
133133
#if !defined (TICK_INT_PRIORITY)
134-
#define TICK_INT_PRIORITY (0x000FU) /*!< tick interrupt priority */
134+
#define TICK_INT_PRIORITY (0x0000U) /*!< tick interrupt priority */
135135
#endif
136136
#if !defined (USE_RTOS)
137137
#define USE_RTOS 0U

Diff for: system/STM32L4xx/stm32l4xx_hal_conf_default.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ in voltage and temperature.*/
179179
*/
180180
#define VDD_VALUE 3300U /*!< Value of VDD in mv */
181181
#if !defined (TICK_INT_PRIORITY)
182-
#define TICK_INT_PRIORITY 0x0FU /*!< tick interrupt priority */
182+
#define TICK_INT_PRIORITY 0x00U /*!< tick interrupt priority */
183183
#endif
184184
#if !defined (USE_RTOS)
185185
#define USE_RTOS 0U

Diff for: system/STM32WBxx/stm32wbxx_hal_conf_default.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ in voltage and temperature.*/
180180
*/
181181
#define VDD_VALUE (3300UL) /*!< Value of VDD in mv */
182182
#if !defined (TICK_INT_PRIORITY)
183-
#define TICK_INT_PRIORITY ((1UL<<__NVIC_PRIO_BITS) - 1UL) /*!< tick interrupt priority (lowest by default) */
183+
#define TICK_INT_PRIORITY 0x00U /*!< tick interrupt priority */
184184
#endif
185185
#if !defined (USE_RTOS)
186186
#define USE_RTOS 0

Diff for: variants/ARMED_V1/variant.cpp

-6
Original file line numberDiff line numberDiff line change
@@ -178,12 +178,6 @@ WEAK void SystemClock_Config(void)
178178
/* Enable the Flash prefetch */
179179
__HAL_FLASH_PREFETCH_BUFFER_ENABLE();
180180
}
181-
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / 1000);
182-
183-
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
184-
185-
/* SysTick_IRQn interrupt configuration */
186-
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
187181
}
188182

189183
#ifdef __cplusplus

Diff for: variants/BLACK_F407XX/variant.cpp

-11
Original file line numberDiff line numberDiff line change
@@ -222,17 +222,6 @@ WEAK void SystemClock_Config(void)
222222
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5) != HAL_OK) {
223223
_Error_Handler(__FILE__, __LINE__);
224224
}
225-
226-
/**Configure the Systick interrupt time
227-
*/
228-
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / 1000);
229-
230-
/**Configure the Systick
231-
*/
232-
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
233-
234-
/* SysTick_IRQn interrupt configuration */
235-
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
236225
}
237226

238227
#ifdef __cplusplus

Diff for: variants/BLACK_F407XX/variant.h

-3
Original file line numberDiff line numberDiff line change
@@ -316,9 +316,6 @@ extern "C" {
316316
#define PIN_SERIAL_RX PA10
317317
#define PIN_SERIAL_TX PA9
318318

319-
/* HAL configuration */
320-
#define TICK_INT_PRIORITY 0U
321-
322319
/* Extra HAL modules */
323320
#define HAL_DAC_MODULE_ENABLED
324321
#define HAL_SD_MODULE_ENABLED

Diff for: variants/BLUEPILL_F103XX/variant.cpp

-9
Original file line numberDiff line numberDiff line change
@@ -138,15 +138,6 @@ WEAK void SystemClock_Config(void)
138138
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK) {
139139
while (1);
140140
}
141-
142-
/* Configure the Systick interrupt time */
143-
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / 1000);
144-
145-
/* Configure the Systick */
146-
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
147-
148-
/* SysTick_IRQn interrupt configuration */
149-
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
150141
}
151142

152143
#ifdef __cplusplus

Diff for: variants/BLUE_F407VE_Mini/variant.cpp

-11
Original file line numberDiff line numberDiff line change
@@ -202,17 +202,6 @@ WEAK void SystemClock_Config(void)
202202
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5) != HAL_OK) {
203203
_Error_Handler(__FILE__, __LINE__);
204204
}
205-
206-
/**Configure the Systick interrupt time
207-
*/
208-
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / 1000);
209-
210-
/**Configure the Systick
211-
*/
212-
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
213-
214-
/* SysTick_IRQn interrupt configuration */
215-
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
216205
}
217206

218207
#ifdef __cplusplus

Diff for: variants/BLUE_F407VE_Mini/variant.h

-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,6 @@ extern "C" {
193193

194194
/* HAL configuration */
195195
#define HSE_VALUE 25000000U
196-
#define TICK_INT_PRIORITY 0U
197196

198197
/* Extra HAL modules */
199198
#define HAL_DAC_MODULE_ENABLED

Diff for: variants/DEMO_F030F4/variant.cpp

-9
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,6 @@ WEAK void SystemClock_Config(void)
110110
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK) {
111111
_Error_Handler(__FILE__, __LINE__);
112112
}
113-
114-
/* Configure the Systick interrupt time */
115-
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / 1000);
116-
117-
/* Configure the Systick */
118-
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
119-
120-
/* SysTick_IRQn interrupt configuration */
121-
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
122113
}
123114

124115
#ifdef __cplusplus

Diff for: variants/DISCO_F030R8/variant.cpp

-9
Original file line numberDiff line numberDiff line change
@@ -164,15 +164,6 @@ WEAK void SystemClock_Config(void)
164164
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK) {
165165
Error_Handler();
166166
}
167-
168-
/* Configure the Systick interrupt time */
169-
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / 1000);
170-
171-
/* Configure the Systick */
172-
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
173-
174-
/* SysTick_IRQn interrupt configuration */
175-
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
176167
}
177168

178169
#ifdef __cplusplus

Diff for: variants/DISCO_F072RB/variant.cpp

-9
Original file line numberDiff line numberDiff line change
@@ -160,15 +160,6 @@ WEAK void SystemClock_Config(void)
160160
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK) {
161161
Error_Handler();
162162
}
163-
164-
/* Configure the Systick interrupt time */
165-
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / 1000);
166-
167-
/* Configure the Systick */
168-
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
169-
170-
/* SysTick_IRQn interrupt configuration */
171-
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
172163
}
173164

174165
#ifdef __cplusplus

Diff for: variants/DISCO_F100RB/variant.cpp

-7
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,6 @@ WEAK void SystemClock_Config(void)
150150
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK) {
151151
while (1);
152152
}
153-
154-
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / 1000);
155-
156-
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
157-
158-
/* SysTick_IRQn interrupt configuration */
159-
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
160153
}
161154

162155
#ifdef __cplusplus

Diff for: variants/DISCO_F407VG/variant.cpp

-6
Original file line numberDiff line numberDiff line change
@@ -188,12 +188,6 @@ WEAK void SystemClock_Config(void)
188188
/* Enable the Flash prefetch */
189189
__HAL_FLASH_PREFETCH_BUFFER_ENABLE();
190190
}
191-
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / 1000);
192-
193-
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
194-
195-
/* SysTick_IRQn interrupt configuration */
196-
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
197191
}
198192

199193
#ifdef __cplusplus

Diff for: variants/DISCO_F746NG/variant.cpp

-9
Original file line numberDiff line numberDiff line change
@@ -138,15 +138,6 @@ WEAK void SystemClock_Config(void)
138138
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK) {
139139
_Error_Handler(__FILE__, __LINE__);
140140
}
141-
142-
/* Configure the Systick interrupt time */
143-
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / 1000);
144-
145-
/* Configure the Systick */
146-
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
147-
148-
/* SysTick_IRQn interrupt configuration */
149-
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
150141
}
151142

152143
#ifdef __cplusplus

Diff for: variants/DISCO_L072CZ_LRWAN1/variant.cpp

-7
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,6 @@ WEAK void SystemClock_Config(void)
120120
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK) {
121121
Error_Handler();
122122
}
123-
124-
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / 1000);
125-
126-
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
127-
128-
/* SysTick_IRQn interrupt configuration */
129-
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
130123
}
131124

132125
#ifdef __cplusplus

Diff for: variants/DISCO_L475VG_IOT/variant.cpp

-11
Original file line numberDiff line numberDiff line change
@@ -229,20 +229,9 @@ WEAK void SystemClock_Config(void)
229229
Error_Handler();
230230
}
231231

232-
/**Configure the Systick interrupt time
233-
*/
234-
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / 1000);
235-
236-
/**Configure the Systick
237-
*/
238-
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
239-
240232
/**Enable MSI Auto calibration
241233
*/
242234
HAL_RCCEx_EnableMSIPLLMode();
243-
244-
/* SysTick_IRQn interrupt configuration */
245-
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
246235
}
247236

248237
#ifdef __cplusplus

Diff for: variants/DIYMROE_F407VGT/variant.cpp

-9
Original file line numberDiff line numberDiff line change
@@ -203,15 +203,6 @@ WEAK void SystemClock_Config(void)
203203
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5) != HAL_OK) {
204204
_Error_Handler(__FILE__, __LINE__);
205205
}
206-
207-
/* Configure the Systick interrupt time */
208-
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / 1000);
209-
210-
/* Configure the Systick */
211-
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
212-
213-
/* SysTick_IRQn interrupt configuration */
214-
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
215206
}
216207

217208
#ifdef __cplusplus

Diff for: variants/EEXTR_F030_V1/variant.cpp

-9
Original file line numberDiff line numberDiff line change
@@ -136,15 +136,6 @@ WEAK void SystemClock_Config(void)
136136
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK) {
137137
Error_Handler();
138138
}
139-
140-
/* Configure the Systick interrupt time */
141-
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / 1000);
142-
143-
/* Configure the Systick */
144-
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
145-
146-
/* SysTick_IRQn interrupt configuration */
147-
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
148139
}
149140

150141
#ifdef __cplusplus

Diff for: variants/FK407M1/variant.cpp

-9
Original file line numberDiff line numberDiff line change
@@ -150,15 +150,6 @@ WEAK void SystemClock_Config(void)
150150
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5) != HAL_OK) {
151151
_Error_Handler(__FILE__, __LINE__);
152152
}
153-
154-
/* Configure the Systick interrupt time */
155-
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / 1000);
156-
157-
/* Configure the Systick */
158-
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
159-
160-
/* SysTick_IRQn interrupt configuration */
161-
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
162153
}
163154

164155
#ifdef __cplusplus

Diff for: variants/FK407M1/variant.h

-4
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,6 @@ extern "C" {
165165
#define PIN_SERIAL_RX PA10
166166
#define PIN_SERIAL_TX PA9
167167

168-
169-
/* HAL configuration */
170-
#define TICK_INT_PRIORITY 0U
171-
172168
/* Extra HAL modules */
173169
#define HAL_DAC_MODULE_ENABLED
174170

Diff for: variants/HY_TinySTM103T/variant.cpp

-9
Original file line numberDiff line numberDiff line change
@@ -143,15 +143,6 @@ WEAK void SystemClock_Config(void)
143143
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK) {
144144
while (1);
145145
}
146-
147-
/* Configure the Systick interrupt time */
148-
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / 1000);
149-
150-
/* Configure the Systick */
151-
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
152-
153-
/* SysTick_IRQn interrupt configuration */
154-
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
155146
}
156147

157148
#ifdef __cplusplus

0 commit comments

Comments
 (0)