[U-Boot] c code write to ip (r12) register in cpu/arm926ejs/start.S
Måns Rullgård
mans at mansr.com
Fri Mar 12 15:15:30 CET 2010
Bjørnar Syverstad <bjornar at prediktor.no> writes:
> Hello,
> I use the phy3250 configuration. I try to debug the u-boot from the
> 256k internal ram.
>
> I have:
> - Undefined the CFG_BOOT_USES1L in include/configs/phy3250.h
> - Set the location counter to . = 0x00000000 in board/phy3250/u-boot.lds
> - In the board/phy3250/config.mk changed the TEXT_BASE = 0x00000000
> - Added the compiler flags -fno-schedule-insns -fno-schedule-insns2
Why those flags?
> The problem is that when debugging cpu/arm926ejs/start.S :
>
> ip (r12) seems to be used by the c code that is called by some
> subrutine under lowlevel_init. So when returning from lowlevel_init
> ip (r12) is have got another value.
>
> So the jump out of cpu_init_crit fails.
>
> I could change the code in start.S. But I do assume that it used a
> lot, and that it is not a bug. Could the problem be that the
> compiling of the c files? That there is a way to tell the compiler
> to not use the ip (r12) register?
R12 is a call-clobbered register. Expecting it to retain its value
across calls is a mistake.
Specifying the flag -ffixed-REG makes the compiler never use register
REG. This would probably fix your immediate issue without changing
any code, but I would prefer to see this addressed properly.
> mov ip, lr /* perserve link reg across call */
> bl lowlevel_init /* go setup pll,mux,memory */
> mov lr, ip /* restore link */
This definitely looks wrong. Only r4-r11 are preserved across
function calls.
--
Måns Rullgård
mans at mansr.com
More information about the U-Boot
mailing list