public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Angelo Dureghello <angelo70@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] u-boot on mcf5307
Date: Mon, 01 Aug 2011 01:12:07 +0200	[thread overview]
Message-ID: <4E35E147.6080602@gmail.com> (raw)
In-Reply-To: <4E31DDC9.2060801@gmail.com>

On 29/07/2011 00:08, Angelo Dureghello wrote:
> Dear all,
> 
> i succesfully added support for mcf5307, was quite easy, as you suggested i started from a m68k/cpu model with a very similar memory map.
> 
> I am trying now to have the bootloader running in a custom board i developed:
> MCF5307
> SDRAM 16M, mapped at 0x00000000
> FLASH  4M, mapped at 0xffc00000
> 
> The bootloader works great only if i don't enable timer2 for the clock/timestamp.
> If timer2 is enabled i get the following error:
> 
> 
> U-Boot 2011.06-rc2-dirty (Jul 28 2011 - 23:55:16)
> 
> CPU:   Freescale Coldfire MCF5307 at 90 MHz
> Board: AMCORE v.001(alpha)
> DRAM:  16 MiB
> SDRAM test:
> testing MB 01 ...
> testing MB 02 ...
> testing MB 03 ...
> testing MB 04 ...
> testing MB 05 ...
> testing MB 06 ...
> testing MB 07 ...
> testing MB 08 ...
> testing MB 09 ...
> testing MB 10 ...
> testing MB 11 ...
> testing MB 12 ...
> testing MB 13 ...
> testing MB 14 ...
> testing MB 15 ...
> testing MB 16 ...
> test passed !
> Flash: 4 MiB
> 
> amcore$
> 
> *** Unexpected exception ***
> Vector Number: 3  Format: 04  Fault Status: 4
> 
> PC: 00fe910a    SR: 00002000    SP: 00ed8af0
> D0: 00002c1b    D1: 0000001b    D2: 00400000    D3: 00ee8b76
> D4: ffc12d08    D5: ffffffff    D6: 00ffad57    D7: 00ee8b76
> A0: 00ee8b76    A1: 00fe9604    A2: 00ee8bc6    A3: 00ffd400
> A4: 00ff8167    A5: 00ffbb00    A6: 00ed8b48
> 
> *** Please Reset Board! ***
> 
> 
> Debugging seems that the issue is returning from the timer interrupt handler, exactly here:
> 
> 
> #define RESTORE_ALL						\
> 	moveml	%sp@,%d0-%d7/%a0-%a6;				\
> 	addl	#60,%sp;		/* space for 15 regs */ \
> 	rte  <<< ---- HERE , returning
> 
> _int_handler:
> 	SAVE_ALL
> 	movel	%sp,%sp at -
> 	bsr int_handler
> 	addql	#4,%sp
> 	RESTORE_ALL
> 
> 
> The issue is very strange, everything works well, relocation to ram included, i test the SDRAM with cache disabled (then re-enabled), so there must be no issues on the memory. Calls and returning from C functions called in board_init_r also works fine, exception happen only returning from the interrupt.
> 
> I am working on the issue, but every help is really appreciated.
> 
> Regards,
> angelo dureghello
> 
> 

Hello,

finally, i solved it.

When a cpu behavior is strangely different from what the datasheet says (after reading it carefully many time), it worth a try to see the chip ERRATA:

MCF5307ER.pdf says:

35 : Corrupted Return PC in Exception Stack Frame

Using the workaround suggested (setting C/I bit of CS MASK register) solve the issue.

This explain why all other coldfire models works with the same u-boot code without issues.
Really hope this can help for who will have the same issue.

I would be happy to share the m530x /cpu files, but i don't know the exact procedure used here.
Let me know if and how i can contribute.

regards

 
Angelo D.

  reply	other threads:[~2011-07-31 23:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-28 22:08 [U-Boot] u-boot on mcf5307 Angelo Dureghello
2011-07-31 23:12 ` Angelo Dureghello [this message]
2011-08-01  5:40   ` Wolfgang Denk

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=4E35E147.6080602@gmail.com \
    --to=angelo70@gmail.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