[stm32f10x-HAL] Fixed the problem of including functions in RT_ASSERT()|修复了:当屏蔽宏定义RT_DEBUG时,RT_ASSERT()中的函数运行不到

This commit is contained in:
user 2018-05-30 14:47:11 +08:00
parent fe691c2ab3
commit dab7477312
2 changed files with 8 additions and 3 deletions

View File

@ -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);

View File

@ -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 */