rt-thread-official/bsp/simulator
Grissiom 18692c29b8 simulator: get CROSS_TOOL and EXEC_PATH from env
Simulator get it's way to Travis CI ready.
2013-09-06 21:54:27 +08:00
..
SDL update CRLF 2013-01-09 00:06:34 +08:00
applications simulator: init SDL after rt_components_init 2013-08-31 16:46:36 +08:00
disk create disk/{ad, nor, nand in bsp/simulator 2013-01-28 18:05:19 +08:00
drivers simulator: move SDL setting staff into drivers/SConstruct 2013-09-06 21:49:53 +08:00
pcap Re-normalizing the repo 2013-01-08 22:40:58 +08:00
rtgui_demo rtgui_demo: port to new API 2013-01-24 12:54:20 +08:00
testdll simulator: update comments,add 'RTT_IN_MODULE' macro in testdll\SConstruct 2013-03-02 18:39:05 +08:00
.gdbinit add .gdbinit to bsp/simulator 2013-01-22 17:45:06 +08:00
SConscript Re-normalizing the repo 2013-01-08 22:40:58 +08:00
SConstruct simulator: move SDL setting staff into drivers/SConstruct 2013-09-06 21:49:53 +08:00
SDL.dll change nand_sim.c to nanddrv_file.c; add SDL.dll to bsp/simulator; clean code 2012-12-27 07:21:13 +00:00
dummy.c app module support for simlator, first version 2013-02-27 00:37:57 +08:00
gcc.ld simulator: update to support simulator for linux 2013-07-22 23:02:03 +08:00
mingw.ld simulator: update code for new component initialization support on mingw 2013-07-11 23:31:34 +08:00
readme.txt simulator: update readme.txt, disable RT_USING_MODULE in rtconfig.h 2013-03-15 16:55:44 +08:00
readme_en.txt Re-normalizing the repo 2013-01-08 22:40:58 +08:00
rtconfig.h simulator: update readme.txt, disable RT_USING_MODULE in rtconfig.h 2013-03-15 16:55:44 +08:00
rtconfig.py simulator: get CROSS_TOOL and EXEC_PATH from env 2013-09-06 21:54:27 +08:00
rtthread.def app module of simulator:update readme.txt, add rtthread.def for default buiding with msvc 2013-02-28 00:39:37 +08:00
template.vcproj add template.vcproj for bsp/simulator; modify SConstruct for auto-generation 2012-11-07 05:32:29 +00:00

readme.txt

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

说明: 本BSP可以如下演示
依赖软件包
    python2.7 (python2.6使用scons --target=vs -s生成工程会出现错误 

一 平台及组件支持
目前rtconfig.py中支持的编译器有
1). msvc 用于windows平台
  此平台支持的组件
    kernel
    finsh
    LWIP
    DFS, ELM FatFS, UFFS, JFFS2, DFS_WIN32
    RTGUI
    APP MODULE
2). mingw 用于windows平台
    kernel
    finsh
    DFS, ELM FatFS, UFFS, DFS_WIN32
    RTGUI
    APP MODULE
3). gcc 用于linux平台
    kernel
    finsh
    DFS, ELM FatFS, UFFS
    RTGUI

二 组件配置
1) RTGUI
当前代码中已经不含RTGUI源码因此读者需要配置一下才能在simulator中使用RTGUI
RTGUI的最新源码目前是托管在github上https://github.com/RT-Thread/RTGUI
共有两种方法。
方法1 添加环境变量
   向系统加入RTT_RTGUI环境变量其值为刚才github上下载的rtgui源码包的路径。
   例如笔者的rtgui源码包解压至 F:\Project\git\rt-gui\下, 则将此环境变量配置为 F:\Project\git\rt-gui\components\rtgui
