Пример #1
0
void rt_platform_init(void)
{
#ifdef RT_USING_DFS
    /* initialize sd card */
    rt_hw_sdcard_init();

#if defined(RT_USING_MTD_NAND)
    rt_hw_mtd_nand_init();
#endif

#if defined(RT_USING_MTD_NOR)
    sst25vfxx_mtd_init("nor", 0, RT_UINT32_MAX);
#endif

#endif /* RT_USING_DFS */

#ifdef RT_USING_RTGUI
    /* start sdl thread to simulate an LCD */
    rt_hw_sdl_start();
#endif /* RT_USING_RTGUI */

#ifdef _WIN32
    rt_thread_idle_sethook(rt_hw_win32_low_cpu);
#endif
}
/**
 * This function will startup RT-Thread RTOS.
 */
void rtthread_startup(void)
{
	app_getGUID();
	/* initialize board */
	rt_hw_board_init();
	
	/* show version */
	rt_show_version();
	
	rt_kprintf(" device id:%x %x %x %x\n",devguid[0],devguid[1],devguid[2],devguid[3]);

#ifdef RT_USING_HEAP
	/* initialize memory system */
	#ifdef __CC_ARM
		rt_system_heap_init((void*)&Image$$RW_IRAM1$$ZI$$Limit, (void*)(0x10000000 + 1024*64));
	#elif __ICCARM__
	    rt_system_heap_init(__segment_end("HEAP"), (void*)(0x10000000 + 1024*64));
	#else
		rt_system_heap_init((void*)&__bss_end, (void*)(0x10000000 + 1024*64));
	#endif
#endif

	/* initialize scheduler system */
	rt_system_scheduler_init();
#ifdef RT_USING_DFS
	/* init sdcard driver */
#ifdef RT_USE_SDIO
	rt_hw_sdcard_init();
#else
	rt_hw_msd_init();
#endif
#endif
	/* initialize application */
	rt_application_init();

#ifdef RT_USING_FINSH
	/* initialize finsh */
	finsh_system_init();
	finsh_set_device( FINSH_DEVICE_NAME );
#endif

    /* initialize timer */
    rt_system_timer_init();

    /* initialize timer thread */
    rt_system_timer_thread_init();

	/* initialize idle thread */
	rt_thread_idle_init();

	/* start scheduler */
	rt_system_scheduler_start();

	/* never reach here */
	return ;
}
Пример #3
0
/**
 * This function will initial STM32 board.
 */
