application.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * File : application.c
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2006, RT-Thread Development Team
  5. *
  6. * The license and distribution terms for this file may be
  7. * found in the file LICENSE in this distribution or at
  8. * http://www.rt-thread.org/license/LICENSE
  9. *
  10. * Change Logs:
  11. * Date Author Notes
  12. * 2009-01-05 Bernard the first version
  13. * 2014-04-27 Bernard make code cleanup.
  14. */
  15. #include <board.h>
  16. #include <rtthread.h>
  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. /* GDB STUB */
  29. #ifdef RT_USING_GDB
  30. gdb_set_device("uart6");
  31. gdb_start();
  32. #endif
  33. /* LwIP Initialization */
  34. #ifdef RT_USING_LWIP
  35. {
  36. extern void lwip_sys_init(void);
  37. /* register ethernetif device */
  38. eth_system_device_init();
  39. rt_hw_stm32_eth_init();
  40. /* init lwip system */
  41. lwip_sys_init();
  42. rt_kprintf("TCP/IP initialized!\n");
  43. }
  44. #endif
  45. }
  46. int rt_application_init()
  47. {
  48. rt_thread_t tid;
  49. tid = rt_thread_create("init",
  50. rt_init_thread_entry, RT_NULL,
  51. 2048, RT_THREAD_PRIORITY_MAX/3, 20);
  52. if (tid != RT_NULL)
  53. rt_thread_startup(tid);
  54. return 0;
  55. }
  56. /*@}*/