当前位置:首页 >> 技术栈专业化分层 >> 【STM32】FreeRTOS开启后,不再进入主函数的while(1),2005版qq

【STM32】FreeRTOS开启后,不再进入主函数的while(1),2005版qq

cpugpu芯片开发光刻机 技术栈专业化分层 1
文件名:【STM32】FreeRTOS开启后,不再进入主函数的while(1),2005版qq 【STM32】FreeRTOS开启后,不再进入主函数的while(1)

开启freertos后,想在主函数的while(1)中实现led的翻转,发现无法实现。

int main(void){/* USER CODE BEGIN 1 *//* USER CODE END 1 *//* MCU Configuration--------------------------------------------------------*//* Reset of all peripherals, Initializes the Flash interface and the Systick. */HAL_Init();/* USER CODE BEGIN Init *//* USER CODE END Init *//* Configure the system clock */SystemClock_Config();/* USER CODE BEGIN SysInit *//* USER CODE END SysInit *//* Initialize all configured peripherals */MX_GPIO_Init();MX_USART1_UART_Init();/* USER CODE BEGIN 2 *//* USER CODE END 2 *//* Call init function for freertos objects (in freertos.c) */MX_FREERTOS_Init();/* Start scheduler */osKernelStart();/* We should never get here as control is now taken by the scheduler *//* Infinite loop *//* USER CODE BEGIN WHILE */while (1){HAL_GPIO_TogglePin(GPIOF,GPIO_PIN_9);HAL_Delay(1000);/* USER CODE END WHILE *//* USER CODE BEGIN 3 */}/* USER CODE END 3 */}

分析原因:

osKernelStart();/* We should never get here as control is now taken by the scheduler */

osKernelStart();

语句后面有一个注释:

  /* We should never get here as control is now taken by the scheduler */

我们永远不会到达这里,因为控制权现在被调度器拿走了

协助本站SEO优化一下,谢谢!
关键词不能为空
同类推荐
«    2025年12月    »
1234567
891011121314
15161718192021
22232425262728
293031
控制面板
您好,欢迎到访网站!
  查看权限
网站分类
搜索
最新留言
文章归档
网站收藏
友情链接