由於項目需要節約成本,更新硬體,主要包括PPC MPC5125處理器、DDR2記憶體以及Norflash。林工希望換掉老的spansion S29GL128P, 更新為速度更快、容量更大的spansion 65 nm S29GL256S,但在硬體設計初期發現之前使用的flash燒寫工具flashprogrammer並不支援該款新的flash,所有硬體做好了都得讓我調試,解決這個問題的任務自然推到我這裡。於是下載手冊看其區別,其實改動很小,但為了確定還是給freescale的支援人員打電話詢問。我的freescale支援很熱心,但儼然不夠專業,甚至連自己公司有哪些技術文檔都不知道。當然freescale的技術文檔浩如煙海,也不能怪他。打了好幾次電話只讓我去找第三方軟體,實在不靠譜,只好設法聯絡spansion的支援人員。在網上搜了半天,發現在其官網可以發郵件諮詢任何問題,其效率之高讓我十分佩服。回答簡明扼要,一是貼了一個新老版本flash的附件,幾乎把軟硬體上的設計差別都講清楚了,二是關於燒寫軟體的問題,一句話就是讓freescale去更新codewarrior,於是陷入死胡同。一邊給了方法,一邊說軟體演算法部分是由第三方做的,不提供更新,實在讓我很頭疼。
過了幾天,在網上搜到一篇freescale的技術文檔“Adding Flash Devices to the EPPC Flash Programmer”,讓我頓時很興奮,又後悔當時沒有認真在官網上找這篇文章。開啟一看,正是我要找的內容,按照以下方法在EEPC\FPdeviceConfig.xml中新定義了S29GL256S。
To add Flash programming support for a new Flash device:
1. Locate the data sheet for the new device.
2. Examine the installed FPDeviceConfig.xml file for the most similar definition.
3. Copy and edit the definition to make it conform to the new device.
Before you can add a new entry to this file you need to know the following about your Flash device:
> Device name
> Manufacturer ID code
> Device ID codes (8-bit, 16-bit)
> Number of sectors
> Starting and ending address for each sector
> Can the device be chip-erased
> Options for data bits per device (8-bits, 16-bits)
> Number of Flash devices on your target
> What device is most similar in the FPDeviceConfig.xml file
具體區別還得看晶片手冊,這個用XML語言寫的設定檔修改起來很方便,添加如下定義
<comment>
#######################################################################
</comment>
</device>
<device>
<name>S29GL256S</name>
<manufacturerid>01</manufacturerid>
<chiperase>TRUE</chiperase>
<sectorcount>256</sectorcount>
<sectorstart>00000000</sectorstart>
<sectorend>0001FFFF</sectorend>
<sectorstart>00020000</sectorstart>
<sectorend>0003FFFF</sectorend>
.......
<sectorstart>01FE0000</sectorstart>
<sectorend>01FFFFFF</sectorend>
<organizationcount>3</organizationcount>
<organization>16Mx16x1</organization>
<organization>16Mx16x2</organization>
<organization>16Mx16x4</organization>
<id>227E</id>
<id>227E</id>
<id>227E</id>
<algorithm>amd16x1.elf</algorithm>
<algorithm>amd16x2.elf</algorithm>
<algorithm>amd16x4.elf</algorithm>
其實之前一直擔心演算法不會不一樣,看了所有flash的演算法後,發現大部分都是一樣的,甚至相近的都可以通用。該文檔還介紹了使用perl語言來插入一個falsh entry,由於比較複雜就不在說明。
第一次使用XML語言和Perl語言,發現這種標誌語言與之前QNX中使用的buildfile命令、linux提示符命令有很大相同之處。記得之前做一個使用SD卡做STM32設定檔的項目,想到了類似的方法,當時還不知道這些描述語言,就自己寫了一個可識別許多標誌很資訊的指令碼,感覺很好用,現在才知道有這種規範。