Skip to content

Commit e867503

Browse files
Laurent MEUNIERc1728p9
authored andcommitted
[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 bcbe0b1 commit e867503

File tree

13 files changed

+0
-44
lines changed

13 files changed

+0
-44
lines changed

targets/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

targets/TARGET_STM/TARGET_STM32F0/serial_api.c

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

93-
/* uAMR & ARM: Call to UART init is done between reset of pre-initialized variables */
94-
/* and before HAL Init. SystemCoreClock init required here */
95-
SystemCoreClockUpdate();
96-
9793
if (HAL_UART_Init(huart) != HAL_OK) {
9894
error("Cannot initialize UART\n");
9995
}

targets/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

targets/TARGET_STM/TARGET_STM32F1/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
}

targets/TARGET_STM/TARGET_STM32F2/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
}

targets/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)

targets/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");

targets/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
}

targets/TARGET_STM/TARGET_STM32F7/serial_api.c

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

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

targets/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

targets/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
}

targets/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

targets/TARGET_STM/TARGET_STM32L4/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
}

0 commit comments

Comments
 (0)