AnsweredAssumed Answered

trying to get U-Boot to run on MCF5445x - some weird (toolchain?) error

Question asked by Wolfgang Wegner on Jan 18, 2010
Latest reply on Jan 19, 2010 by Wolfgang Wegner
Dear all,
I am having some severe trouble getting U-Boot ported on my MCF54455 board, running in many different failures and strange behaviour.

Now I switched to the (probably newest) CodeSourcery toolchain:
freescale-coldfire-4.4-53-m68k-uclinux-i686-pc-linux-gnu.tar.bz2

and have a (at least reproducible) problem with this code:
[in board_init_f]
[...]
/* rewritten for better breakpoint placement */
init_fnc_ptr = init_sequence;
loop:
if (*init_fnc_ptr) {
if ((*init_fnc_ptr)() != 0) {
hang ();
}
init_fnc_ptr++;
goto loop;
}

In disassembly this is:
40020888 :
40020888: 4e56 ffb0 linkw %fp,#-80
4002088c: 2e3c 8000 7f60 movel #-2147451040,%d7
40020892: 48d7 240c moveml %d2-%d3/%a2/%a5,%sp@
40020896: 4878 0044 pea 44 <__fixup_entries+0x44>
4002089a: 42a7 clrl %sp@-
4002089c: 2f07 movel %d7,%sp@-
4002089e: 61ff 0001 00da bsrl 4003097a <memset> 
400208a4: 4fef 000c lea %sp@(12),%sp
400208a8: 246d 0024 moveal %a5@(36),%a2
400208ac: 2052 moveal %a2@,%a0
400208ae: 4a88 tstl %a0
400208b0: 6710 beqs 400208c2 <board_init_f+0x3a> 
400208b2: 4e90 jsr %a0@
400208b4: 4a80 tstl %d0
400208b6: 6706 beqs 400208be <board_init_f+0x36> 
400208b8: 61ff ffff fc3a bsrl 400204f4
400208be: 588a addql #4,%a2
400208c0: 60ea bras 400208ac <board_init_f+0x24> 
400208c2: 303c 00fb movew #251,%d0
400208c6: 2047 moveal %d7,%a0

When debugging, calling the functions in the loop does not work. I figured out that setting a0 from (a2) does not work:
(gdb) file /raid/daten/router/edge-descrambler/bootloader/u-boot/u-boot/u-boot
(gdb) del
(gdb) break *0x400208ac
Breakpoint 3 at 0x400208ac: file board.c, line 260.
(gdb) c

Breakpoint 3, board_init_f (bootflag=0) at board.c:260
(gdb) print init_sequence
$2 = {0x40033866 <get_clocks>, 0x4002df36 <env_init>, 0x400205c2 <init_baudrate>, 0x4002692a <serial_init>, 0x4002cc16 <console_init_f>, 0x4002ff08 <display_options>, 0x400336bc <checkcpu>, 0x4002fc06 <checkboard>, 0x4002058e <init_func_i2c>, 0x40020564 <init_func_spi>, 0x40020508 <init_func_ram>, 0}
(gdb) info registers
[...]
a0 0x80007f60 0x80007f60
a1 0x80007fa4 0x80007fa4
a2 0x40044f7c 0x40044f7c
[...]
(gdb) step
(gdb) info registers
[...]
a0 0x80007f60 0x80007f60
a1 0x80007fa4 0x80007fa4
a2 0x40044f7c 0x40044f7c
[...]
(gdb) p /x *0x40044f7c
$1 = 0x40033866
(gdb) set $a0=0x40033866
(gdb) step
get_clocks () at speed.c:101
(gdb)

So actually calling the function works if I set the register manually.
Another strange thing (for me) is that debugging fails if I set a breakpoint to e.g. 0x40020888 or try to step over 0x400208b8 - could it be the debugger has some problem with long-word and bigger instructions?

I am really puzzled about this and stuck here.

Any hints what I might be doing wrong are highly appreciated. Also comments about successful use of GNU toolchain for this processor would be helpful to see if the toolchain might be a problem or not.

Best regards,
Wolfgang

Outcomes