Nations Technologies Inc.
Tel
:
+86-755-86309900
:
Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North.
Nanshan District, Shenzhen, 518057, P.R.China
21
/
631
Cache locking mechanism is supported, and the software configuration puts the program into its designated
way. When all the ways are locked, the new data will not be written into the cache. After the software resets
the cache, the lock state is automatically cleared.
Additional remarks
Selection of Cache replacement algorithm is not supported.
When using icache, there is no WB/WT selection when the CPU writes operation.
Register description
FLASH_AC.ICAHEN and FLASH_AC.ICAHRST are the iCache enable switch and iCache data clear switch
respectively.
FLASH_CAHR.LOCKSTRT and FLASH_CAHR.LOCKSTOP are the start latch and stop latch of iCache
corresponding mode lock, respectively. After iCache is reset, the FLASH_CAHR register automatically returns to
the reset value. See for detailed usage method of 2.2.2.3.3 ICache locking.
Operating process
2.2.2.3.1
iCache enable and disable
Users can turn on and switch off iCache at any time. If the user program needs to jump between the main memory
area and other memory areas, the iCache must be closed and the data of the iCache must be cleared, otherwise, the
instruction acquisition error will occur.
2.2.2.3.2
iCache data refresh
The iCache is designed as instruction cache. When the instruction is updated by application software or the instruction
jumps between the main memory area and other memory areas, the software must set the FLASH_AC.ICAHRST bit
to 1 to clear the data in the instruction cache.
Note: FLASH_AC.ICAHRST bit is a write-only bit, and it returns to 0 when read.
2.2.2.3.3
iCache locking
The software controls the FLASH_CAHR register to lock some repeatedly used codes in iCache to improve the
efficiency of code execution. iCache module has four latch channels, and the size of each channel is 1/4 of the whole
cache. When using a single channel, you must ensure that the amount of code to latch is less than the size of each
channel. Otherwise need to use more channels to latch the code. The latch function can be used according to the
following control flow:
1.
Set FLASH_CAHR.LOCKSTRT[0] to 1;
2.
Execute function 1 that needs to be locked in channel 0 (the code amount of function 1 should be less than
the size of a single channel);
3.
Set FLASH_CAHR.LOCKSTOP[0] to 1 after the function 1 is executed;
4.
Then set FLASH_CAHR.LOCKSTRT[1] to 1;
5.
Execute function 2 that needs to be locked in channel 1 (the code amount of function 2 should be less than
the size of a single channel);