readme.md
1说明: 本BSP可以如下演示
2依赖软件包
3 python2.7 (python2.6无法生成vs工程)
4
5一 平台及组件支持
6目前rtconfig.py中支持的编译器有
7
81). msvc 用于windows平台
9 此平台支持的组件
10 kernel
11 finsh
12 LWIP
13 DFS, ELM FatFS, UFFS, JFFS2, DFS_WIN32
14 RTGUI
15 APP MODULE
162). mingw 用于windows平台
17 kernel
18 finsh
19 DFS, ELM FatFS, UFFS, DFS_WIN32
20 RTGUI
21 APP MODULE
223). gcc 用于linux平台
23 kernel
24 finsh
25 DFS, ELM FatFS, UFFS
26 RTGUI
27
28请根据自己的实际情况,修改rtconfig.py中CROSS_TOOL为上述某一值。
29
30二 组件配置
311) RTGUI
32RTGUI的最新源码目前托管在github上:https://github.com/RT-Thread/RTGUI
33下载最新的RTGUI源码,将RTGUI源码包中components下的rtgui目录复制到Rt-thread的components目录下。
34
35三 编译
361) 使用Visual Studio(2005以上版本)
37在当前目录中打开cmd,输入命令
38`scons --target=vs -s`
39生成vs2005的project.vsproj,使用vs2005及以上版本可以打开(VS2005需要转换工程)。
40
41或直接生成vs2012工程
42`scons --target=vs2012 -s`
43
442) 命令行编译
45修改rtconfig.py, 配置合适的编译器(msvc/mingw/gcc),及其路径
46在当前目录中打开cmd,输入命令
47`scons -j4`
48编译完成后会在当前目录下生成 rtthread-win32.exe,双击即可运行。
49
50四 程序测试
511) 测试文件系统
52此时当前目录下,新增了三个文件
53 sd.bin--模拟SD卡,挂载fat,大小为16M
54 nand.bin-模拟nand flash,挂载uffs,参数page=2048+64bytes,block=64pages,16M
55 nor.bin--模拟nor flash,挂载jffs2,型号为sst25vf,2M
56第一次启动时,会看到fatfs挂在失败,因为文件系统没有格式化,需要键入以下命令:
57`mkfs sd0`
58重启运行程序,可以正确挂载、使用FATFS文件系统。
59
602) 测试RTGUI
61打开RTGUI组件后编译,启动在finsh中输入snake_main()并回车,可运行贪吃蛇程序
62
633) 测试APP module
64在rtconfig.h中打开RT_USING_MODULE
65
66测试app module需要执行3步,如下a, b, c所示。
67
68a. 生成rtthread.def文件
69执行`scons --def`可以自动生成rtthread.def。
70当修改了rtconfig.h,打开或禁用了某些组件时,需要重新生成rtthread.def文件.
71
72b. 生成主程序
73
74 `scons -j4`
75
76c. 生成app module
77 进入testdll目录,再次修改 testdll/SConstruct, 同样需要配置RTT_RTGUI路径,同 1中3)
78 在此目录下执行
79 `scons --app=basicapp`
80 就会在 basicapp/building目录下生成 basicapp.dll。
81
82 然后运行simulator目录下的 rtthread-win32.exe, 在finsh中运行
83 `exec("/testdll/basicapp/build/basicapp.dll")`
84 如果觉得这个路径太长,可以将basicapp.dll复制到 simualtor目录下,执行
85 `exec("/basicapp.dll")`
86
87 编译贪吃蛇程序
88 执行`scons --app=snake`,会在snake/build/下生成snake.dll,按照同样的方式加载即可
89
readme_en.md
1compile bsp:
2There are two ways.
31). Visual Studio(2005 or newer version), open vs2005.vcproj with visual studio
4 compile, then run it.
5
62). use scons, open cmd console, change to current path, then do
7 scons -j4
8scons will compile this bsp with cl(the compiler of vs), then rtthrad-win32.exe will be created in current directory. Run it by double click it.
9
10run:
11 Run, then you can see the following message on CMD window.
12
13 \ | /
14 - RT - Thread Operating System
15 / | \ 1.1.0 build Oct 21 2012
16 2006 - 2012 Copyright by rt-thread team
17 init jffs2 lock mutex okay
18 hello, world
19 finsh>>fatfs initialzation failed!
20 uffs initialzation failed!
21 jffs2 initialzation failed!
22 thread 29e4 exit
23 hello, world
24 hello, world
25 hello, world
26 hello, world
27 hello, world
28 hello, world
29 hello, world
30 hello, world
31 hello, world
32 thread 2898 exit
33
34Then you may note that, three file (sd.bin, nand.bin, nor.bin) are created. These three files are used to simulate as SD CARD, nand flash and nor flash.
35 sd.bin--SD card, fatfs, 16M
36 nand.bin--nand flash, uffs, page=2048+64bytes, block=64pages, 16M
37 nor.bin--nor flash, jffs2, block size is 64K, 2M
38
39Note, it failed to mount fatfs,uffs and jffs2, because there is valid partition on sd card, and there is no directory to mount uffs and jffs2.
40
41So, we should mount sd card at first.
42Press ENTER, and run the command "mkfs", like,
43
44 finsh>>mkfs("elm", "sd0")
45 0, 0x00000000
46 finsh>>
47
48Then close CMD, and then re-run it. This time, you can see that fatfs is mounted correctly, While uffs and jffs2 are still failed to mount for the reason that there is no any directories for uffs and jffs2.
49 \ | /
50 - RT - Thread Operating System
51 / | \ 1.1.0 build Oct 21 2012
52 2006 - 2012 Copyright by rt-thread team
53 init jffs2 lock mutex okay
54 hello, world
55 finsh>>fatfs initialized!
56 uffs initialzation failed!
57 jffs2 initialzation failed!
58
59so, in order to mount uffs and jffs2, we should create directories for them. Do the following commands.
60
61 finsh>>mkdir("/nand")
62 0, 0x00000000
63 finsh>>mkdir("/nor")
64 0, 0x00000000
65 finsh>>
66
67Close the CMD console, and restart, then you can see this:
68
69 \ | /
70 - RT - Thread Operating System
71 / | \ 1.1.0 build Oct 21 2012
72 2006 - 2012 Copyright by rt-thread team
73 init jffs2 lock mutex okay
74 hello, world
75 finsh>>fatfs initialized!
76 os : system memory alloc 320 bytes
77 flsh: ECC size 24
78 flsh: UFFS consume spare data size 34
79 os : system memory alloc 83520 bytes
80 os : system memory alloc 52400 bytes
81 os : system memory alloc 2048 bytes
82 tree: DIR 0, FILE 0, DATA 0
83 uffs initialized!
84 jffs2 initialized!
85 thread 2fb4 exit
86 hello, world
87 hello, world
88 hello, world
89 hello, world
90 hello, world
91 hello, world
92 hello, world
93 hello, world
94 hello, world
95 thread 312c exit
96
97Ok, everything is okay, you can develop rt-thread with visual studio.
98
99Any questions about this bsp, please email me, goprife@gmail.com
100
101Enjoy~~
102 prife 2012/10/21
103