最近在项目中遇到NvM_ReadAll时间过长问题,经过验证得到以下几种优化方法,所用模块为Fee_30_FlexNor。
- 合并减少上电读Block数量及数据
- 配置为上电ReadAll的Block同时也配置为WriteAll
- 增大写入频率较高的Block的WriteCycle
- 下电后存储LookupTable,在NvM_WriteAll之后调用Fee_30_FlexNor_PersistLookupTable(例如BswM_ESH_OnEnterShutdown中),示例:
Std_ReturnType retVal;
NvM_RequestResultType nvJobResult;
Fee_30_FlexNor_ConstConfigPtrType config = Fee_30_FlexNor_ConfigInterface_GetConfig();
for(uint8 pIndex = 0; pIndex < config->PartitionCount; pIndex++)
{
retVal = Fee_30_FlexNor_PersistLookupTable(pIndex);
if(E_OK == retVal)
{
do
{
Fee_30_FlexNor_MainFunction();
Fls_MainFunction();
nvJobResult = Fee_30_FlexNor_GetJobResult();
}while(MEMIF_JOB_PENDING == nvJobResult);
}
}