I have received a question about the remapping code in my AT91SAM7-"gamma" example (at http://www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects/index_at91.html#at91_gamma ). I think it is interesting for others or maybe others can give better or more detailed information so I have copied the question and my answer into the forum. --- >I have a question with regard to the SAM7 remap. >Here is some assembler code you wrote from the following project >AT91SAM7 SWI, Remap, GPIO, PIT and stdio Example ("Gamma") (last Updated >4.Sept. 2006) [mthomas: from the gamma-examle/Cstartup.S:] /*---------------------------------------------------------------------- -------- /*- Remapping /*---------------------------------------------------------------------- --------*/ .if (VECTREMAPPED) .print "RCR setting for remapping enabled" .equ MC_BASE,0xFFFFFF00 /* MC Base Address */ .equ MC_RCR, 0x00 /* MC_RCR Offset */ /* store first word in RAM into r4 */ ldr r0,=__FIRST_IN_RAM ldr r4,[r0] /* load value at address 0 into R2 */ ldr r1,=0x00000000 ldr r2,[r1] /* xor value from address 0 (flip all bits), store in R3 */ ldr r3,=0xffffffff eor r3, r2, r3 /* write xored value to first word in RAM if already remapped this will also change the value at 0 */ str r3,[r0] /* load from address 0 again into R3 */ ldr r3,[r1] /* restore first value in RAM */ str r4,[r0] /* compare */ cmp r3, r2 bne already_remapped /* if both values have been equal the change of the RAM-value had no effect on the value at 0x00000000 so we are not remapping yet -> remap now: */ LDR R0, =MC_BASE MOV R1, #1 STR R1, [R0, #MC_RCR] already_remapped: .endif [mthomas: end of "cited" code] >First I assume that the above code is executing from flash and not from RAM. Yes, I have wrapped this code between .if/.endif and it is ment to be used for the "ROM_RUN" (=flash) target. Remap for target RAM_RUN is usualy done by the debugging-software by writing directly into the processor-registers so there is no option for remapping and "RAM_RUN" in this example. >After the remap instruction in red [mthomas: the lines >LDR R0, =MC_BASE, MOV R1, #1 STR R1, [R0, #MC_RCR] ] above you don
Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
Log in with Google account
No account? Register here.