k66 cache

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

k66 cache

1,005 Views
maheshwarreddy
Contributor I

hii,

 how can i enable the cache and how it is used to increase the speedof the execution of the instructions 

Labels (2)
Tags (2)
0 Kudos
4 Replies

571 Views
cutworth
NXP Employee
NXP Employee

Hi Reddy,

For K66 cache, need some clarification here. There are two different types of caches on chip. One is the flash cache, referred to as FMC module for flash acceleration so it can provide single cycle access time for instructions read from internal flash. The other is the local cache referred to as LMEM module which provides caching capability for external memories such as SDRAM. Please note on K66, only code cache is available, there is no system cache, so any address range above 0x20000000 is non-cacheable.  

pastedImage_1.png

Default configuration on K66 is FMC cache is enabled, while LMEM cache is not. So if you try to run code on external SDRAM, you need to use the KSDK code to enable LMEM code cache.

For performance increase, you can try to run Coremark code to see the difference of enabling or disabling cache.

EEMBC - CoreMark - Processor Benchmark 

Hao

0 Kudos

571 Views
maheshwarreddy
Contributor I

hi,

Thank you for the reply , iam using the ksdk2.0 iam unable find that LMEM enable function . iam new to this can you  tell the steps to enable the cache  for run the code in the SDRAM in k66.

0 Kudos

571 Views
cutworth
NXP Employee
NXP Employee

Hi Reddy,

Did you download the latest KSDK2.0 package for K66? If so, then you could look at the folder devices\MK66F18\drivers and find file fsl_lmem_cache.c and fsl_lmem_cache.h. 

What you need to do is just call the following function.

void LMEM_EnableCodeCache(LMEM_Type *base, bool enable)
{
if (enable)
{
/* First, invalidate the entire cache. */
LMEM_CodeCacheInvalidateAll(base);

/* Now enable the cache. */
base->PCCCR |= LMEM_PCCCR_ENCACHE_MASK;
}
else
{
/* First, push any modified contents. */
LMEM_CodeCachePushAll(base);

/* Now disable the cache. */
base->PCCCR &= ~LMEM_PCCCR_ENCACHE_MASK;
}
}

Hao

571 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi

I would recommend customer to download KSDK V2.0 software for K66 product, which provides the K66 LMEM module driver to control the code cache.

The KSDK V2.0 API reference manual document will detailed introduce each LMEM driver API function.


Wish it helps.

Have a great day,
Ma Hui
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos