You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

138 lines
4.0 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. /* USER CODE BEGIN Header */
  2. /**
  3. ******************************************************************************
  4. * File Name : freertos.c
  5. * Description : Code for freertos applications
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * Copyright (c) 2023 STMicroelectronics.
  10. * All rights reserved.
  11. *
  12. * This software is licensed under terms that can be found in the LICENSE file
  13. * in the root directory of this software component.
  14. * If no LICENSE file comes with this software, it is provided AS-IS.
  15. *
  16. ******************************************************************************
  17. */
  18. /* USER CODE END Header */
  19. /* Includes ------------------------------------------------------------------*/
  20. #include "FreeRTOS.h"
  21. #include "task.h"
  22. #include "main.h"
  23. #include "cmsis_os.h"
  24. /* Private includes ----------------------------------------------------------*/
  25. /* USER CODE BEGIN Includes */
  26. /* USER CODE END Includes */
  27. /* Private typedef -----------------------------------------------------------*/
  28. /* USER CODE BEGIN PTD */
  29. /* USER CODE END PTD */
  30. /* Private define ------------------------------------------------------------*/
  31. /* USER CODE BEGIN PD */
  32. /* USER CODE END PD */
  33. /* Private macro -------------------------------------------------------------*/
  34. /* USER CODE BEGIN PM */
  35. /* USER CODE END PM */
  36. /* Private variables ---------------------------------------------------------*/
  37. /* USER CODE BEGIN Variables */
  38. /* USER CODE END Variables */
  39. osThreadId defaultTaskHandle;
  40. /* Private function prototypes -----------------------------------------------*/
  41. /* USER CODE BEGIN FunctionPrototypes */
  42. /* USER CODE END FunctionPrototypes */
  43. void StartDefaultTask(void const * argument);
  44. extern void MX_LWIP_Init(void);
  45. void MX_FREERTOS_Init(void); /* (MISRA C 2004 rule 8.1) */
  46. /* GetIdleTaskMemory prototype (linked to static allocation support) */
  47. void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize );
  48. /* USER CODE BEGIN GET_IDLE_TASK_MEMORY */
  49. static StaticTask_t xIdleTaskTCBBuffer;
  50. static StackType_t xIdleStack[configMINIMAL_STACK_SIZE];
  51. void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize )
  52. {
  53. *ppxIdleTaskTCBBuffer = &xIdleTaskTCBBuffer;
  54. *ppxIdleTaskStackBuffer = &xIdleStack[0];
  55. *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE;
  56. /* place for user code */
  57. }
  58. /* USER CODE END GET_IDLE_TASK_MEMORY */
  59. /**
  60. * @brief FreeRTOS initialization
  61. * @param None
  62. * @retval None
  63. */
  64. void MX_FREERTOS_Init(void) {
  65. /* USER CODE BEGIN Init */
  66. /* USER CODE END Init */
  67. /* USER CODE BEGIN RTOS_MUTEX */
  68. /* add mutexes, ... */
  69. /* USER CODE END RTOS_MUTEX */
  70. /* USER CODE BEGIN RTOS_SEMAPHORES */
  71. /* add semaphores, ... */
  72. /* USER CODE END RTOS_SEMAPHORES */
  73. /* USER CODE BEGIN RTOS_TIMERS */
  74. /* start timers, add new ones, ... */
  75. /* USER CODE END RTOS_TIMERS */
  76. /* USER CODE BEGIN RTOS_QUEUES */
  77. /* add queues, ... */
  78. /* USER CODE END RTOS_QUEUES */
  79. /* Create the thread(s) */
  80. /* definition and creation of defaultTask */
  81. osThreadDef(defaultTask, StartDefaultTask, osPriorityIdle, 0, 1024);
  82. defaultTaskHandle = osThreadCreate(osThread(defaultTask), NULL);
  83. /* USER CODE BEGIN RTOS_THREADS */
  84. /* add threads, ... */
  85. /* USER CODE END RTOS_THREADS */
  86. }
  87. /* USER CODE BEGIN Header_StartDefaultTask */
  88. /**
  89. * @brief Function implementing the defaultTask thread.
  90. * @param argument: Not used
  91. * @retval None
  92. */
  93. /* USER CODE END Header_StartDefaultTask */
  94. __weak void StartDefaultTask(void const * argument)
  95. {
  96. /* init code for LWIP */
  97. MX_LWIP_Init();
  98. /* USER CODE BEGIN StartDefaultTask */
  99. /* Infinite loop */
  100. for(;;)
  101. {
  102. osDelay(1);
  103. }
  104. /* USER CODE END StartDefaultTask */
  105. }
  106. /* Private application code --------------------------------------------------*/
  107. /* USER CODE BEGIN Application */
  108. /* USER CODE END Application */