void rt_hw_board_init()
{
	/* NVIC Configuration */
	NVIC_Configuration();

	/* Configure the SysTick */
	SysTick_Configuration();
	
	rt_hw_sdcard_init();
	
	rt_hw_usart_init();
#ifdef RT_USING_CONSOLE
	rt_console_set_device(CONSOLE_DEVICE);
#endif
}
Пример #4
0
void rt_platform_init(void)
{
#ifdef RT_USING_SPI
    rt_hw_spi2_init();

#ifdef RT_USING_DFS
    w25qxx_init("flash0", "spi20");
#endif /* RT_USING_DFS */

#ifdef RT_USING_RTGUI
    /* initilize touch panel */
    rtgui_touch_hw_init("spi21");
#endif /* RT_USING_RTGUI */
#endif /* RT_USING_SPI */

#ifdef RT_USING_USB_HOST
    /* register stm32 usb host controller driver */
    rt_hw_susb_init();
#endif

#ifdef RT_USING_DFS
    /* initilize sd card */
#ifdef RT_USING_SDIO
    rt_mmcsd_core_init();
    rt_mmcsd_blk_init();
    stm32f4xx_sdio_init();
    rt_thread_delay(RT_TICK_PER_SECOND);
#else
    rt_hw_sdcard_init();
#endif
#endif /* RT_USING_DFS */

#ifdef RT_USING_RTGUI
    /* initilize ra8875 lcd controller */
    ra8875_init();

    /* initilize key module */
    rt_hw_key_init();
#endif /* RT_USING_RTGUI */

#ifdef RT_USING_RTC
    rt_hw_rtc_init();
#endif /* RT_USING_RTC */

    rt_thread_delay(50);
    rt_device_init_all();
}
Пример #5
0
/* thread phase init */
void rt_init_thread_entry(void *parameter)
{
	/* initialize platform */
	platform_init();

#ifdef RT_USING_LWIP
    /* register Ethernet interface device */
    lpc17xx_emac_hw_init();

    /* initialize lwip stack */
	/* register ethernetif device */
	eth_system_device_init();

	/* initialize lwip system */
	lwip_system_init();
	rt_kprintf("TCP/IP initialized!\n");
#endif

    /* Filesystem Initialization */
#ifdef RT_USING_DFS
    rt_hw_sdcard_init();

	/* initialize the device file system */
	dfs_init();

#ifdef RT_USING_DFS_ELMFAT
	/* initialize the elm chan FatFS file system*/
	elm_init();
#endif

    /* mount sd card fat partition 1 as root directory */
    if (dfs_mount("sd0", "/", "elm", 0, 0) == 0)
    	rt_kprintf("File System initialized!\n");
    else
    	rt_kprintf("File System init failed!\n");
#endif

#ifdef RT_USING_FINSH
	/* initialize finsh */
	finsh_system_init();
	finsh_set_device(RT_CONSOLE_DEVICE_NAME);
#endif
}
Пример #6
0
/**
 * This function will startup RT-Thread RTOS.
 */
void rtthread_startup(void)
{
	/* 初始化硬件平台相关:时钟设置、中断设置、系统滴答设置、串口设置 */
	rt_hw_board_init();

	/* init tick */
	rt_system_tick_init();

	/* 内核对象初始化 */
	rt_system_object_init();

	/* 系统定时器初始化 */
	rt_system_timer_init();

	/* 如果使用动态内存分配,则配置之 */
#ifdef RT_USING_HEAP
#if STM32_EXT_SRAM
	rt_system_heap_init((void*)STM32_EXT_SRAM_BEGIN, (void*)STM32_EXT_SRAM_END);
#else
	#ifdef __CC_ARM
		rt_system_heap_init((void*)&Image$$RW_IRAM1$$ZI$$Limit, (void*)STM32_SRAM_END);
	#elif __ICCARM__
	    rt_system_heap_init(__segment_end("HEAP"), (void*)STM32_SRAM_END);
	#else
		/* init memory system */
		rt_system_heap_init((void*)&__bss_end, (void*)STM32_SRAM_END);
	#endif
#endif
#endif

	/* 系统调度器初始化 */
	rt_system_scheduler_init();

#ifdef RT_USING_DFS
	/* init sdcard driver */
#if STM32_USE_SDIO
	rt_hw_sdcard_init();
#else
	rt_hw_msd_init();
#endif
#endif

	/*下面可加入用户所需的相关初始化 */

	/*上面可加入用户所需的相关初始化 */


    /* 实时时钟初始化 */
#if(0)
    rt_hw_rtc_init();
#endif

	/* 系统设备对象初始化 */
	rt_device_init_all();

	/* 用户应用初始化 */
	rt_application_init();

#ifdef RT_USING_FINSH
	/* init finsh */
	finsh_system_init();
	finsh_set_device("uart1");
#endif

    /* 初始化软件定时器 */
    rt_system_timer_thread_init();

	/* 初始化空闲线程 */
	rt_thread_idle_init();

	/* 开始线程调度 此后便进入各个线程的无限循环 */
	rt_system_scheduler_start();

	/* never reach here */
	return ;
}
Пример #7
0
/**
 * This function will startup RT-Thread RTOS.
 */
