From dab7477312df6cb3ca019624a61ff25d6b37aedc Mon Sep 17 00:00:00 2001 From: user Date: Wed, 30 May 2018 14:47:11 +0800 Subject: [PATCH] =?UTF-8?q?[stm32f10x-HAL]=20Fixed=20the=20problem=20of=20?= =?UTF-8?q?including=20functions=20in=20RT=5FASSERT()|=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E4=BA=86=EF=BC=9A=E5=BD=93=E5=B1=8F=E8=94=BD=E5=AE=8F=E5=AE=9A?= =?UTF-8?q?=E4=B9=89RT=5FDEBUG=E6=97=B6=EF=BC=8CRT=5FASSERT()=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E5=87=BD=E6=95=B0=E8=BF=90=E8=A1=8C=E4=B8=8D=E5=88=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bsp/stm32f10x-HAL/drivers/board.c | 7 +++++-- bsp/stm32f10x-HAL/drivers/drv_usart.c | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) 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 */