public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] u-boot on mcf5307
@ 2011-07-28 22:08 Angelo Dureghello
  2011-07-31 23:12 ` Angelo Dureghello
  0 siblings, 1 reply; 3+ messages in thread
From: Angelo Dureghello @ 2011-07-28 22:08 UTC (permalink / raw)
  To: u-boot

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@-
	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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] u-boot on mcf5307
  2011-07-28 22:08 [U-Boot] u-boot on mcf5307 Angelo Dureghello
@ 2011-07-31 23:12 ` Angelo Dureghello
  2011-08-01  5:40   ` Wolfgang Denk
  0 siblings, 1 reply; 3+ messages in thread
From: Angelo Dureghello @ 2011-07-31 23:12 UTC (permalink / raw)
  To: u-boot

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] u-boot on mcf5307
  2011-07-31 23:12 ` Angelo Dureghello
@ 2011-08-01  5:40   ` Wolfgang Denk
  0 siblings, 0 replies; 3+ messages in thread
From: Wolfgang Denk @ 2011-08-01  5:40 UTC (permalink / raw)
  To: u-boot

Dear Angelo Dureghello,

In message <4E35E147.6080602@gmail.com> you wrote:
>
> I would be happy to share the m530x /cpu files, but i don't know the
> exact procedure used here.

Your patches will be welcome.

> Let me know if and how i can contribute.

For details please see http://www.denx.de/wiki/U-Boot/Patches

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Q: Why do PCs have a reset button on the front?
A: Because they are expected to run Microsoft operating systems.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-08-01  5:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-28 22:08 [U-Boot] u-boot on mcf5307 Angelo Dureghello
2011-07-31 23:12 ` Angelo Dureghello
2011-08-01  5:40   ` Wolfgang Denk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox