This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
如果不开cache,spi flash没有问题;开cache后,发现写进flash的数据和回读数据不一致。
cache开启流程如下:
MMUTtbInit();
// Configures translation table base register
// with pagetable base address.
CP15TtbSet((UINT)m_auiPageTable);
// Enables MMU
CP15MMUEnable();
// Enable Instruction Cache
CP15ICacheEnable();
// Enable Data Cache
CP15DCacheEnable();
是否是cache使用有误?
我把所有代码段和数据段全部都加入到cache表了:
#define CACHE_DDR_START_ADDR 0xC00 // 0xC0000000
#define CACHE_DDR_END_ADDR 0xC10 // 0xC1000000
static void MMUTtbInit(void)
{
UINT uiIdx;
for (uiIdx = 0; uiIdx < (4*1024); uiIdx++)
{
if ((uiIdx >= CACHE_DDR_START_ADDR) && (uiIdx < CACHE_DDR_END_ADDR))
{
m_auiPageTable[uiIdx] = (uiIdx << 20) | 0x00000C1E;
}
else
{
m_auiPageTable[uiIdx] = (uiIdx << 20) | 0x00000C12;
}
}
}