How to Add the Flash Driver for WinCE5.0

The abstract of the document

The goal of this document is to guide the reader on how to modify the source code and re-build CE image to support a new flash type on an EP93xx board. A basic familiarity with WinCE is assumed.



Note: 

(1) TE28F320C3, TE28F256P30, and AM29LV320D flash types are demonstrated. 

(2) A flash daughter card is used.

(3) Cirrus' WinCE 5.0 BSP release, Scorpius 1.0.202, is used.

(4) All of the examples have been tested on an EDB9312 evaluation board. 

	

Create the environment

Assume that Cirrus' WinCE 5.0 BSP is used and $(WINCE500)\PLATFORM\ep93xx directory exists.

For 16bits FLASH, the user should select bsp of "CIRRUS EDB9315A: ARMV4I". For 32bits FLASH, the user should select bsp of "CIRRUS EDB9307/12/15: ARMV4I".

Add the flash driver

Flash driver list



fsd-intel          //Intel B3,C3,P30 2X16 mode and 1X16 mode flash function implementation for WinCE.

fsd-amd32          //AMD spansion29lv320d 2x16 mode flash function implementation for WinCE.

fsd-amd16          //AMD spansion29lv320d 1x16 mode flash function implementation for WinCE.

	

Add the TE28F320C3 flash support

Copy all files in the \fsd-intel directory to $(WINCE500)\PLATFORM\ep93xx\src\drivers\fsd directory.

Add the TE28F256P30 flash support

Copy all files in the \fsd-intel directory to $(WINCE500)\PLATFORM\ep93xx\src\drivers\fsd directory.

Add the AM29LV320D flash 32 bit mode support

Copy all files in the \fsd-amd32 directory to $(WINCE500)\PLATFORM\ep93xx\src\drivers\fsd directory.

Add the AM29LV320D flash 16 bit mode support

Copy all files in the \fsd-amd16 directory to $(WINCE500)\PLATFORM\ep93xx\src\drivers\fsd directory.

Other Changes for WinCE

Other changes for WinCE in 16 bit mode.

Edit $(WINCE500)\PLATFORM\ep93xx\files\platform-15a.reg



    Change:



	IF BSP_EP93XX_STRATA_FLASH

	

	; This file is to be included in platform.reg if required.

	;

	; It use the top 4MB space of flash (EDB931x):

	;   uncached base address = A9C00000

	;   memory size           = 400000

	

	

	[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\StrataFMD]

	   "Dll"="ep931xstratad.dll"

	   "Order"=dword:2

	   "Prefix"="DSK"

	   "Ioctl"=dword:4

	   "Profile"="MSFlash"

	   "IClass"="{A4E7EDDA-E575-4252-9D6B-4195D48BB865}"

	   "MemBase"=dword:A8C00000

	   "MemLen"=dword:400000

	

	; Override names in default profile

	[HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\MSFlash]

	    "Name"="MSFLASH for STRATAFLASH"

	    "Folder"="NOR Flash"

	

	[HKEY_LOCAL_MACHINE\System\StorageManager\AutoLoad\MSFlash]

	    "DriverPath"="Drivers\\BuiltIn\\StrataFMD"

	    ; LoadFlags 0x01 == load synchronously

	    "LoadFlags"=dword:1

	    "Order"=dword:0

	

	

	

	;;;*******************************************************************

	;;;

	;;; HIVE REGISTRY BOOT SECTION

	;;;

	;;;*******************************************************************

	;;

	;;[HKEY_LOCAL_MACHINE\init\BootVars]

	;;    "SystemHive"="\\Registry\\system.hv"

	;;    "Start DevMgr"=dword:1

	;;    "DefaultUser"="john"

	;;    "Flags"=dword:1

	;;

	

	ENDIF

        

    To:

	IF BSP_EP93XX_STRATA_FLASH

	

	; This file is to be included in platform.reg if required.

	; In the WinCE, the uncached flash base address is 0xA8000000

	; MemBase and MemLen should be defined by multi-value:

	;   The 1st value of "MemBase" is the base address of flash chip (physical address).

	;   The 2nd value of "MemBase" is the start address of flash file system(physical address).

	;   The 1st value of "MemLen" is the entire size of the flash chip (in bytes).

	;   The 2nd value of "MemLen" is the size of flash file system (in bytes).

	; MemBase1        MemBase2

	; |_______________|_______________|______________|

	; |               |_______________|              |

 	; |                  MemLen2                     |

   	; |______________________________________________| 	              

	;                    MemLen1



	; Constrains:

	; 1.  Membase2 - Membase1 > size of nk.bin(If Environment Variable BSP_EP93XX_COPY_FLASH_TO_RAM =1)

	; 2.  Membase1 + Memlen1 > MemBase2 + Memlen2  

	

	[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\StrataFMD]

	   "Dll"="ep931xstratad.dll"

	   "Order"=dword:2

	   "Prefix"="DSK"

	   "Ioctl"=dword:4

	   "Profile"="MSFlash"

	   "IClass"="{A4E7EDDA-E575-4252-9D6B-4195D48BB865}"

	   ;"MemBase"=dword:A9C00000

	   ;"MemLen"=dword:400000

	   ;"MemBase"=multi_sz:"60000000","200000"

	   "MemBase"=multi_sz:"A8000000","A8200000"

	   "MemLen" =multi_sz:"400000","200000"

	; Override names in default profile

	[HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\MSFlash]

	    "Name"="MSFLASH for STRATAFLASH"

	    "Folder"="NOR Flash"

	    "DefaultFileSystem"="FATFS"

	    "PartitionDriver"="mspart.dll"

	    "AutoMount"=dword:1

	    "AutoPart"=dword:1

	    "AutoFormat"=dword:1

	[HKEY_LOCAL_MACHINE\System\StorageManager\AutoLoad\MSFlash]

	    "DriverPath"="Drivers\\BuiltIn\\StrataFMD"

	    ; LoadFlags 0x01 == load synchronously

	    "LoadFlags"=dword:1

	    "Order"=dword:0

	

	;;;*******************************************************************

	;;;

	;;; HIVE REGISTRY BOOT SECTION

	;;;

	;;;*******************************************************************

	;;

	;;[HKEY_LOCAL_MACHINE\init\BootVars]

	;;    "SystemHive"="\\Registry\\system.hv"

	;;    "Start DevMgr"=dword:1

	;;    "DefaultUser"="john"

	;;    "Flags"=dword:1

	;;

	

	ENDIF        

	
Edit $(WINCE500)\PLATFORM\ep93xx\src\kernel\hal\edb9315a\startup.s


    Change

                ldr             r0, =((4:SHL:SMCBCR_WST2_SHIFT)  :or: \

                                      (15:SHL:SMCBCR_WSindex_SHIFT) :or: \

                                      (1 :and:SMCBCR_IDCY_MASK)  :or: \

                                      SMCBCR_MW_16BIT            :or: \

                                      SMCBCR_WP                  :or: \

                                      SMCBCR_PME                 :or: \

                                      SMCBCR_RBLE)





    To:

                ldr             r0, =0x1000FFEF

	

Edit $(WINCE500)\PLATFORM\ep93xx\src\inc\memorymap-9315a.h



    Change:

		#define SIZE_FLASH_INTEL                    0x01000000

    To:

		#define SIZE_FLASH_INTEL                    0x02000000

	

Other Changes for WinCE in 32 bit mode.

