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

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

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

跳至解决方案
1,516 次查看
w_wegner
Contributor III
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
标签 (1)
0 项奖励
回复
1 解答
808 次查看
w_wegner
Contributor III
Dear all,

the problem really was an incorrect memory setup. I had set BRD2RP and BWT2RWP by 1 too low. Now I have the following setup working for MCF54455 (125/250MHz) and 2 pcs. of MT47H32M16HR-3IT

; SDRAM init
; SDCS0:
mem write 0xFC0B8110 0x40000019
; SDCS1:
mem write 0xFC0B8114 0x44000019
; SDCFG1:
mem write 0xFC0B8008 0x66311720
; for 2GBit:
; write 0xFC0B8008 0x66311D20
; SDCFG2:
mem write 0xFC0B800C 0x6A670000
; SDCR (PALL):
mem write 0xFC0B8004 0xE9062002
; SDMR (EMode2):
mem write 0xFC0B8000 0x80010000
; SDMR (EMode3):
mem write 0xFC0B8000 0xC0010000
; SDMR (EMode)
mem write 0xFC0B8000 0x40010412
; SDMR (Mode)
mem write 0xFC0B8000 0x00010333
wait 10
; SDCR:
mem write 0xFC0B8004 0xE9062C02
mem write 0xFC0B8004 0xE9062C04
mem write 0xFC0B8004 0xE9062C04
; SDMR (MODE)
mem write 0xFC0B8000 0x00010233
; SDMR (EMODE, OCD default)
mem write 0xFC0B8000 0x40010792
; SDMR (EMODE, OCD exit)
mem write 0xFC0B8000 0x40010412
; SDCR:
mem write 0xFC0B8004 0x79062C00

Best regards,
Wolfgang

PS: Am I the only one who has problems using the graphical editor?

在原帖中查看解决方案

0 项奖励
回复
3 回复数
808 次查看
jkmahan
Contributor III
Have you tried downloading one of the recent Linux BSPs for the 5445x?  U-Boot is integrated into them and builds/works.
0 项奖励
回复
808 次查看
w_wegner
Contributor III
Thank you for the answer.
I did not yet try the U-Boot from the BSP, only the official git tree which incorporates support for M5445x EVBs.

However, I made another discovery: im some places - but then reproducably - values in registers show up with the lower 16 bit cleared, e.g. instead of 0x40044f7c I find 0x40040000. If this is interpreted as a variable address, of course I will get strange results.

Maybe I really have SDRAM access problems that only show up under special circumstances (and not when accessing memory via BDM or from single-stepping).

I will try to check the memory settings/access and if that fails try the freescale BSP.

Regards,
Wolfgang
0 项奖励
回复
809 次查看
w_wegner
Contributor III
Dear all,

the problem really was an incorrect memory setup. I had set BRD2RP and BWT2RWP by 1 too low. Now I have the following setup working for MCF54455 (125/250MHz) and 2 pcs. of MT47H32M16HR-3IT

; SDRAM init
; SDCS0:
mem write 0xFC0B8110 0x40000019
; SDCS1:
mem write 0xFC0B8114 0x44000019
; SDCFG1:
mem write 0xFC0B8008 0x66311720
; for 2GBit:
; write 0xFC0B8008 0x66311D20
; SDCFG2:
mem write 0xFC0B800C 0x6A670000
; SDCR (PALL):
mem write 0xFC0B8004 0xE9062002
; SDMR (EMode2):
mem write 0xFC0B8000 0x80010000
; SDMR (EMode3):
mem write 0xFC0B8000 0xC0010000
; SDMR (EMode)
mem write 0xFC0B8000 0x40010412
; SDMR (Mode)
mem write 0xFC0B8000 0x00010333
wait 10
; SDCR:
mem write 0xFC0B8004 0xE9062C02
mem write 0xFC0B8004 0xE9062C04
mem write 0xFC0B8004 0xE9062C04
; SDMR (MODE)
mem write 0xFC0B8000 0x00010233
; SDMR (EMODE, OCD default)
mem write 0xFC0B8000 0x40010792
; SDMR (EMODE, OCD exit)
mem write 0xFC0B8000 0x40010412
; SDCR:
mem write 0xFC0B8004 0x79062C00

Best regards,
Wolfgang

PS: Am I the only one who has problems using the graphical editor?
0 项奖励
回复