void rtthread_startup(void)
{
	/* init board */
	rt_hw_board_init();

	/* show version */
	rt_show_version();

	/* init tick */
	rt_system_tick_init();

	/* init kernel object */
	rt_system_object_init();

	/* init timer system */
	rt_system_timer_init();

#ifdef RT_USING_HEAP
#if STM32_EXT_SRAM
	rt_system_heap_init((void*)STM32_EXT_SRAM_BEGIN, (void*)STM32_EXT_SRAM_END);
#else
	#ifdef __CC_ARM
		rt_system_heap_init((void*)&Image$$RW_IRAM1$$ZI$$Limit, (void*)STM32_SRAM_END);
	#elif __ICCARM__
	    rt_system_heap_init(__segment_end("HEAP"), (void*)STM32_SRAM_END);
	#else
		/* init memory system */
		rt_system_heap_init((void*)&__bss_end, (void*)STM32_SRAM_END);
	#endif
#endif
#endif

	/* init scheduler system */
	rt_system_scheduler_init();

#ifdef RT_USING_DFS
	/* init sdcard driver */
#if STM32_USE_SDIO
	rt_hw_sdcard_init();
#else
	rt_hw_msd_init();
#endif
#endif

	rt_hw_rtc_init();

	/* init application */
	rt_application_init();

#ifdef RT_USING_FINSH
	/* init finsh */
	finsh_system_init();
	finsh_set_device("uart1");
#endif

    /* init timer thread */
    rt_system_timer_thread_init();

	/* init idle thread */
	rt_thread_idle_init();

	/* start scheduler */
	rt_system_scheduler_start();

	/* never reach here */
	return ;
}
Пример #8
0
/**
 * This function will startup RT-Thread RTOS.
 */
void rtthread_startup(void)
{
	/* init hardware interrupt */
	rt_hw_interrupt_init();

	/* init board */
	rt_hw_board_init();
	
	rt_show_version();

	/* init tick */
	rt_system_tick_init();

	/* init kernel object */
	rt_system_object_init();

	/* init timer system */
	rt_system_timer_init();

#ifdef RT_USING_HEAP
#ifdef __CC_ARM
	rt_system_heap_init((void*)&Image$$RW_IRAM1$$ZI$$Limit, (void*)0x00210000);
#elif __ICCARM__
    rt_system_heap_init(__segment_end("HEAP"), (void*)0x00210000);
#else
	rt_system_heap_init(&__bss_end, 0x00210000);
#endif
#endif

	/* init scheduler system */
	rt_system_scheduler_init();

#ifdef RT_USING_HOOK /* if the hook is used */
	/* set idle thread hook */
	rt_thread_idle_sethook(led_flash);
#endif

#ifdef RT_USING_DEVICE
	/* init hardware serial device */
	rt_hw_serial_init();

#ifdef RT_USING_LWIP
	eth_system_device_init();

	/* register AT91 EMAC device */
	sam7xether_register("E0");
#endif

#ifdef RT_USING_DFS
	rt_hw_sdcard_init();
#endif

	/*init all registed devices*/
	rt_device_init_all();
#endif

	/* init application */
	rt_application_init();

#ifdef RT_USING_FINSH
	/* init finsh */
	finsh_system_init();
	finsh_set_device("uart1");
#endif

	/* init idle thread */
	rt_thread_idle_init();

	/* start scheduler */
	rt_system_scheduler_start();

	/* never reach here */
	return ;
}
Пример #9
0
/**
 * This function will startup RT-Thread RTOS.
 */
