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

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

相关推荐
aqymnkstkw5 分钟前
2024年【电气试验】考试题库及电气试验模拟试题
大数据·c语言·人工智能·嵌入式硬件·安全
xxpro34 分钟前
S3C2440开发板点亮LED灯+PWM定时器
单片机·嵌入式硬件
百里与司空40 分钟前
学习CubeIDE——定时器开发
stm32·单片机·嵌入式硬件·学习
天蓝蓝235282 小时前
嵌入式硬件基础知识
嵌入式硬件
代码总长两年半2 小时前
STM32+FATFS+SD卡+RTC(生成.CSV格式文件)
stm32·嵌入式硬件·实时音视频
honey ball4 小时前
仪表放大器AD620
运维·单片机·嵌入式硬件·物联网·学习
luckyluckypolar4 小时前
STM32 -中断
stm32·单片机·嵌入式硬件·物联网
启明云端wireless-tag9 小时前
ESP32无线WiFi蓝牙SOC,设备物联网通信方案,启明云端乐鑫代理商
嵌入式硬件·物联网·wifi·esp32·乐鑫·wifi模组
小狗爱吃黄桃罐头9 小时前
江协科技STM32学习- P14 示例程序(定时器定时中断和定时器外部时钟)
stm32·江科大stm32
@@庆10 小时前
stm32 PWR电源控制(修改主频&睡眠模式&停机模式&待机模式)
stm32·单片机·嵌入式硬件