Delay Procedure
B-4
B.3 Delay Procedure
Use the following software routine to create a delay of 100 clock cycles after
a switch mode write.
Ensure the I-cache is enabled during switching modes.
state16
; thumb mode
.ref
edata
; defined by armas
.global $switch_mode
$switch_mode:
push
{lr}
push
{r1-r7}
adr
r4, into_32_bis
bx
r4
nop
nop
nop
.state32
; arm mode
into_32_bis:
;
LDR
R1,ARM_SYSST
MOV
R3,#0
MOV
R2,#0
; This is the loop that will wait for at least 100 cycles
; before issuing next request from MPU. On the first run
of the loop only Icache
; gets loaded with the loop and the next 2 instructions
but write to SYSST does not occur
; In the 2nd run of the loop only write to SYSST happens
and after that MPU runs the loop from
;Icache so no request goes out
LOOP
CMP
R2,#1
STREQ R0,[R1]
ADD
R2,R2,#1
CMP
R2,#16
BNE
LOOP
the_end: