Example 10. Moving a Function from Slow to Fast Memory at Run Time

;----------------------------------------------------------- ; define a section to be copied from SLOW_MEM to FAST_MEM ;----------------------------------------------------------- .sect ".fir" .label fir_src ; load address of section fir: ; run address of section <code here> ; code for section .label fir_end ; load address of section end ;----------------------------------------------------------- ; copy .fir section from SLOW_MEM to FAST_MEM ;----------------------------------------------------------- .text LDR r4, fir_s ; get fir load address start LDR r5, fir_e ; get fir load address stop LDR r3, fir_a ; get fir run address $1: CMP r4, r5 LDRCC r0, [r4], #4 ; copy fir routine to its ; run address STRCC r0, [r3], #4 BCC $1 ;----------------------------------------------------------- ; jump to fir routine, now in FAST_MEM ;----------------------------------------------------------- B fir fir_a .word fir fir_s .word fir_start fir_e .word fir_end