Hello,
I have the IDK AM574x development board and I'm trying to understand how to set up the MMU and caching when running bare metal. I'm using CCS 9.1 and SDK 6_01_00_08. I have the example in \pdk_am57xx_1_0_16\packages\ti\csl\example\mmu\a15_data_validation running as a CCS project. I noticed that the UART is not used unless the MMU is disabled. What MMU/cache settings do I need to add so that the UART can be used with the MMU enabled? I made the following changes to mmu_a15_data_validation_app_main.c without success. The first Puts() works fine but the second does not. I'm new to this processor. Can someone end my struggles and provide some guidance? Are there other bare metal examples for the AM574x that address MMU and caching?
Thanks,
KTM
uint32_t deviceMemory = 0x48000000;
UARTConfigPuts(uartBaseAddr,"\r\nA15 MMU Data Validation Test Application", -1);
/* Check if cache is already enabled */
cacheEnabled = CACHEA15GetEnabled();
/* In case cache is disabled, invalidate and enable it */
if (CACHE_A15_TYPE_ALL != cacheEnabled)
{
CACHEA15InvalidateL1DAll();
CACHEA15InvalidateL1IAll();
CACHEA15Enable(CACHE_A15_TYPE_ALL);
}
/* Initialize MMU module */
MMUA15Init();
/* See Tables B4-7 and B4-8 of ARM Architecture Reference Manual for attribute bit values */
/* 0x00 = Strongly-ordered or Device, non-cacheable
* 0x44 = Normal memory type, Outer non-cacheable, Inner non-cacheable
* 0xFF = Normal memory type, Outer write-through cacheable, Inner write-back cacheable
*/
MMUA15SetMAIR(&gMmuTable, MMU_A15_ATTR_INDEX_0, 0x44); /* Normal memory, non-cacheable */
MMUA15SetMAIR(&gMmuTable, MMU_A15_ATTR_INDEX_1, 0x00); /* Device (for peripherals), non-cacheable */
MMUA15SetMAIR(&gMmuTable, MMU_A15_ATTR_INDEX_2, 0xFF); /* Normal memory, inner and outer cacheable */
/* Initialize descriptor attributes */
MMUA15InitDescAttrs(&gAttrs);
/* Set level one descriptor attributes */
gAttrs.descriptorType = MMU_A15_DESCRIPTOR_TYPE_BLOCK;
gAttrs.attrIndx = MMU_A15_ATTR_INDEX_2;
gAttrs.nonSecure = MMU_A15_NON_SECURE_ENABLE;
gAttrs.accPerm = MMU_A15_ACC_PERM_RW_ANY_PL; /*Read Write at any PL*/
/* Set level one descriptor */
virtualAddr = 0x0, phyAddr = 0x0;
MMUA15SetFirstLevelDesc(&gMmuTable, virtualAddr, phyAddr, &gAttrs);
virtualAddr = 0x40000000, phyAddr = 0x40000000;
MMUA15SetFirstLevelDesc(&gMmuTable, virtualAddr, phyAddr, &gAttrs);
virtualAddr = 0x80000000, phyAddr = 0x80000000;
MMUA15SetFirstLevelDesc(&gMmuTable, virtualAddr, phyAddr, &gAttrs);
virtualAddr = 0xc0000000, phyAddr = 0x80000000;
MMUA15SetFirstLevelDesc(&gMmuTable, virtualAddr, phyAddr, &gAttrs);
gAttrs.attrIndx = MMU_A15_ATTR_INDEX_1;
gAttrs.noExecute = TRUE;
gAttrs.shareable = MMU_A15_NON_SHAREABLE;
gAttrs.nonSecure = MMU_A15_NON_SECURE_DISABLE;
MMUA15SetSecondLevelDesc(&gMmuTable, deviceMemory, deviceMemory, &gAttrs);
/* Enable MMU */
MMUA15Enable(&gMmuTable);
UARTConfigPuts(uartBaseAddr,"\r\nCache configure 2", -1);