void rtthread_startup(void)
{
	/* init board */
	rt_hw_board_init();

	/* show version */
	rt_show_version();

	/* init tick */
	rt_system_tick_init();

	/* init kernel object */
	rt_system_object_init();

	/* init timer system */
	rt_system_timer_init();

#ifdef RT_USING_HEAP
#ifdef __CC_ARM
	rt_system_heap_init((void*)&Image$$RW_IRAM1$$ZI$$Limit, (void*)LM3S_SRAM_END);
#elif __ICCARM__
	rt_system_heap_init(__segment_end("HEAP"), (void*)LM3S_SRAM_END);
#else
	/* init memory system */
	rt_system_heap_init((void*)&__bss_end, (void*)LM3S_SRAM_END);
#endif
#endif

#ifdef RT_USING_MODULE
	/* init module system */
	rt_system_module_init();
#endif

	/* init scheduler system */
	rt_system_scheduler_init();

#ifdef RT_USING_LWIP
	eth_system_device_init();

	/* register ethernetif device */
	rt_hw_luminaryif_init();
#endif

	/* init hardware serial device */
	rt_hw_serial_init();
#ifdef RT_USING_DFS
	/* init sd card device */
	rt_hw_sdcard_init();
#endif

	/* init application */
	rt_application_init();

#ifdef RT_USING_FINSH
	/* init finsh */
	finsh_system_init();
#ifdef RT_USING_DEVICE
	finsh_set_device("uart1");
#endif
#endif

	/* init idle thread */
	rt_thread_idle_init();

	/* start scheduler */
	rt_system_scheduler_start();

	/* never reach here */
	return ;
}
Пример #10
0
void rt_init_thread_entry(void* parameter)
{
	rt_hw_sdcard_init();

/* Filesystem Initialization */
#ifdef RT_USING_DFS
	{
		/* init the device filesystem */
		dfs_init();

#if defined(RT_USING_DFS_ELMFAT)
		/* init the elm chan FatFs filesystam*/
		elm_init();

		/* mount sd card fat partition 1 as root directory */
		if (dfs_mount("sd0", "/", "elm", 0, 0) == 0)
		{
			rt_kprintf("File System initialized!\n");
		}
		else
			rt_kprintf("File System initialzation failed!\n");
#endif

#if defined(RT_USING_DFS_ROMFS)
		dfs_romfs_init();
		if (dfs_mount(RT_NULL, "/rom", "rom", 0, &romfs_root) == 0)
		{
			rt_kprintf("ROM File System initialized!\n");
		}
		else
			rt_kprintf("ROM File System initialzation failed!\n");
#endif

#if defined(RT_USING_DFS_DEVFS)
		devfs_init();
		if (dfs_mount(RT_NULL, "/dev", "devfs", 0, 0) == 0)
			rt_kprintf("Device File System initialized!\n");
		else
			rt_kprintf("Device File System initialzation failed!\n");

		#ifdef RT_USING_NEWLIB
		/* init libc */
		libc_system_init("uart0");
		#endif
#endif

#if defined(RT_USING_DFS_UFFS)
	{
		/* init the uffs filesystem */
		dfs_uffs_init();

		/* mount flash device as flash directory */
		if(dfs_mount("nand0", "/nand0", "uffs", 0, 0) == 0)
			rt_kprintf("UFFS File System initialized!\n");
		else
			rt_kprintf("UFFS File System initialzation failed!\n");
	}
#endif
	}
#endif

#ifdef RT_USING_RTGUI
	{
		/* init lcd */
		rt_hw_lcd_init();
			
		/* init touch panel */
		rtgui_touch_hw_init();	

		/* init keypad */
		rt_hw_key_init();
		
		/* re-init device driver */
		rt_device_init_all();

		/* startup rtgui */
		//rtgui_startup();
	}
#endif

/* LwIP Initialization */
#ifdef RT_USING_LWIP
	{
		extern void lwip_sys_init(void);
		eth_system_device_init();

		/* register ethernetif device */
		rt_hw_dm9000_init();

		/* re-init device driver */
		rt_device_init_all();

		/* init lwip system */
		lwip_sys_init();
		rt_kprintf("TCP/IP initialized!\n");
	}
#endif

#ifdef RT_USING_FTK
	{
		rt_thread_t ftk_thread;

		int FTK_MAIN(int argc, char* argv[]);

		/* init lcd */
		rt_hw_lcd_init();

		/* init touch panel */
		rtgui_touch_hw_init();	

		/* init keypad */
		rt_hw_key_init();

		/* re-init device driver */
		rt_device_init_all();

		/* create ftk thread */
		ftk_thread = rt_thread_create("ftk",
									FTK_MAIN, RT_NULL,
									10 * 1024, 8, 20);	

		/* startup ftk thread */
		if(ftk_thread != RT_NULL)
			rt_thread_startup(ftk_thread);		
	}
#endif
}
Пример #11
0
/**
 * This function will startup RT-Thread RTOS.
 */
