
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

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

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
participants (2)
-
Angelo Dureghello
-
Wolfgang Denk