Edit $(WINCE500)\PLATFORM\ep93xx\files\platform-1x07.reg

   


    Change:

	IF BSP_EP93XX_STRATA_FLASH

	; This file is to be included in platform.reg if required.

	;

	; It use the top 4MB space of flash (EDB931x):

	;   uncached base address = A8000000

	;   memory size           = 400000	

		

	

	[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\StrataFMD]

	   "Dll"="ep931xstratad.dll"

	   "Order"=dword:2

	   "Prefix"="DSK"

	   "Ioctl"=dword:4

	   "Profile"="MSFlash"

	   "IClass"="{A4E7EDDA-E575-4252-9D6B-4195D48BB865}"

	   "MemBase"=dword:A9C00000

	   "MemLen"=dword:400000

	

	; Override names in default profile

	[HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\MSFlash]

	    "Name"="MSFLASH for STRATAFLASH"

	    "Folder"="NOR Flash"

	

	[HKEY_LOCAL_MACHINE\System\StorageManager\AutoLoad\MSFlash]

	    "DriverPath"="Drivers\\BuiltIn\\StrataFMD"

	    ; LoadFlags 0x01 == load synchronously

	    "LoadFlags"=dword:1

	    "Order"=dword:0

	

	

	

	;;;*******************************************************************

	;;;

	;;; HIVE REGISTRY BOOT SECTION

	;;;

	;;;*******************************************************************

	;;

	;;[HKEY_LOCAL_MACHINE\init\BootVars]

	;;    "SystemHive"="\\Registry\\system.hv"

	;;    "Start DevMgr"=dword:1

	;;    "DefaultUser"="john"

	;;    "Flags"=dword:1

	;;

	ENDIF





    To:

    	IF BSP_EP93XX_STRATA_FLASH

	

	; This file is to be included in platform.reg if required.

	; In the WinCE,the uncached flash base address is 0xA8000000

	; MemBase and MemLen should be defined by multi-value:

	;   The 1st value of "MemBase" is the base address of flash chip (physical address).

	;   The 2nd value of "MemBase" is the start address of flash file system(physical address).

	;   The 1st value of "MemLen" is the entire size of the flash chip (in bytes).

	;   The 2nd value of "MemLen" is the size of flash file system (in bytes).

	; MemBase1        MemBase2

	; |_______________|_______________|______________|

	; |               |_______________|              |

 	; |                  MemLen2                     |

   	; |______________________________________________| 	              

	;                    MemLen1



	; Constrains:

	; 1.  Membase2 - Membase1 > size of nk.bin(If Environment Variable BSP_EP93XX_COPY_FLASH_TO_RAM =1)

	; 2.  Membase1 + Memlen1 > MemBase2 + Memlen2  	

	

	[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\StrataFMD]

	   "Dll"="ep931xstratad.dll"

	   "Order"=dword:2

	   "Prefix"="DSK"

	   "Ioctl"=dword:4

	   "Profile"="MSFlash"

	   "IClass"="{A4E7EDDA-E575-4252-9D6B-4195D48BB865}"

	   ;"MemBase"=dword:A9C00000

	   ;"MemLen"=dword:400000

		"MemBase"=multi_sz:"A8000000","A8400000"

		"MemLen" =multi_sz:"800000","200000"

	; Override names in default profile

	[HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\MSFlash]

	    "Name"="MSFLASH for STRATAFLASH"

	    "Folder"="NOR Flash"

	    "DefaultFileSystem"="FATFS"

	    "PartitionDriver"="mspart.dll"

	    "AutoMount"=dword:1

	    "AutoPart"=dword:1

	    "AutoFormat"=dword:1

	[HKEY_LOCAL_MACHINE\System\StorageManager\AutoLoad\MSFlash]

	    "DriverPath"="Drivers\\BuiltIn\\StrataFMD"

	    ; LoadFlags 0x01 == load synchronously

	    "LoadFlags"=dword:1

	    "Order"=dword:0

	

	

	

	;;;*******************************************************************

	;;;

	;;; HIVE REGISTRY BOOT SECTION

	;;;

	;;;*******************************************************************

	;;

	;;[HKEY_LOCAL_MACHINE\init\BootVars]

	;;    "SystemHive"="\\Registry\\system.hv"

	;;    "Start DevMgr"=dword:1

	;;    "DefaultUser"="john"

	;;    "Flags"=dword:1

	;;

	ENDIF

	
Edit $(WINCE500)\PLATFORM\ep93xx\src\kernel\hal\edb9307_1x\startup.s


    Change

                ldr             r0, =((4:SHL:SMCBCR_WST2_SHIFT)  :or: \

                                      (15:SHL:SMCBCR_WSindex_SHIFT) :or: \

                                      (1 :and:SMCBCR_IDCY_MASK)  :or: \

                                      SMCBCR_MW_16BIT            :or: \

                                      SMCBCR_WP                  :or: \

                                      SMCBCR_PME                 :or: \

                                      SMCBCR_RBLE)





    To:

                ldr             r0, =0x2000FFEF

	

Edit $(WINCE500)\PLATFORM\ep93xx\src\inc\memorymap-1215.h



    Change:

		#define SIZE_FLASH_INTEL                    0x02000000

    To:

		#define SIZE_FLASH_INTEL                    0x04000000