|
![](static/image/common/ico_lz.png)
楼主 |
发表于 2014-3-5 15:43:35
|
显示全部楼层
本帖最后由 hunxiyi 于 2014-3-5 15:45 编辑
最下面是application.c里面的内容
我在移植f107的时候,用两个LED灯来交替闪烁
但是只有屏蔽掉int rt_application_init(void)函数中的
- init_thread = rt_thread_create("init",
- rt_init_thread_entry, RT_NULL,
- 2048, 8, 20);
复制代码
语句【71行】时候,实验现象才正确,不屏蔽这句的时候,现象就不正确,只有一个LED常亮
我看论坛写那个RTT例程连载的 jiezhi320 的例程中,有的例子也是屏蔽这个线程初始化,有的又没有屏蔽
不知道这个线程初始化里面哪个东西是有冲突的吗
我的水平刚入门,希望大家不吝赐教,谢谢![](static/image/smiley/default/handshake.gif)
- #include <board.h>
- #include <rtthread.h>
- #include "led.h"
- #ifdef RT_USING_DFS
- #include <dfs_fs.h>
- #endif
- #ifdef RT_USING_COMPONENTS_INIT
- #include <components.h>
- #endif /* RT_USING_COMPONENTS_INIT */
- ALIGN(RT_ALIGN_SIZE)
- static rt_uint8_t led_stack[ 512 ];
- static struct rt_thread led_thread;
- static void led_thread_entry(void* parameter)
- {
- rt_hw_led_init();
- while (1)
- {
- rt_hw_led_on(0);
- rt_hw_led_off(1);
- rt_thread_delay( RT_TICK_PER_SECOND/2 ); /* sleep 0.5 second and switch to other thread */
- rt_hw_led_off(0);
- rt_hw_led_on(1);
- rt_thread_delay( RT_TICK_PER_SECOND/2 );
- }
- }
- void rt_init_thread_entry(void* parameter)
- {
- {
- extern void rt_platform_init(void);
- rt_platform_init();
- }
- #ifdef RT_USING_COMPONENTS_INIT
- /* initialization RT-Thread Components */
- rt_components_init();
- #endif
- /* Filesystem Initialization */
- #if defined(RT_USING_DFS) && defined(RT_USING_DFS_ELMFAT)
- {
- /* 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 /* RT_USING_DFS && RT_USING_DFS_ELMFAT */
- }
- int rt_application_init(void)
- {
- rt_thread_t init_thread;
- rt_err_t result;
-
- #if (RT_THREAD_PRIORITY_MAX == 32)
- // init_thread = rt_thread_create("init",
- // rt_init_thread_entry, RT_NULL,
- // 2048, 8, 20);
- #else
- init_thread = rt_thread_create("init",
- rt_init_thread_entry, RT_NULL,
- 2048, 80, 20);
- #endif
- if (init_thread != RT_NULL)
- {
- rt_thread_startup(init_thread);
- }
-
- /* init led thread */
- result = rt_thread_init(&led_thread,
- "led",
- led_thread_entry,
- RT_NULL,
- (rt_uint8_t*)&led_stack[0],
- sizeof(led_stack),
- 20,
- 5);
- if (result == RT_EOK)
- {
- rt_thread_startup(&led_thread);
- }
-
- return 0;
- }
复制代码
|
|