rt-thread/bsp/stm32f40x/applications/application.c

78 lines
1.5 KiB
C
Raw Normal View History

2013-01-08 22:40:58 +08:00
/*
* File : application.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
*
* Change Logs:
* Date Author Notes
* 2009-01-05 Bernard the first version
2014-04-27 10:02:52 +08:00
* 2014-04-27 Bernard make code cleanup.
2013-01-08 22:40:58 +08:00
*/
#include <board.h>
#include <rtthread.h>
#ifdef RT_USING_LWIP
#include <lwip/sys.h>
#include <lwip/api.h>
#include <netif/ethernetif.h>
#include "stm32f4xx_eth.h"
2013-01-08 22:40:58 +08:00
#endif
#ifdef RT_USING_FINSH
#include <shell.h>
#include <finsh.h>
#endif
2014-08-12 18:22:04 +08:00
#ifdef RT_USING_GDB
#include <gdb_stub.h>
#endif
2013-01-08 22:40:58 +08:00
void rt_init_thread_entry(void* parameter)
{
2014-08-12 18:22:04 +08:00
/* GDB STUB */
#ifdef RT_USING_GDB
gdb_set_device("uart6");
gdb_start();
#endif
2013-01-08 22:40:58 +08:00
/* LwIP Initialization */
#ifdef RT_USING_LWIP
{
extern void lwip_sys_init(void);
/* register ethernetif device */
eth_system_device_init();
rt_hw_stm32_eth_init();
/* init lwip system */
lwip_sys_init();
rt_kprintf("TCP/IP initialized!\n");
}
#endif
#ifdef RT_USING_FINSH
/* init finsh */
finsh_system_init();
#endif
2013-01-08 22:40:58 +08:00
}
int rt_application_init()
{
2014-04-27 10:02:52 +08:00
rt_thread_t tid;
2013-01-08 22:40:58 +08:00
2014-04-27 10:02:52 +08:00
tid = rt_thread_create("init",
rt_init_thread_entry, RT_NULL,
2048, RT_THREAD_PRIORITY_MAX/3, 20);
2013-01-08 22:40:58 +08:00
2014-04-27 10:02:52 +08:00
if (tid != RT_NULL)
rt_thread_startup(tid);
2013-01-08 22:40:58 +08:00
return 0;
}