void rtthread_startup(void)
{
    /* init hardware interrupt */
    rt_hw_interrupt_init();

    /* init board */
    rt_hw_board_init();

    /* init tick */
    rt_system_tick_init();

    /* init kernel object */
    rt_system_object_init();

    rt_show_version();

    /* init timer system */
    rt_system_timer_init();

#ifdef RT_USING_HEAP
#ifdef __CC_ARM
    rt_system_heap_init((void*)&Image$$RW_IRAM1$$ZI$$Limit, (void*)0x40008000);
#else
    /* init memory system */
    rt_system_heap_init((void*)&__bss_end, (void*)0x40008000);
#endif
#endif

    /* init scheduler system */
    rt_system_scheduler_init();

#ifdef RT_USING_DEVICE
#ifdef RT_USING_DFS
    /* init sd card */
    rt_hw_sdcard_init();
#endif

#ifdef RT_USING_LWIP
    eth_system_device_init();
    /* init ethernetif device */
    rt_hw_dm9000_init();
#endif

    /* init hardware serial device */
    rt_hw_serial_init();
#endif

    /* init application */
    rt_application_init();

#ifdef RT_USING_FINSH
    /* init finsh */
    finsh_system_init();
    finsh_set_device("uart1");
#endif

    /* init idle thread */
    rt_thread_idle_init();

    /* start scheduler */
    rt_system_scheduler_start();

    /* never reach here */
    return ;
}
Пример #12
0
void rt_platform_init(void)
{
#ifdef RT_USING_RTC
    rt_hw_rtc_init();
	#ifdef RT_USING_ALARM	
	rt_alarm_system_init(); 
	#endif		
	  /* 放在finsh中去设置初始时间 
	  set_date(2013,4,28);
	  set_time(10,8,24);
	  */
	  list_date();	
	
#endif /* RT_USING_RTC */	
#ifdef RT_USING_SPI
	{
		extern void rt_hw_spi1_init(void);
		rt_hw_spi1_init();
	}
    

#ifdef RT_USING_DFS
       w25qxx_init("flash0", "spi10");
#endif /* RT_USING_DFS */

#ifdef RT_USING_RTGUI
    /* initilize touch panel */
    //rtgui_touch_hw_init("spi11");
#endif /* RT_USING_RTGUI */
#endif /* RT_USING_SPI */

#ifdef RT_USING_USB_HOST
    /* register stm32 usb host controller driver */
    //rt_hw_susb_init();
#endif

#ifdef RT_USING_DFS
    /* initilize sd card */
#ifdef RT_USING_SDIO
     rt_mmcsd_core_init();
     rt_mmcsd_blk_init();
	{
		extern rt_int32_t stm32f1xx_sdio_init(void);
		stm32f1xx_sdio_init();
	}	
     rt_thread_delay(RT_TICK_PER_SECOND);
#else
     rt_hw_sdcard_init();
#endif
#endif /* RT_USING_DFS */

#ifdef RT_USING_RTGUI
    /* initilize ili9320 lcd controller */
    //lcd_9320_init();

    /* initilize key module */
    //rt_hw_key_init();
#endif /* RT_USING_RTGUI */

    rt_thread_delay(50);
    rt_device_init_all();
}