From b2d3c5d35f54083a457837193a222bc30eb2162e Mon Sep 17 00:00:00 2001 From: Laurent MEUNIER Date: Mon, 11 Jul 2016 16:14:03 +0200 Subject: [PATCH 1/6] INIT:GCC no rtos: Align pre-main initialization steps between TCs Various toolchains supported in MBED don't follow the same initialization steps. This can have impacts on platform behavior. For STM32, it is needed to call the HAL_Init() _after_ the RAM has been initialized (sdata from flash / zero initialized data) and _before_ the C++ objects are being created, especially if those objects require support of tickers for instance. In GCC, this is easily done because SystemInit is called after the ram initialisation, so HAL_Init does not need to called from mbed_sdk_init. this is covered by the changes in mbed_overrides.c files. This series should solve issue reported here: STM32 (At least F401) breaks if Tickers are activated in a global object #2115 --- hal/targets/hal/TARGET_STM/TARGET_STM32F0/mbed_overrides.c | 4 ++-- hal/targets/hal/TARGET_STM/TARGET_STM32F1/mbed_overrides.c | 2 ++ hal/targets/hal/TARGET_STM/TARGET_STM32F3/mbed_overrides.c | 2 ++ hal/targets/hal/TARGET_STM/TARGET_STM32F4/mbed_overrides.c | 2 ++ hal/targets/hal/TARGET_STM/TARGET_STM32F7/mbed_overrides.c | 2 ++ hal/targets/hal/TARGET_STM/TARGET_STM32L0/mbed_overrides.c | 4 ++++ hal/targets/hal/TARGET_STM/TARGET_STM32L1/mbed_overrides.c | 4 ++++ hal/targets/hal/TARGET_STM/TARGET_STM32L4/mbed_overrides.c | 4 ++++ 8 files changed, 22 insertions(+), 2 deletions(-) diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F0/mbed_overrides.c b/hal/targets/hal/TARGET_STM/TARGET_STM32F0/mbed_overrides.c index cf25b0328c9..a14c2980e12 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F0/mbed_overrides.c +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F0/mbed_overrides.c @@ -31,8 +31,8 @@ void mbed_sdk_init() { // Update the SystemCoreClock variable. SystemCoreClockUpdate(); - +#if !defined(TOOLCHAIN_GCC_ARM) // Need to restart HAL driver after the RAM is initialized HAL_Init(); - +#endif } diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F1/mbed_overrides.c b/hal/targets/hal/TARGET_STM/TARGET_STM32F1/mbed_overrides.c index 9783dd90a53..2252f1c8249 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F1/mbed_overrides.c +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F1/mbed_overrides.c @@ -32,6 +32,8 @@ void mbed_sdk_init() { // Update the SystemCoreClock variable. SystemCoreClockUpdate(); +#if !defined(TOOLCHAIN_GCC_ARM) // Need to restart HAL driver after the RAM is initialized HAL_Init(); +#endif } diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F3/mbed_overrides.c b/hal/targets/hal/TARGET_STM/TARGET_STM32F3/mbed_overrides.c index 9783dd90a53..2252f1c8249 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F3/mbed_overrides.c +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F3/mbed_overrides.c @@ -32,6 +32,8 @@ void mbed_sdk_init() { // Update the SystemCoreClock variable. SystemCoreClockUpdate(); +#if !defined(TOOLCHAIN_GCC_ARM) // Need to restart HAL driver after the RAM is initialized HAL_Init(); +#endif } diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/mbed_overrides.c b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/mbed_overrides.c index a21a749f800..93e4da780b3 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/mbed_overrides.c +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/mbed_overrides.c @@ -33,8 +33,10 @@ void mbed_sdk_init() { // Update the SystemCoreClock variable. SystemCoreClockUpdate(); +#if !defined(TOOLCHAIN_GCC_ARM) // Need to restart HAL driver after the RAM is initialized HAL_Init(); +#endif } /** diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F7/mbed_overrides.c b/hal/targets/hal/TARGET_STM/TARGET_STM32F7/mbed_overrides.c index 496c4adc66d..6b174b89801 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F7/mbed_overrides.c +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F7/mbed_overrides.c @@ -35,8 +35,10 @@ void mbed_sdk_init() { // Update the SystemCoreClock variable. SystemCoreClockUpdate(); +#if !defined(TOOLCHAIN_GCC_ARM) // Need to restart HAL driver after the RAM is initialized HAL_Init(); +#endif } diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32L0/mbed_overrides.c b/hal/targets/hal/TARGET_STM/TARGET_STM32L0/mbed_overrides.c index 509fed21988..4025d0aaa0c 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32L0/mbed_overrides.c +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32L0/mbed_overrides.c @@ -32,4 +32,8 @@ void mbed_sdk_init() { // Update the SystemCoreClock variable. SystemCoreClockUpdate(); +#if !defined(TOOLCHAIN_GCC_ARM) + // Need to restart HAL driver after the RAM is initialized + HAL_Init(); +#endif } diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32L1/mbed_overrides.c b/hal/targets/hal/TARGET_STM/TARGET_STM32L1/mbed_overrides.c index 74ce0cf19de..2252f1c8249 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32L1/mbed_overrides.c +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32L1/mbed_overrides.c @@ -32,4 +32,8 @@ void mbed_sdk_init() { // Update the SystemCoreClock variable. SystemCoreClockUpdate(); +#if !defined(TOOLCHAIN_GCC_ARM) + // Need to restart HAL driver after the RAM is initialized + HAL_Init(); +#endif } diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32L4/mbed_overrides.c b/hal/targets/hal/TARGET_STM/TARGET_STM32L4/mbed_overrides.c index 509fed21988..4025d0aaa0c 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32L4/mbed_overrides.c +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32L4/mbed_overrides.c @@ -32,4 +32,8 @@ void mbed_sdk_init() { // Update the SystemCoreClock variable. SystemCoreClockUpdate(); +#if !defined(TOOLCHAIN_GCC_ARM) + // Need to restart HAL driver after the RAM is initialized + HAL_Init(); +#endif } From 1348301ebddae1890795ce54ba6ef269c20f2bda Mon Sep 17 00:00:00 2001 From: Laurent MEUNIER Date: Mon, 11 Jul 2016 16:14:03 +0200 Subject: [PATCH 2/6] INIT:ARM no rtos: Align pre-main initialization steps between TCs Various toolchains supported in MBED don't followthe same initialization steps. This can have impacts on platform behavior. For STM32, it is needed to call the HAL_Init() _after_ the RAM has been initialized (sdata from flash / zero initialized data) and _before_ the C++ objects are being created, especially if those objects require support of tickers for instance. In GCC and IAR, this was done in previous commit to avoid HAL_Init() to be called twice. In ARM this there is no hook defined in MBED yet to place the call. The proposal is to take benefit of the library's _platform_post_stackheap_init function that is going to be called before __rt_lib_init where the C++ object init is done (__cpp_initialize__aeabi_) This series should solve issue reported here: STM32 (At least F401) breaks if Tickers are activated in a global object #2115 --- hal/common/retarget.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hal/common/retarget.cpp b/hal/common/retarget.cpp index 16c4c582210..3177d5b13b0 100644 --- a/hal/common/retarget.cpp +++ b/hal/common/retarget.cpp @@ -525,10 +525,14 @@ extern "C" WEAK void mbed_sdk_init(void) { extern "C" int $Super$$main(void); extern "C" int $Sub$$main(void) { - mbed_sdk_init(); mbed_main(); return $Super$$main(); } + +extern "C" void _platform_post_stackheap_init (void) { + mbed_sdk_init(); +} + #elif defined(TOOLCHAIN_GCC) extern "C" int __real_main(void); From 1bf78fd462876ecf21e9c1e28b37484707bea4db Mon Sep 17 00:00:00 2001 From: Laurent MEUNIER Date: Mon, 11 Jul 2016 16:14:03 +0200 Subject: [PATCH 3/6] INIT: uARM no rtos: Align pre-main initialization steps between TCs In uARM, the library's hook _platform_post_stackheap_init does not seem to exist and I couldnot find a documentation describing the initialisation flow. All we know is that _open is called after RAM init and before the C++ init, so this is a working placeholder. This is maybe not acceptable so a uARM lib expert may propose a better hook to fullfil the requirement. At least this is a workign setup. This series should solve issue reported here: STM32 (At least F401) breaks if Tickers are activated in a global object #2115 --- hal/common/retarget.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/hal/common/retarget.cpp b/hal/common/retarget.cpp index 3177d5b13b0..5d701083b29 100644 --- a/hal/common/retarget.cpp +++ b/hal/common/retarget.cpp @@ -149,13 +149,21 @@ static inline int openmode_to_posix(int openmode) { return posix; } +extern "C" WEAK void mbed_sdk_init(void); +extern "C" WEAK void mbed_sdk_init(void) { +} + extern "C" FILEHANDLE PREFIX(_open)(const char* name, int openmode) { #if defined(__MICROLIB) && (__ARMCC_VERSION>5030000) // Before version 5.03, we were using a patched version of microlib with proper names // This is the workaround that the microlib author suggested us static int n = 0; + static int mbed_sdk_inited = 0; + if (!mbed_sdk_inited) { + mbed_sdk_inited = 1; + mbed_sdk_init(); + } if (!std::strcmp(name, ":tt")) return n++; - #else /* Use the posix convention that stdin,out,err are filehandles 0,1,2. */ @@ -517,10 +525,6 @@ extern "C" WEAK void mbed_main(void); extern "C" WEAK void mbed_main(void) { } -extern "C" WEAK void mbed_sdk_init(void); -extern "C" WEAK void mbed_sdk_init(void) { -} - #if defined(TOOLCHAIN_ARM) extern "C" int $Super$$main(void); From 9c93aa84d987f4361ca99610d1c92873550a8e3c Mon Sep 17 00:00:00 2001 From: Laurent MEUNIER Date: Tue, 12 Jul 2016 18:09:08 +0200 Subject: [PATCH 4/6] INIT:ARM + rtos: Align pre-main initialization steps between TCs Various toolchains supported in MBED don't followthe same initialization steps. This can have impacts on platform behavior. For STM32, it is needed to call the HAL_Init() _after_ the RAM has been initialized (sdata from flash / zero initialized data) and _before_ the C++ objects are being created, especially if those objects require support of tickers for instance. In GCC and IAR, this was done in previous commit to avoid HAL_Init() to be called twice. In ARM this there is no hook defined in MBED yet to place the call. The proposal is to take benefit of the library's _platform_post_stackheap_init function that is going to be called before __rt_lib_init where the C++ object init is done (__cpp_initialize__aeabi_) In case of mbed with rtos, the __rt_entry is redefined so we need to add the call to _platform_post_stackheap_init. This series should solve issue reported here: STM32 (At least F401) breaks if Tickers are activated in a global object #2115 --- rtos/rtx/TARGET_CORTEX_M/RTX_CM_lib.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rtos/rtx/TARGET_CORTEX_M/RTX_CM_lib.h b/rtos/rtx/TARGET_CORTEX_M/RTX_CM_lib.h index 5bc6828fe83..c900c000375 100644 --- a/rtos/rtx/TARGET_CORTEX_M/RTX_CM_lib.h +++ b/rtos/rtx/TARGET_CORTEX_M/RTX_CM_lib.h @@ -746,6 +746,7 @@ void pre_main (void) __asm void __rt_entry (void) { IMPORT __user_setup_stackheap + IMPORT _platform_post_stackheap_init IMPORT os_thread_def_main IMPORT osKernelInitialize #ifdef __MBED_CMSIS_RTOS_CM @@ -766,6 +767,7 @@ __asm void __rt_entry (void) { /* Ignore return value of __user_setup_stackheap since * this will be setup by set_stack_heap */ + BL _platform_post_stackheap_init BL osKernelInitialize #ifdef __MBED_CMSIS_RTOS_CM BL set_stack_heap From a633829bf23daa192f5168d1eb386083e8226fdf Mon Sep 17 00:00:00 2001 From: Laurent MEUNIER Date: Wed, 17 Aug 2016 13:21:25 +0200 Subject: [PATCH 5/6] INIT:GCC with rtos: Align pre-main initialization steps between TCs In this commit we're moving the mbed_sdk_init call before the RTOS initialisation so that the sequence is similar to other toolchains. --- hal/common/retarget.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hal/common/retarget.cpp b/hal/common/retarget.cpp index 5d701083b29..32549735b24 100644 --- a/hal/common/retarget.cpp +++ b/hal/common/retarget.cpp @@ -510,7 +510,7 @@ extern "C" void software_init_hook(void) mbed_die(); } #endif/* FEATURE_UVISOR */ - + mbed_sdk_init(); software_init_hook_rtos(); } #endif @@ -541,7 +541,6 @@ extern "C" void _platform_post_stackheap_init (void) { extern "C" int __real_main(void); extern "C" int __wrap_main(void) { - mbed_sdk_init(); mbed_main(); return __real_main(); } From 6ae979fc5fe38403a342d31a66e5ffa7cfae089f Mon Sep 17 00:00:00 2001 From: Laurent MEUNIER Date: Tue, 12 Jul 2016 18:16:12 +0200 Subject: [PATCH 6/6] [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 --- hal/targets/hal/TARGET_STM/TARGET_STM32F0/pwmout_api.c | 3 --- hal/targets/hal/TARGET_STM/TARGET_STM32F1/pwmout_api.c | 3 --- hal/targets/hal/TARGET_STM/TARGET_STM32F3/i2c_api.c | 3 --- hal/targets/hal/TARGET_STM/TARGET_STM32F3/pwmout_api.c | 3 --- hal/targets/hal/TARGET_STM/TARGET_STM32F3/serial_api.c | 3 --- hal/targets/hal/TARGET_STM/TARGET_STM32F4/serial_api.c | 4 ---- hal/targets/hal/TARGET_STM/TARGET_STM32F7/serial_api.c | 3 --- hal/targets/hal/TARGET_STM/TARGET_STM32L1/pwmout_api.c | 2 -- hal/targets/hal/TARGET_STM/TARGET_STM32L1/serial_api.c | 4 ---- hal/targets/hal/TARGET_STM/TARGET_STM32L4/pwmout_api.c | 2 -- hal/targets/hal/TARGET_STM/TARGET_STM32L4/serial_api.c | 4 ---- 11 files changed, 34 deletions(-) diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F0/pwmout_api.c b/hal/targets/hal/TARGET_STM/TARGET_STM32F0/pwmout_api.c index 6cea9f9b18d..63368cc4c18 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F0/pwmout_api.c +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F0/pwmout_api.c @@ -162,9 +162,6 @@ void pwmout_period_us(pwmout_t* obj, int us) { __HAL_TIM_DISABLE(&TimHandle); - // Update the SystemCoreClock variable - SystemCoreClockUpdate(); - /* To make it simple, we use to possible prescaler values which lead to: * pwm unit = 1us, period/pulse can be from 1us to 65535us * or diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F1/pwmout_api.c b/hal/targets/hal/TARGET_STM/TARGET_STM32F1/pwmout_api.c index cb24045c9e0..4eb3a28c4f3 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F1/pwmout_api.c +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F1/pwmout_api.c @@ -152,9 +152,6 @@ void pwmout_period_us(pwmout_t* obj, int us) __HAL_TIM_DISABLE(&TimHandle); - // Update the SystemCoreClock variable - SystemCoreClockUpdate(); - /* To make it simple, we use to possible prescaler values which lead to: * pwm unit = 1us, period/pulse can be from 1us to 65535us * or diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F3/i2c_api.c b/hal/targets/hal/TARGET_STM/TARGET_STM32F3/i2c_api.c index fae23e0501e..5ecd267446d 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F3/i2c_api.c +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F3/i2c_api.c @@ -113,9 +113,6 @@ void i2c_frequency(i2c_t *obj, int hz) timeout = LONG_TIMEOUT; while ((__HAL_I2C_GET_FLAG(&I2cHandle, I2C_FLAG_BUSY)) && (timeout-- != 0)); - // Update the SystemCoreClock variable. - SystemCoreClockUpdate(); - /* Values calculated with I2C_Timing_Configuration_V1.0.1.xls file (see AN4235) * Standard mode (up to 100 kHz) diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F3/pwmout_api.c b/hal/targets/hal/TARGET_STM/TARGET_STM32F3/pwmout_api.c index abd28ca2b0c..759d986bb68 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F3/pwmout_api.c +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F3/pwmout_api.c @@ -159,9 +159,6 @@ void pwmout_period_us(pwmout_t* obj, int us) __HAL_TIM_DISABLE(&TimHandle); - // Update the SystemCoreClock variable - SystemCoreClockUpdate(); - /* To make it simple, we use to possible prescaler values which lead to: * pwm unit = 1us, period/pulse can be from 1us to 65535us * or diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F3/serial_api.c b/hal/targets/hal/TARGET_STM/TARGET_STM32F3/serial_api.c index 7624baa6f44..97b5f9e8eb0 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F3/serial_api.c +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F3/serial_api.c @@ -82,9 +82,6 @@ static void init_uart(serial_t *obj) huart->Init.Mode = UART_MODE_TX_RX; } - /* uAMR & ARM: Call to UART init is done between reset of pre-initialized variables */ - /* and before HAL Init. SystemCoreClock init required here */ - SystemCoreClockUpdate(); if (HAL_UART_Init(huart) != HAL_OK) { error("Cannot initialize UART\n"); diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/serial_api.c b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/serial_api.c index e77c92497f3..7ac2dc95012 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/serial_api.c +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/serial_api.c @@ -84,10 +84,6 @@ static void init_uart(serial_t *obj) huart->Init.Mode = UART_MODE_TX_RX; } - /* uAMR & ARM: Call to UART init is done between reset of pre-initialized variables */ - /* and before HAL Init. SystemCoreClock init required here */ - SystemCoreClockUpdate(); - if (HAL_UART_Init(huart) != HAL_OK) { error("Cannot initialize UART\n"); } diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F7/serial_api.c b/hal/targets/hal/TARGET_STM/TARGET_STM32F7/serial_api.c index c496c3e22dd..c31fba2fe96 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F7/serial_api.c +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F7/serial_api.c @@ -67,9 +67,6 @@ static void init_uart(serial_t *obj) UartHandle.Init.Mode = UART_MODE_TX_RX; } - // Fix because HAL_RCC_GetHCLKFreq() don't update anymore SystemCoreClock - SystemCoreClockUpdate(); - if (HAL_UART_Init(&UartHandle) != HAL_OK) { error("Cannot initialize UART"); } diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32L1/pwmout_api.c b/hal/targets/hal/TARGET_STM/TARGET_STM32L1/pwmout_api.c index bbbcbb3567f..6e4e85e835c 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32L1/pwmout_api.c +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32L1/pwmout_api.c @@ -166,8 +166,6 @@ void pwmout_period_us(pwmout_t* obj, int us) __HAL_TIM_DISABLE(&TimHandle); - SystemCoreClockUpdate(); - /* To make it simple, we use to possible prescaler values which lead to: * pwm unit = 1us, period/pulse can be from 1us to 65535us * or diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32L1/serial_api.c b/hal/targets/hal/TARGET_STM/TARGET_STM32L1/serial_api.c index 2dce257a065..9f804f521e6 100755 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32L1/serial_api.c +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32L1/serial_api.c @@ -82,10 +82,6 @@ static void init_uart(serial_t *obj) huart->Init.Mode = UART_MODE_TX_RX; } - /* uAMR & ARM: Call to UART init is done between reset of pre-initialized variables */ - /* and before HAL Init. SystemCoreClock init required here */ - SystemCoreClockUpdate(); - if (HAL_UART_Init(huart) != HAL_OK) { error("Cannot initialize UART\n"); } diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32L4/pwmout_api.c b/hal/targets/hal/TARGET_STM/TARGET_STM32L4/pwmout_api.c index 8d121414006..8b8cfe90684 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32L4/pwmout_api.c +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32L4/pwmout_api.c @@ -167,8 +167,6 @@ void pwmout_period_us(pwmout_t* obj, int us) __HAL_TIM_DISABLE(&TimHandle); - SystemCoreClockUpdate(); - /* To make it simple, we use to possible prescaler values which lead to: * pwm unit = 1us, period/pulse can be from 1us to 65535us * or diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32L4/serial_api.c b/hal/targets/hal/TARGET_STM/TARGET_STM32L4/serial_api.c index 0664d1fdc90..3458a8bf393 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32L4/serial_api.c +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32L4/serial_api.c @@ -82,10 +82,6 @@ static void init_uart(serial_t *obj) huart->Init.Mode = UART_MODE_TX_RX; } - /* uAMR & ARM: Call to UART init is done between reset of pre-initialized variables */ - /* and before HAL Init. SystemCoreClock init required here */ - SystemCoreClockUpdate(); - if (HAL_UART_Init(huart) != HAL_OK) { error("Cannot initialize UART\n"); }