Skip to content

Commit 6ae979f

Browse files
author
Laurent MEUNIER
committed
[STM32] remove superfluous calls to SystemCoreClockUpdate
Supported toolchains initialization steps have been modified to make sure that mbed_sdk_initi is called _after_ RAM initialization and _before_ C++ objects creation. since this was done, there is no need to redundant SystemCoreClockUpdates in the drivers
1 parent a633829 commit 6ae979f

File tree

11 files changed

+0
-34
lines changed

11 files changed

+0
-34
lines changed

hal/targets/hal/TARGET_STM/TARGET_STM32F0/pwmout_api.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,6 @@ void pwmout_period_us(pwmout_t* obj, int us) {
162162

163163
__HAL_TIM_DISABLE(&TimHandle);
164164

165-
// Update the SystemCoreClock variable
166-
SystemCoreClockUpdate();
167-
168165
/* To make it simple, we use to possible prescaler values which lead to:
169166
* pwm unit = 1us, period/pulse can be from 1us to 65535us
170167
* or

hal/targets/hal/TARGET_STM/TARGET_STM32F1/pwmout_api.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,6 @@ void pwmout_period_us(pwmout_t* obj, int us)
152152

153153
__HAL_TIM_DISABLE(&TimHandle);
154154

155-
// Update the SystemCoreClock variable
156-
SystemCoreClockUpdate();
157-
158155
/* To make it simple, we use to possible prescaler values which lead to:
159156
* pwm unit = 1us, period/pulse can be from 1us to 65535us
160157
* or

hal/targets/hal/TARGET_STM/TARGET_STM32F3/i2c_api.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,6 @@ void i2c_frequency(i2c_t *obj, int hz)
113113
timeout = LONG_TIMEOUT;
114114
while ((__HAL_I2C_GET_FLAG(&I2cHandle, I2C_FLAG_BUSY)) && (timeout-- != 0));
115115

116-
// Update the SystemCoreClock variable.
117-
SystemCoreClockUpdate();
118-
119116
/*
120117
Values calculated with I2C_Timing_Configuration_V1.0.1.xls file (see AN4235)
121118
* Standard mode (up to 100 kHz)

hal/targets/hal/TARGET_STM/TARGET_STM32F3/pwmout_api.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,6 @@ void pwmout_period_us(pwmout_t* obj, int us)
159159

160160
__HAL_TIM_DISABLE(&TimHandle);
161161

162-
// Update the SystemCoreClock variable
163-
SystemCoreClockUpdate();
164-
165162
/* To make it simple, we use to possible prescaler values which lead to:
166163
* pwm unit = 1us, period/pulse can be from 1us to 65535us
167164
* or

hal/targets/hal/TARGET_STM/TARGET_STM32F3/serial_api.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,6 @@ static void init_uart(serial_t *obj)
8282
huart->Init.Mode = UART_MODE_TX_RX;
8383
}
8484

85-
/* uAMR & ARM: Call to UART init is done between reset of pre-initialized variables */
86-
/* and before HAL Init. SystemCoreClock init required here */
87-
SystemCoreClockUpdate();
8885

8986
if (HAL_UART_Init(huart) != HAL_OK) {
9087
error("Cannot initialize UART\n");

hal/targets/hal/TARGET_STM/TARGET_STM32F4/serial_api.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,6 @@ static void init_uart(serial_t *obj)
8484
huart->Init.Mode = UART_MODE_TX_RX;
8585
}
8686

87-
/* uAMR & ARM: Call to UART init is done between reset of pre-initialized variables */
88-
/* and before HAL Init. SystemCoreClock init required here */
89-
SystemCoreClockUpdate();
90-
9187
if (HAL_UART_Init(huart) != HAL_OK) {
9288
error("Cannot initialize UART\n");
9389
}

hal/targets/hal/TARGET_STM/TARGET_STM32F7/serial_api.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,6 @@ static void init_uart(serial_t *obj)
6767
UartHandle.Init.Mode = UART_MODE_TX_RX;
6868
}
6969

70-
// Fix because HAL_RCC_GetHCLKFreq() don't update anymore SystemCoreClock
71-
SystemCoreClockUpdate();
72-
7370
if (HAL_UART_Init(&UartHandle) != HAL_OK) {
7471
error("Cannot initialize UART");
7572
}

hal/targets/hal/TARGET_STM/TARGET_STM32L1/pwmout_api.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,6 @@ void pwmout_period_us(pwmout_t* obj, int us)
166166

167167
__HAL_TIM_DISABLE(&TimHandle);
168168

169-
SystemCoreClockUpdate();
170-
171169
/* To make it simple, we use to possible prescaler values which lead to:
172170
* pwm unit = 1us, period/pulse can be from 1us to 65535us
173171
* or

hal/targets/hal/TARGET_STM/TARGET_STM32L1/serial_api.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,6 @@ static void init_uart(serial_t *obj)
8282
huart->Init.Mode = UART_MODE_TX_RX;
8383
}
8484

85-
/* uAMR & ARM: Call to UART init is done between reset of pre-initialized variables */
86-
/* and before HAL Init. SystemCoreClock init required here */
87-
SystemCoreClockUpdate();
88-
8985
if (HAL_UART_Init(huart) != HAL_OK) {
9086
error("Cannot initialize UART\n");
9187
}

hal/targets/hal/TARGET_STM/TARGET_STM32L4/pwmout_api.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,6 @@ void pwmout_period_us(pwmout_t* obj, int us)
167167

168168
__HAL_TIM_DISABLE(&TimHandle);
169169

170-
SystemCoreClockUpdate();
171-
172170
/* To make it simple, we use to possible prescaler values which lead to:
173171
* pwm unit = 1us, period/pulse can be from 1us to 65535us
174172
* or

0 commit comments

Comments
 (0)