方法2 不添加环境变量
   打开SConstruct文件
 ....
 10 if os.getenv('RTT_RTGUI'):
 11     RTT_RTGUI = os.getenv('RTT_RTGUI')
 12 else:
 13     # set the rtgui root directory by hand
 14     # empty string means use the RTGUI in svn
 15     # RTT_RTGUI = os.path.normpath(r'F:\Project\git\rt-gui\components\rtgui')
 16     RTT_RTGUI =''         
 ....
将1516行修改为
 14     # empty string means use the RTGUI in svn
 15     RTT_RTGUI = os.path.normpath(r'F:\Project\git\rt-gui\components\rtgui')
 16     # RTT_RTGUI =''         
简单说明一下:
   1)#号表示注释类似于c语言中的//
   2)其中15行的路径为你的RTGUI路径源码注意不是压缩包路径而是压缩包路径下的 components\rtgui目录的绝对路径。

三 编译
1) 使用Visual Studio(2005以上版本)
在当前目录中打开cmd输入命令
`scons --target=vs -s`
可以生成project.vsproj双击运行

2) 命令行编译
修改rtconfig.py, 配置合适的编译器(msvc/mingw/gcc),及其路径
在当前目录中打开cmd输入命令
`scons -j4`
编译完成后会在当前目录下生成 rtthread-win32.exe双击即可运行。

四 程序测试
1) 测试文件系统
此时当前目录下,新增了三个文件
 sd.bin--模拟SD卡挂载fat大小为16M
 nand.bin-模拟nand flash挂载uffs参数page=2048+64bytesblock=64pages16M
 nor.bin--模拟nor flash挂载jffs2型号为sst25vf2M
第一次启动时会看到fatfs挂在失败。
按下回车出现finsh然后输入`mkfs("elm", "sd0")`格式化SD卡如下所示
	finsh>>mkfs("elm", "sd0")
			0, 0x00000000
然后重启程序就可以看到fatfs挂载成功了

2) 测试RTGUI
启动后就会看到GUI窗口分辨率800x480此时在finsh中输入snake_main()并回车,即可运行贪吃蛇程序

3) 测试APP module
rtconfig.h中需要打开RT_USING_MODULE

a. 生成rtthread.def文件
使用msv编译主程序时需要此文件使用MingW编译主程序时不需要
msvc需要此文件才能生成正确导出符号的rtthread.dll和rtthread-win32.exe。
此目录下默认自带了一个rtthread.def文件当修改了rtconfig.h禁用了某些组件时则需要重新生成rtthread.def文件.
生成方法:
需要借助MingW工具修改rtconfig.py中CROSS_TOOL为'mingw'然后打开CMD执行`scons --def`就会自动更新rtthread.def。

b. 生成主程序
  主程序可以使用msvc和mingw生成
  如果rtconfig.h中的使能了RTGUI则需要参考第二节第1小节配置RTGUI
  a.1 使用msvc
	  修改rtconfig.py中CROSS_TOOL为'msvc'
	  首先要保证当前目录下有合适的rtthread.def文件如果没有对默认的rtconfig.h作修改则使用默认的rtthread.def即可
	  CMD命令行执行`scons -j4`即可生成rtthread.dll和 rtthread-win32.exe
  a.2 使用mingw
	  修改rtconfig.py中CROSS_TOOL为'mingw'
	  CMD命令行执行`scons -j4`,这就会生成 rtthread.dll和 rtthread-win32.exe

c. 生成app module
  进入testdll目录再次修改 testdll/SConstruct 同样需要配置RTT_RTGUI路径同 1中3)
  在此目录下执行
    `scons --app=basicapp`
  就会在 basicapp/building目录下生成 basicapp.dll。 

  然后运行simulator目录下的 rtthread-win32.exe, 在finsh中运行   
    `exec("/testdll/basicapp/build/basicapp.dll")` 
  如果觉得这个路径太长,就把 basicapp.dll复制到 simualtor目录下执行
    `exec("/basicapp.dll")`

  编译贪吃蛇程序
  执行`scons --app=snake`就会在snake/build/下生成snake.dll按照同样的方式加载即可