startup.c 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*
  2. * Copyright (c) 2006-2018, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2006-08-31 Bernard first implementation
  9. * 2018-09-02 xuzhuoyi modify for TMS320F28379D version
  10. */
  11. #include <stdint.h>
  12. #include <rthw.h>
  13. #include <rtthread.h>
  14. #include "board.h"
  15. /*@{*/
  16. extern int rt_application_init(void);
  17. /*******************************************************************************
  18. * Function Name : assert_failed
  19. * Description : Reports the name of the source file and the source line number
  20. * where the assert error has occurred.
  21. * Input : - file: pointer to the source file name
  22. * - line: assert error line source number
  23. * Output : None
  24. * Return : None
  25. *******************************************************************************/
  26. void assert_failed(uint16_t* file, uint32_t line)
  27. {
  28. rt_kprintf("\n\r Wrong parameter value detected on\r\n");
  29. rt_kprintf(" file %s\r\n", file);
  30. rt_kprintf(" line %d\r\n", line);
  31. while (1) ;
  32. }
  33. /**
  34. * This function will startup RT-Thread RTOS.
  35. */
  36. void rtthread_startup(void)
  37. {
  38. /* init board */
  39. rt_hw_board_init();
  40. rt_hw_interrupt_disable();
  41. /* show version */
  42. rt_show_version();
  43. /* init tick */
  44. rt_system_tick_init();
  45. /* init kernel object */
  46. rt_system_object_init();
  47. /* init timer system */
  48. rt_system_timer_init();
  49. /* init scheduler system */
  50. rt_system_scheduler_init();
  51. /* init application */
  52. rt_application_init();
  53. /* init timer thread */
  54. rt_system_timer_thread_init();
  55. /* init idle thread */
  56. rt_thread_idle_init();
  57. /* start scheduler */
  58. rt_system_scheduler_start();
  59. /* never reach here */
  60. return ;
  61. }
  62. int main(void)
  63. {
  64. /* disable interrupt first */
  65. rt_hw_interrupt_disable();
  66. /* startup RT-Thread RTOS */
  67. rtthread_startup();
  68. return 0;
  69. }
  70. /*@}*/