public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Friedrich Lobenstock <f.lobenstock@scottygroup.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] mcf5272 hanging while relocating
Date: Tue, 31 May 2005 01:10:10 +0200	[thread overview]
Message-ID: <429B9D52.3060102@scottygroup.com> (raw)
In-Reply-To: <429B9956.90804@scottygroup.com>

Friedrich Lobenstock wrote on 31.05.2005 00:53 MET:
> Friedrich Lobenstock wrote on 31.05.2005 00:10 MET:
> 
>> Zachary Landau wrote on 17.05.2005 15:31 MET:
>>
>>>> I've got a little problem porting U-Boot to a Coldfire MCF5272 based 
>>>> platform.
>>>> Everything's fine (now) up to the point where it relocates itself to 
>>>> RAM. See
>>>> the boot message:
>>>
>>>
>>>
>>>
>>> If you haven't already, you should search the mailing list archives
>>> for information about the 5282 patches floating around.  Your best bet
>>> is probably to modify those for the 5272.
>>>
>>
>> [...]
>> Using gdb with the BDM interface I find that the actual copying of the 
>> code to RAM succeeds but while clearing the BSS an exception happens 
>> as the system goes into the _fault endless loop.
> 
> 
> Tracking it further down (with caches disabled) it actually clears the 
> BSS but in the following section titled "fix got table in RAM" it 
> creates the exception.
> 
>  From cpu/mcf52xx/start.S(my local copy from cpu/mcf52x2/start.S):
> [...]
>         move.l 16(%a6), %a0             /* Save copy of Destination 
> Address */
> [...]
>         /*
>          * fix got table in RAM
>          */
>         move.l  %a0, %a1
>         add.l   #(__got_start - CFG_MONITOR_BASE),%a1
>         move.l  %a1,%a5         /* * fix got pointer register a5 */
> 
>         move.l  %a0, %a2
>         add.l   #(__got_end - CFG_MONITOR_BASE),%a2
> 
> 7:
>         move.l  (%a1),%d1
>         sub.l   #_start,%d1
>         add.l   %a0,%d1
>         move.l  %d1,(%a1)+
>         cmp.l   %a2, %a1
>         bne     7b
> 
> which result in the following code (already running from ram here):
> 0x7e70dc <in_ram+22>:   moveal %a0,%a1
> 0x7e70de <in_ram+24>:   addal #78848,%a1
> 0x7e70e4 <in_ram+30>:   moveal %a1,%a5
> 0x7e70e6 <in_ram+32>:   moveal %a0,%a2
> 0x7e70e8 <in_ram+34>:   addal #78848,%a2
> 0x7e70ee <in_ram+40>:   movel %a1@,%d1
> 0x7e70f0 <in_ram+42>:   subil #-2096128,%d1
> 0x7e70f6 <in_ram+48>:   addl %a0,%d1
> 0x7e70f8 <in_ram+50>:   movel %d1,%a1 at +
> 0x7e70fa <in_ram+52>:   cmpal %a2,%a1
> 0x7e70fc <in_ram+54>:   bnew 0x7e70ee <in_ram+40>
> 
> now setting a (hardware-)breakpoint at address 0x7e70ee and printing the 
> values of the startvalue (register a1) and the end value (register a2):
> 
> Program received signal SIGTRAP, Trace/breakpoint trap.
> 0x007e70f0 in in_ram () at 
> /home/fl/work/coldfire/uboot/u-boot-1.1.2/cpu/mcf52xx/start.S:100
> 100     _start:
> (gdb) p /x $a1
> $1 = 0x7fa400
> (gdb) p /x $a2
> $2 = 0x7fa400
> (gdb) p /x $a0
> $3 = 0x7e7000
> 
> Hmmmm....I would expect a2 to result in something higher than a1. Is 
> this some sort of compiler bug?

I might want to add that I just copied the board definition m5272c3 but did not 
change something in regards to the __got_xxx addresses. I just copied the dir 
cpu/mcf52x2 to cpu/mcf52xx to apply local initialization changes.

# diff -u board/m5272c3/u-boot.lds board/uncle_rev_4/u-boot.lds
--- board/m5272c3/u-boot.lds    2004-02-12 01:47:11.000000000 +0100
+++ board/uncle_rev_4/u-boot.lds        2005-05-16 05:37:18.000000000 +0200
@@ -56,9 +56,9 @@
      /* WARNING - the following is hand-optimized to fit within */
      /* the sector layout of our flash chips!   XXX FIXME XXX   */

-    cpu/mcf52x2/start.o                (.text)
+    cpu/mcf52xx/start.o                (.text)
      lib_m68k/traps.o           (.text)
-    cpu/mcf52x2/interrupts.o   (.text)
+    cpu/mcf52xx/interrupts.o   (.text)
      common/dlmalloc.o          (.text)
      lib_generic/zlib.o         (.text)

Running "diff -u board/m5272c3/u-boot.lds board/m5282evb/u-boot.lds" also 
reveals that there are some different modules located at different locations. 
Could that be the influence that the compiler computes __got_end the wrong way?


> 
>>
>> Someone with a Motorola Coldfire 5272 cpu experienced the same and 
>> could give me a hint.
>>
> 
> 


-- 
MfG / Regards
Friedrich Lobenstock

  reply	other threads:[~2005-05-30 23:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-17 12:46 [U-Boot-Users] mcf5272 hanging while relocating Friedrich Lobenstock
2005-05-17 12:53 ` Wolfgang Denk
2005-05-17 13:31 ` Zachary Landau
2005-05-30 22:10   ` Friedrich Lobenstock
2005-05-30 22:53     ` Friedrich Lobenstock
2005-05-30 23:10       ` Friedrich Lobenstock [this message]
2005-05-31 15:23         ` NZG
2005-05-31 20:17           ` Friedrich Lobenstock
2005-05-31 21:18             ` NZG
2005-05-31 23:30               ` Friedrich Lobenstock
2005-06-01 14:43                 ` NZG
2005-06-01 23:06                   ` Friedrich Lobenstock

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=429B9D52.3060102@scottygroup.com \
    --to=f.lobenstock@scottygroup.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox