application.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. * 2009-01-05 Bernard the first version
  9. * 2014-04-27 Bernard make code cleanup.
  10. */
  11. #include <board.h>
  12. #include <rtthread.h>
  13. #ifdef RT_USING_FINSH
  14. #include <shell.h>
  15. #include <finsh.h>
  16. #endif
  17. #ifdef RT_USING_LWIP
  18. #include <lwip/sys.h>
  19. #include <lwip/api.h>
  20. #include <netif/ethernetif.h>
  21. #include "stm32f4xx_eth.h"
  22. #endif
  23. #ifdef RT_USING_GDB
  24. #include <gdb_stub.h>
  25. #endif
  26. void rt_init_thread_entry(void* parameter)
  27. {
  28. rt_thread_t tid;
  29. /* GDB STUB */
  30. #ifdef RT_USING_GDB
  31. gdb_set_device("uart6");
  32. gdb_start();
  33. #endif
  34. /* LwIP Initialization */
  35. #ifdef RT_USING_LWIP
  36. {
  37. extern void lwip_sys_init(void);
  38. /* register ethernetif device */
  39. eth_system_device_init();
  40. rt_hw_stm32_eth_init();
  41. /* init lwip system */
  42. lwip_sys_init();
  43. rt_kprintf("TCP/IP initialized!\n");
  44. }
  45. #endif
  46. rt_components_init();
  47. }
  48. int rt_application_init()
  49. {
  50. rt_thread_t tid;
  51. tid = rt_thread_create("init",
  52. rt_init_thread_entry, RT_NULL,
  53. 2048, RT_THREAD_PRIORITY_MAX/3, 20);
  54. if (tid != RT_NULL)
  55. rt_thread_startup(tid);
  56. return 0;
  57. }
  58. /*@}*/