startup.c 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*
  2. * Copyright (c) 2006-2021, 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. /* show version */
  41. rt_show_version();
  42. /* init tick */
  43. rt_system_tick_init();
  44. /* init kernel object */
  45. rt_system_object_init();
  46. /* init timer system */
  47. rt_system_timer_init();
  48. /* init scheduler system */
  49. rt_system_scheduler_init();
  50. /* init application */
  51. rt_application_init();
  52. /* init timer thread */
  53. rt_system_timer_thread_init();
  54. /* init idle thread */
  55. rt_thread_idle_init();
  56. /* start scheduler */
  57. rt_system_scheduler_start();
  58. /* never reach here */
  59. return ;
  60. }
  61. int main(void)
  62. {
  63. /* disable interrupt first */
  64. rt_hw_interrupt_disable();
  65. /* startup RT-Thread RTOS */
  66. rtthread_startup();
  67. return 0;
  68. }
  69. /*@}*/