app_freertos.c 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #include <cmsis_os2.h>
  2. #include <FreeRTOS.h>
  3. #include <task.h>
  4. #include <main.h>
  5. osThreadId_t systemdHandle;
  6. const osThreadAttr_t systemd_attributes = {
  7. .name = "systemd",
  8. .priority = (osPriority_t) osPriorityNormal,
  9. .stack_size = 1024 * 4
  10. };
  11. void systemd(void *argument);
  12. void MX_FREERTOS_Init(void); /* (MISRA C 2004 rule 8.1) */
  13. /* Hook prototypes */
  14. void configureTimerForRunTimeStats(void);
  15. unsigned long getRunTimeCounterValue(void);
  16. void vApplicationIdleHook(void);
  17. void vApplicationStackOverflowHook(TaskHandle_t xTask, signed char *pcTaskName);
  18. __weak void configureTimerForRunTimeStats(void) {
  19. }
  20. __weak unsigned long getRunTimeCounterValue(void) {
  21. return 0;
  22. }
  23. __weak void vApplicationIdleHook( void ) {
  24. /* vApplicationIdleHook() will only be called if configUSE_IDLE_HOOK is set
  25. to 1 in FreeRTOSConfig.h. It will be called on each iteration of the idle
  26. task. It is essential that code added to this hook function never attempts
  27. to block in any way (for example, call xQueueReceive() with a block time
  28. specified, or call vTaskDelay()). If the application makes use of the
  29. vTaskDelete() API function (as this demo application does) then it is also
  30. important that vApplicationIdleHook() is permitted to return to its calling
  31. function, because it is the responsibility of the idle task to clean up
  32. memory allocated by the kernel to any task that has since been deleted. */
  33. }
  34. __weak void vApplicationStackOverflowHook(TaskHandle_t xTask, signed char *pcTaskName) {
  35. /* Run time stack overflow checking is performed if
  36. configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook function is
  37. called if a stack overflow is detected. */
  38. }
  39. void MX_FREERTOS_Init(void) {
  40. systemdHandle = osThreadNew(systemd, NULL, &systemd_attributes);
  41. }