1
0

startup.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. * Copyright (c) 2018, Synopsys, Inc.
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #include <rthw.h>
  7. #include <rtthread.h>
  8. #include <rt_board.h>
  9. #ifdef RT_USING_HEAP
  10. #define rt_system_heap_size 1024*64
  11. static rt_uint32_t rt_system_heap[rt_system_heap_size/4] = {0};
  12. #endif
  13. extern int rt_application_init(void);
  14. void rt_hw_interrupt_init(void)
  15. {
  16. /* rt-thread specific interrupt and exception init */
  17. }
  18. /**
  19. * This function will startup RT-Thread RTOS.
  20. */
  21. void rtthread_startup(void)
  22. {
  23. /* initialize hardware interrupt */
  24. rt_hw_interrupt_init();
  25. /* initialize board */
  26. rt_hw_board_init();
  27. /* show RT-Thread version */
  28. rt_show_version();
  29. /* initialize memory system */
  30. #ifdef RT_USING_HEAP
  31. rt_system_heap_init((void *)rt_system_heap, (void *)(rt_system_heap+rt_system_heap_size));
  32. #endif
  33. /* initialize scheduler system */
  34. rt_system_scheduler_init();
  35. /* initialize system timer */
  36. rt_system_timer_init();
  37. /* initialize soft timer thread */
  38. rt_system_timer_thread_init();
  39. /* initialize application */
  40. rt_application_init();
  41. /* initialize idle thread */
  42. rt_thread_idle_init();
  43. /* start scheduler */
  44. rt_system_scheduler_start();
  45. /* never reach here */
  46. return ;
  47. }
  48. int main(void)
  49. {
  50. /* disable interrupt first */
  51. rt_hw_interrupt_disable();
  52. /* invoke rtthread_startup */
  53. rtthread_startup();
  54. return 0;
  55. }