1. 参数越少,越省空间(结果全局变量一大堆)。
2. 函数越少,越省空间。若某函数调用次数少,干脆去掉该函数。
3. 有时候用常量数组,可省空间。
4. 少用switch(), 会比用if…else…用得多一点空间。
5. 在寄存器取值时,加些延时,可确保数据的正确性。
如何在Keil开发工具?Vision4中集成源代码管理工具菜单,如VSS菜单?
我本机安装了源代码管理工具Microsoft Visual SourceSafe 2005 (安装路径为C:\Program Files\Microsoft Visual SourceSafe),添加VSS菜单的详细步骤如下:
a. 打开?Vision4后,打开菜单SVCS->Configure Software Version Control...
b.新建立记事本文件Microsoft Visual SourceSafe2005.txt,输入如下内容后,重命名为Microsoft Visual SourceSafe2005.SVCS (注意下面内容中D:\Li\VSS\这个路径是我的VSS2005设置的Database:srcsafe.ini文件的路径,注意修改。另外VSS要求设置current project,所以每次打开一个新的项目时,都应该进入SVCS->Configure software version control...->选Set current project把参数改为当前的VSS项目名如:CP $/Software/Projects_C/Test)
[SVCS]
DataBase=
MenuItem=SourceSafe &Explorer
Command=C:\Program Files\Microsoft Visual SourceSafe\S***P.EXE
Arguments=-Y%U
Environment=
RunMinimized=0
QueryComment=0
QueryRevision=0
QueryCheckPoint=0
Initial_Folder=
MenuItem=Check &In '%F'
Command=C:\Program Files\Microsoft Visual SourceSafe\Ss.exe
Arguments=CheckIn %F -C- -I- -Y%U
Environment=ssdir=D:\Li\VSS\;Temp=%USERPROFILE%\AppData\Local\Temp
RunMinimized=1
QueryComment=0
QueryRevision=0
QueryCheckPoint=0
Initial_Folder=
MenuItem=Check &Out '%F'
Command=C:\Program Files\Microsoft Visual SourceSafe\Ss.exe
Arguments=CheckOut "%F" -C- -I- -Y%U
Environment=ssdir=D:\Li\VSS\;Temp=%USERPROFILE%\AppData\Local\Temp
RunMinimized=1
QueryComment=0
QueryRevision=0
QueryCheckPoint=0
Initial_Folder=
MenuItem=&Undo Check Out '%F'
Command=C:\Program Files\Microsoft Visual SourceSafe\Ss.exe
Arguments=UndoCheckOut "%F" -I-Y -Y%U
Environment=ssdir=D:\Li\VSS\;Temp=%USERPROFILE%\AppData\Local\Temp
RunMinimized=1
QueryComment=0
QueryRevision=0
QueryCheckPoint=0
Initial_Folder=
MenuItem=&Get Latest Version of '%F'
Command=C:\Program Files\Microsoft Visual SourceSafe\Ss.exe
Arguments=Get "%F" -I- -GWR -Y%U
Environment=ssdir=D:\Li\VSS\;Temp=%USERPROFILE%\AppData\Local\Temp
RunMinimized=1
QueryComment=0
QueryRevision=0
QueryCheckPoint=0
Initial_Folder=
MenuItem=&Add '%F' to current Project
Command=C:\Program Files\Microsoft Visual SourceSafe\SS.EXE
Arguments=Add "%F" -I- -C- -Y%U
Environment=ssdir=D:\Li\VSS\;Temp=%USERPROFILE%\AppData\Local\Temp
RunMinimized=1
QueryComment=0
QueryRevision=0
QueryCheckPoint=0
Initial_Folder=
MenuItem=&List all items of project
Command=C:\Program Files\Microsoft Visual SourceSafe\Ss.exe
Arguments=dir -R -Y%U
Environment=ssdir=D:\Li\VSS\;Temp=%USERPROFILE%\AppData\Local\Temp
RunMinimized=1
QueryComment=0
QueryRevision=0
QueryCheckPoint=0
Initial_Folder=
MenuItem=Lists all checked-out files
Command=C:\Program Files\Microsoft Visual SourceSafe\Ss.exe
Arguments=Status -Y%U
Environment=ssdir=D:\Li\VSS\;Temp=%USERPROFILE%\AppData\Local\Temp
RunMinimized=1
QueryComment=0
QueryRevision=0
QueryCheckPoint=0
Initial_Folder=
MenuItem=Set current project
Command=C:\Program Files\Microsoft Visual SourceSafe\Ss.exe
Arguments=CP $/Software/Projects_C/Test
Environment=ssdir=D:\Li\VSS\;Temp=%USERPROFILE%\AppData\Local\Temp
RunMinimized=1
QueryComment=0
QueryRevision=0
QueryCheckPoint=0
Initial_Folder=
c. 选择Template File: Microsoft Visual SourceSafe2005.SVCS,输入用户名(如:li)
d. 再次打开菜单SVCS,集成的VSS菜单出来了。
e. 选择SVCS->SourceSafe Exporer后,将调用VSS2005,新建立Project,添加源文件后就可以愉快编程了。