來自
http://www.cnblogs.com/walzer/archive/2006/04/21/380851.html首先解釋下這兩個(gè)東東
The RAM on a Windows CE–based device is divided into two areas: the object store and the program memory.
The object store resembles a permanent, virtual RAM disk. Data in the object store is retained when you suspend or perform a soft reset operation on the system. Devices typically have a backup power supply for the RAM to preserve data if the main power supply is interrupted temporarily. When operation resumes, the system looks for a previously created object store in RAM and uses it, if one is found. Devices that do not have battery-backed RAM can use the hive-based registry to preserve data during multiple boot processes.
The program memory consists of the remaining RAM. Program memory works like the RAM in personal computers — it stores the heaps and stacks for the applications that are running.
我承認(rèn)我很懶,上面一段話的URL是ms-help://MS.WindowsCE.500/wcecoreos5/html/wce50conMemoryArchitecture.htm
具體的設(shè)置可以在系統(tǒng)啟動(dòng)后,Control Panel -> System -> Memory 里面看到。默認(rèn)的是把內(nèi)存五五開,一半給Storage Memory, 一半給Program Memory用。這樣顯然是不合算的。以64M的RAM為例, 啟動(dòng)后Storage Memory 32M, 而因?yàn)闆]有留出界面讓用戶往里面拷東西, 任何時(shí)候in use都不會(huì)超過10M; Program Memory也是32M, 但啟動(dòng)后就用掉27M, 實(shí)際上應(yīng)用程序可用的內(nèi)存只有5M, 一旦達(dá)到了上限, 那么每前進(jìn)一步都要很艱難地去釋放幾十K內(nèi)存,然后用掉,再去釋放幾十K內(nèi)存,如此循環(huán),此時(shí)應(yīng)用程序的運(yùn)行速度狂慢無比.
劃分的方法也很簡(jiǎn)單, 只不過可能沒人注意到而已.
說明在ms-help://MS.WindowsCE.500/wceosdev5/html/wce50lrfFSRAMPERCENT.htm? 懶得看英文的人就繼續(xù)往下看
其實(shí)說白了就一句話, 在BSP的config.bib里 CONFIG 區(qū)添加這個(gè)變量 FSRAMPERCENT = 0xXXXXXX, 但注意兩點(diǎn),
(1) 必須寫在config.bib的CONFIG區(qū)里, 不是plagform.bib不是config.reg等其他文件而是config.bib,也不是config.bib文件的任意地方而一定要在CONFIG REGION里.
(2) FSRAMPERCENT這個(gè)變量一定得寫為FSRAMPERCENT, 不能寫成FSROMPERCENT不能寫成ILOVEU, 或者阿貓阿狗什么的.
寫下這兩句的時(shí)候本人已經(jīng)打開無敵光環(huán), 免疫一切雞蛋和西紅柿.
FSRAMPERCENT是一個(gè)4byte長(zhǎng)度的十六進(jìn)制數(shù), 我們用代數(shù)假設(shè) FSRAMPERCENT = 0xQXYZ, 其中Q,X,Y,Z都是十六進(jìn)制數(shù)
那么最終劃分給Storage Memory的大小 =? ( Q + X + Y +? Z ) / 0x400 * TOTAL_RAM_SIZE
以文中的例子來算, FSRAMPERCENT=0x10203040, 假設(shè)TOTAL_RAM_SIZE=64M, 那么StorageMemory= (0x10 + 0x20 + 0x30 + 0x40) / 0x400 * 64M = 10M.