EMI配置(Flash,RAM等)
NorFlash&RAM配置的基本步骤:
ROMan">1、 Option.mak:确认平台选用MCP或者LPSDRAM的Device list.(例如:mtk08A选择的Device list为:memoryDeviceList_Since08Aw0820.xls)
2、 Flash_opt.h:确认选择的外部Memory,并且确认型号,通过型号可以查看相应的一些参数值,通过这些参数对程序的宏,变量,结构体等进行设置。
3、 通过Device list同样可以知道目前的系统Support哪些型号的MCP和LPSDRAM,如果要更换不同的厂家,型号,容量等就可以从Device list中去查找,选择好Device型号后,通过对应型号的参数对对程序的宏,变量,结构体等进行设置。
4、 设置文件及内容如下:
设置方法一:自动
设置过程:Perl运行emiGenv5.pl,通过custom_memorydevice.h,去搜寻MemoryDeviceList_Since08Aw0820.xls,然后自动产生如下的五个文件。
flash_opt.h,custom_emi.h,custom_emi.c,custom_flash.c, custom_flash_norfdm5.c,
-----------------------------------------------------------------------------------------------------------
#define MEMORY_DEVICE_TYPE NOR_RAM_MCP//Memory 类型
#define NOR_FLASH_TYPE_SPANSION_PL_N //memory 型号
const kal_uint32 EMI_EXTSRAM_SIZE = ((64)<<20)>> 3//外部RAM的大小
#define __MULTI_BANK_NOR_DEVICE__ //对应的Nor的属性
#define CS0_PART_NUMBER S71PL256NC0HAW5B//CS0 型号
#define CS1_PART_NUMBER S71PL256NC0HAW5B// CS1型号
#define FLASH_ACCESS_TYPE ASYNC_ACCESS //Flash Access的类型
#define RAM_ACCESS_TYPE ASYNC_ACCESS //RAM Acess的类型
-----------------------------------------------------------------------------------------------------------
默认情况:FAT 在Norflash的最后一个Bank(Last Bank)
#define FLASH_BASE_ADDRESS (0x01C00000)//文件系统开始地址
#define ALLOCATED_FAT_SPACE (0x00400000)//文件系统大小
#define NOR_FAT_PARTITION_SECTORS 0//Norflash文件系统中给USER使用的//Sector数(512Byte/Sector)
#define PARTITION_SIZE (0) //Nanflash文件系统中给USER使用的Sector数, //(512Byte/Sector),如果不是NandBoot就设置为0
FLASH_REGIONINFO_VAR_MODIFIER FlashRegionInfo RegionInfo[] =
{
{0x40000,15},
{0x10000,4},
EndRegionInfo /* Don't modify this line */
}; //Last Bank的Block结构定义
#define TOTAL_BLOCKS 19//Region 的总的Block
-----------------------------------------------------------------------------------------------------------
#define __PAGE_BUFFER_PROGRAM__//定义是否支持PBP(Page Buffer Program)
#define BUFFER_PROGRAM_ITERATION_LENGTH (32)//program Buffer的大小
/*For low-cost (Flash size targetted at 16Mbits) single-bank NOR-flash solution, where partial of NVRAM is shadowed at RAM.*/
SINGLE_BANK_NOR_FLASH_SUPPORT = FALSE
/*For single-bank NOR-flash solution without shadowed NVRAM requirement.*/
ENHANCED_SINGLE_BANK_NOR_FLASH_SUPPORT = FALSE
LOW_COST_SUPPORT = NONE // 是否支持小容量Memory
-----------------------------------------------------------------------------------------------------------
#elif defined(MT6225)//定义Memory List中的Asynchrnous Driving Setting
#define EMI_GENERAL_CONTROL_0 0x40008000
#define EMI_GENERAL_CONTROL_1 0x739c739c
#if defined(MT6225)// Asynchrnous EMI Setting (Maximal MPLL)
const kal_uint32 EMI_SettingOnCS[4] =
{
0x40514648,
0x40514808,
0,
0
};
-----------------------------------------------------------------------------------------------------------
//#define __NOR_FDM5__ //custom_memorydevice.h,定义是否使用FDM5功能
MTK NOR FDM is upgraded to 5.0 from 2006/Q3 to support large NOR-flash disk (multi-bank), for example, disk space larger than 64blocks(指的是FAT的总Block数).
NOR FDM 5.0 and NOR FDM 4.0 主要区别如下:
1. RAM consumption:To manage 32MB INTEL M18 NOR-flash disk, FDM 5.0 consumes 1KB,but FDM 4.0 takes 32KB.
2. Addressable block numbers:The addressable space of NOR FDM 5.0 is 65K-1 blocks, but NOR FDM 4.0 is limited at 128-1 blocks.
3. Idle reclaim and manual reclaim are implemented on NOR FDM 5.0.To enable NOR FDM 5.0 on NOR-flash disk, please enable the following definition and customize custom_flash_norfdm5.c; the option is switch on/off at customer site without deliver new library.
[REMIND] To manage small disk space, like smaller than 64 blocks, FDM 4.0 is recommended.
FDM的设置步骤:
1. 在custom_MemoryDevice.h中添加“#define __NOR_FDM5__”。
2. 编辑custom_flash_norfdm5.c,编辑方法如下。
3. clean 并 remake “custom”模块。
-----------------------------------------------------------------------------------------------------------
设置方法二:手动
设置过程:手动编辑New时自动产生的5个文件如下,编辑方式见上文:
flash_opt.h,custom_emi.h,custom_emi.c,custom_flash.c, custom_flash_norfdm5.c,
然后clean并remake“custom”模块。
注意点:
手动设置会出现Code和FAT公用一个Bank的情况,此时修改方式如下:
1. 即使外部使用的NorFlash为Multi Bank,上文介绍的编译开关ENHANCED_SINGLE_BANK_NOR_FLASH_SUPPORT或者SINGLE_BANK_NOR_FLASH_SUPPORT需要打开。
2. 当设置了SINGLE_BANK_NOR_FLASH_SUPPORT时,则需要设置SNOR_ERASE_QUEUE_SIZE的值,表示在FAT中预留的Block数,此时FAT的大小变成:
ALLOCATED_FAT_SPACE-(SNOR_ERASE_QUEUE_SIZE×Max Block Size)
3. 当调整FLASH_BASE_ADDRESS和ALLOCATED_FAT_SPACE后,对应的RegionInfo和BankInfo需要相应调整,详细说明如下。