main.cpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #include <cstdio>
  2. #include <cstdint>
  3. #if defined(COMMAND_LINE)
  4. #include <cstdlib>
  5. #endif
  6. #include "scheduler.h"
  7. #include "RTE_Components.h"
  8. #include CMSIS_device_header
  9. #include "cmsis_os2.h"
  10. void app_main (void *argument)
  11. {
  12. int error;
  13. uint32_t res=1;
  14. uint32_t nbSched = 0;
  15. (void)argument;
  16. printf("Start\n\r");
  17. #if defined(RTE_Compiler_EventRecorder)
  18. res = EventRecorderEnable (EventRecordAll, EvtSched, EvtSched);
  19. if (!res)
  20. {
  21. printf("Error enabling event recorder for scheduler\n");
  22. goto endThread;
  23. }
  24. #endif
  25. nbSched=scheduler(&error);
  26. printf("Number of schedule iterations = %d\n\r",nbSched);
  27. printf("Error code = %d\n\r",error);
  28. #if defined(RTE_Compiler_EventRecorder)
  29. res = EventRecorderDisable (EventRecordAll, EvtSched, EvtSched);
  30. if (!res)
  31. {
  32. printf("Error disabling event recorder\n");
  33. }
  34. #endif
  35. endThread:
  36. #if defined(COMMAND_LINE)
  37. exit(0);
  38. #else
  39. osThreadExit();
  40. #endif
  41. }
  42. int main(void)
  43. {
  44. // System Initialization
  45. SystemCoreClockUpdate();
  46. osKernelInitialize(); // Initialize CMSIS-RTOS
  47. osThreadNew(app_main, NULL, NULL); // Create application main thread
  48. osKernelStart(); // Start thread execution
  49. for (;;) {}
  50. }