diff --git a/bsp/stm32f10x-HAL/drivers/board.c b/bsp/stm32f10x-HAL/drivers/board.c index d520411984..12d5b7d80f 100644 --- a/bsp/stm32f10x-HAL/drivers/board.c +++ b/bsp/stm32f10x-HAL/drivers/board.c @@ -49,6 +49,7 @@ void HAL_MspInit(void) void SystemClock_Config(void) { + rt_err_t result; RCC_OscInitTypeDef RCC_OscInitStruct; RCC_ClkInitTypeDef RCC_ClkInitStruct; /**Initializes the CPU, AHB and APB busses clocks @@ -60,7 +61,8 @@ void SystemClock_Config(void) RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL9; - RT_ASSERT(HAL_RCC_OscConfig(&RCC_OscInitStruct) == HAL_OK); + result = HAL_RCC_OscConfig(&RCC_OscInitStruct); + RT_ASSERT(result == HAL_OK); /**Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2; @@ -68,7 +70,8 @@ void SystemClock_Config(void) RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2; RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; - RT_ASSERT(HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) == HAL_OK); + result = HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2); + RT_ASSERT(result == HAL_OK); /**Configure the Systick interrupt time */ HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / RT_TICK_PER_SECOND); diff --git a/bsp/stm32f10x-HAL/drivers/drv_usart.c b/bsp/stm32f10x-HAL/drivers/drv_usart.c index 80bf5578d8..771f4d62a1 100644 --- a/bsp/stm32f10x-HAL/drivers/drv_usart.c +++ b/bsp/stm32f10x-HAL/drivers/drv_usart.c @@ -267,6 +267,7 @@ INIT_BOARD_EXPORT(rt_hw_usart_init); static void MX_USART_UART_Init(UART_HandleTypeDef *uartHandle) { + rt_err_t result; uartHandle->Init.BaudRate = 115200; uartHandle->Init.WordLength = UART_WORDLENGTH_8B; uartHandle->Init.StopBits = UART_STOPBITS_1; @@ -274,7 +275,8 @@ static void MX_USART_UART_Init(UART_HandleTypeDef *uartHandle) uartHandle->Init.Mode = UART_MODE_TX_RX; uartHandle->Init.HwFlowCtl = UART_HWCONTROL_NONE; uartHandle->Init.OverSampling = UART_OVERSAMPLING_16; - RT_ASSERT(HAL_UART_Init(uartHandle) == HAL_OK); + result = HAL_UART_Init(uartHandle); + RT_ASSERT(result == HAL_OK); } /* USART2 init function */