utility.c 617 B

123456789101112131415161718192021222324252627282930313233
  1. #include "FreeRTOS.h"
  2. #include "task.h"
  3. #include "queue.h"
  4. #include "semphr.h"
  5. #include "utility.h"
  6. #include "at32f403a_407_int.h"
  7. #ifdef PRINTF_STDLIB
  8. #include <stdio.h>
  9. #endif
  10. #ifdef PRINTF_CUSTOM
  11. #include "tinystdio.h"
  12. #endif
  13. #if 1
  14. // OS stack overflow hook
  15. #if (configCHECK_FOR_STACK_OVERFLOW > 0)
  16. void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName )
  17. {
  18. NVIC_SystemReset();
  19. }
  20. #endif
  21. #endif
  22. // OS malloc failed hook
  23. #if (configUSE_MALLOC_FAILED_HOOK > 0)
  24. void vApplicationMallocFailedHook(void)
  25. {
  26. NVIC_SystemReset();
  27. while(1);
  28. }
  29. #endif