65
/
838
Nations Technologies Inc.
Tel
:
+86-755-86309900
:
Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North.
Nanshan District, Shenzhen, 518057, P.R.China
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 3.2.2.3.3 ICache locking.
Operating process
3.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.
3.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.
3.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);
6.
After the function 2 is executed, set FLASH_CAHR.LOCKSTOP[1] to 1;
Attention: 1. when the channel is latched, the register operation must follow a fixed process -First set
FLASH_CAHR.LOCKSTRT then set FLASH_CAHR.LOCKSTOP;
2. The order of channel latch must be 0~3, otherwise it will reduce the execution efficiency.
3.2.3
SRAM
SRAM is mainly used for code operation to store variables and data or stacks during program execution. The
maximum capacity is 128KB.
SRAM supports read-write access of byte, half-word and word.
SRAM supports code running (supports access of SBus, ICode and DCode), and can run programs at full speed in