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

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

cpp 复制代码
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 */
}

分析原因:

cpp 复制代码
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 */

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

相关推荐
硅基手札2 分钟前
【Linux 内核专栏 13】快IO层
linux·服务器·嵌入式硬件
李日华大战鸡红21 分钟前
滑膜观测器(学习记录)
stm32·单片机·学习·matlab·机器人
白搞电子23 分钟前
ESP32-S31 项目如何制作 Windows 一键烧录包:完整镜像、esptool 与数据边界
windows·stm32·单片机
xiangw@GZ1 小时前
纽扣电池型号
嵌入式硬件
优信电子1 小时前
Raspberry Pi Pico 硬件开发 —— 第二课:MicroPython 从入门到项目实践(LED篇)
单片机·嵌入式硬件·树莓派·micropython·pico·入门教学
黑妹天下第一乖2 小时前
第 12 讲:阿加犀 AidLux 部署与量产——把端侧 AI 应用做成 7×24 产品
人工智能·嵌入式硬件·数码相机·接口隔离原则·iot
xiangw@GZ3 小时前
Type‑C USB DRD 电路
单片机·嵌入式硬件
常州晟凯电子科技3 小时前
sigmaStar SSC305DE/SSC308开发笔记之开发环境搭建和SDK编译
人工智能·笔记·嵌入式硬件·物联网·性能优化·视频编解码
沐欣工作室_lvyiyi3 小时前
基于单片机的跑步机控制系统设计(论文+源码)
c语言·单片机·嵌入式硬件·课程设计·keil·跑步机设计
黑妹天下第一乖4 小时前
第 11 讲:阿加犀 AidLux 多组件综合实战——端侧“智能摄像头解说“全链路
人工智能·嵌入式硬件·语言模型·自然语言处理·iot