Re: [U-Boot-Users] [PATCH] ColdFire: Added M5275EVB support.

To get this board working with the current git tree you'll need both patches plus the patch of include/asm-m68k/io.h by TsiChung Liew (see his patch "ColdFire: Fix CFI Flash low level Read/Write macro" on Jan 15 2008).
I'm having trouble applying the patch mentioned above (I've never used git to apply patches before). I cloned the repository, then used: git-apply --check patch1 to check my patch file. I get the following output:
error: patch failed: include/asm-m68k/io.h:28 error: include/asm-m68k/io.h: patch does not apply
My 'patch1' file is a plain text file containing all the stuff encapsulated by the --- at the top and bottom of the email message.
I also tried setting the head to v1.3.1 with: git checkout v1.3.1 and repeating the same process, but got same results. Am I supposed to be applying the patch to a different version? If so, what version and how should I do it?
I can try out the M5275EVB patch and give feedback when I get this worked out.
Thanks! - David

David,
Matthew's patch is based of commit f18889c2f1... Jan 17 09:35:26 2008 +0100 Merge branch 'master' of git+ssh://10.10.0.7/home/wd/git/u-boot/master. When you cloned the latest as today, there are dozen of patches since then, so the patches show errors when you applied.
First, you create a new branch based of master if you use the main stream branch. git-branch newbranch master. Change your branch to newbranch. git-checkout newbranch. Reset to the commit mentioned above. git-reset --hard f18889c2f1... Update the two patches from Matthew (Make sure no unwrap text and unix file format) git-apply --whitespace=strip patch. Use git-add to apply all the new files just added, then temporary create a commit git-commit (Otherwise, rebase won't work). To merge with updated u-boot. git-rebase master newbranch. There maybe other methods to apply the patch, but this is the method I used so far.
Hope this help.
Regards, TsiChung

Thanks for your responses, guys. I've tried both of your methods, and both give me similar errors. In the m5275evb patch, everything works except MAKEALL and Makefile. In the mcf5275 patch, there are a lot more errors.
I should note that I couldn't find the exact commit TsiChung mentions... the number you cite is missing a 6.... but I assume that was a type and we're talking about the same one: I found and am using:
f188896c2f1594fe749fdb99bbc8c54023cfab3a Wolfgang Denk [Thu, 17 Jan 2008 08:35:26 +0000] Merge branch 'master' of git+ssh://10.10.0.7/home/wd/git/u-boot/master
Here's what I'm doing:
david@chiron:~$ git clone git://www.denx.de/git/u-boot.git u-boot/ Initialized empty Git repository in /home/david/u-boot/.git/ remote: Generating pack... remote: Counting objects: 1299 remote: Done counting 51432 objects. remote: Deltifying 51432 objects... remote: 100% (51432/51432) done Indexing 51432 objects... remote: Total 51432 (delta 41342), reused 51070 (delta 41043) 100% (51432/51432) done Resolving 41342 deltas... 100% (41342/41342) done david@chiron:~$ cp mcf5275patch u-boot/ david@chiron:~$ cp m5275evbPatch u-boot/ david@chiron:~$ cd u-boot david@chiron:~/u-boot$ git-branch patched master david@chiron:~/u-boot$ git-branch * master patched david@chiron:~/u-boot$ git-checkout patched Switched to branch "patched" david@chiron:~/u-boot$ git-reset --hard f188896c2f1594fe749fdb99bbc8c54023cfab3a
HEAD is now at f188896... Merge branch 'master' of git+ssh://10.10.0.7/home/wd/git/u-boot/master david@chiron:~/u-boot$ git-apply --whitespace=strip mcf5275patch error: patch failed: cpu/mcf52x2/cpu.c:6 error: cpu/mcf52x2/cpu.c: patch does not apply error: patch failed: cpu/mcf52x2/cpu_init.c:10 error: cpu/mcf52x2/cpu_init.c: patch does not apply error: patch failed: cpu/mcf52x2/interrupts.c:59 error: cpu/mcf52x2/interrupts.c: patch does not apply error: patch failed: cpu/mcf52x2/speed.c:65 error: cpu/mcf52x2/speed.c: patch does not apply error: patch failed: cpu/mcf52x2/start.S:197 error: cpu/mcf52x2/start.S: patch does not apply error: patch failed: include/asm-m68k/immap.h:146 error: include/asm-m68k/immap.h: patch does not apply david@chiron:~/u-boot$ git-apply --whitespace=strip m5275evbPatch error: patch failed: MAKEALL:648 error: MAKEALL: patch does not apply error: patch failed: Makefile:1790 error: Makefile: patch does not apply
Trying to use the patch command, I get the following:
david@chiron:~/u-boot$ patch -p1 <m5275evbPatch patching file MAKEALL Hunk #1 FAILED at 648. 1 out of 1 hunk FAILED -- saving rejects to file MAKEALL.rej patching file Makefile Hunk #1 FAILED at 1790. 1 out of 1 hunk FAILED -- saving rejects to file Makefile.rej patching file board/freescale/m5275evb/Makefile patching file board/freescale/m5275evb/config.mk patching file board/freescale/m5275evb/m5275evb.c patching file board/freescale/m5275evb/mii.c patching file board/freescale/m5275evb/u-boot.lds patching file include/configs/M5275EVB.h
david@chiron:~/u-boot$ patch -p1 <mcf5275patch patching file CREDITS patching file cpu/mcf52x2/config.mk patching file cpu/mcf52x2/cpu.c Hunk #1 FAILED at 6. Hunk #2 FAILED at 183. 2 out of 2 hunks FAILED -- saving rejects to file cpu/mcf52x2/cpu.c.rej patching file cpu/mcf52x2/cpu_init.c Hunk #1 FAILED at 10. Hunk #2 succeeded at 248 with fuzz 2. 1 out of 2 hunks FAILED -- saving rejects to file cpu/mcf52x2/cpu_init.c.rej patching file cpu/mcf52x2/interrupts.c Hunk #1 succeeded at 59 with fuzz 2. Hunk #2 FAILED at 81. 1 out of 2 hunks FAILED -- saving rejects to file cpu/mcf52x2/interrupts.c.rej patching file cpu/mcf52x2/speed.c Hunk #1 FAILED at 65. 1 out of 1 hunk FAILED -- saving rejects to file cpu/mcf52x2/speed.c.rej patching file cpu/mcf52x2/start.S Hunk #1 succeeded at 197 with fuzz 2. Hunk #2 succeeded at 405 with fuzz 2. patching file include/asm-m68k/immap.h Hunk #1 succeeded at 146 with fuzz 2. patching file include/asm-m68k/immap_5275.h patching file include/asm-m68k/m5275.h
Any ideas? -David

David,
Make sure your patch is wrap text when you export or save as from email. Aso, make sure your patches do not contain (CR+LF) newlines.
unwrap text in your patch: ... 8 files changed, 849 insertions(+), 0 deletions(-) create mode 100644 board/freescale/m5275evb/Makefile create mode 100644 board/freescale/m5275evb/config.mk create mode 100644 board/freescale/m5275evb/m5275evb.c create mode 100644 board/freescale/m5275evb/mii.c create mode 100644 board/freescale/m5275evb/u-boot.lds create mode 100644 include/configs/M5275EVB.h ...
wrap text in your patch: ... 8 files changed, 849 insertions(+), 0 deletions(-) create mode 100644 board/freescale/m5275evb/Makefile create mode 100644 board/freescale/m5275evb/config.mk create mode 100644 board/freescale/m5275evb/m5275evb.c create mode 100644 board/freescale/m5275evb/mii.c create mode 100644 board/freescale/m5275evb/u-boot.lds create mode 100644 include/configs/M5275EVB.h ...
Regards, TsiChung

Thanks, TsiChung. With the patches you emailed me it worked fine. It must have been a problem with the way I was creating the patch files, although I still can't see a difference between my files and yours. What I was doing was copy-pasting from gmail to gedit, and I guess that is messing with newlines, because the wrap text seems to be fine. Anyway, I have u-boot compiled and will probably try it out on our board tomorrow.
Thanks very much for your help. -David

OK, I've tried out the patched version.... and I can't get it to boot. I've erased the flash with CF Flasher and reprogrammed, verified, etc. I've tried programming with both the srec and the bin, and both give the same results.
In the terminal I get the following:
U-Boot 1.3.1-gad73dc9b (Jan 24 2008 - 16:52:46)
CPU: Freescale Coldfire MCF5275 at 150 MHz Board: Freescale MCF5275 EVB I2C: ready DRAM: 16 MB FLASH:
*** Unexpected exception *** Vector Number: 2 Format: 04 Fault Status: 8
PC: 00fea364 SR: 00002708 SP: 00f8fe30 D0: 00000004 D1: 00000004 D2: ffe00154 D3: 00000055 D4: 00fea2ce D5: 00ff3106 D6: 00fea2ce D7: 00f9ff8a A0: 98989898 A1: 00fff422 A2: 00fff422 A3: 00fff422 A4: 00fea3ae A5: 00ff7500 A6: 00f8fe88
*** Please Reset Board! ***
This is exactly the same on every reset. I tried recompiling u-boot using both the main tree and the coldfire tree, both give the same results. Any ideas? Thanks, - David

David,
After you applied the 5275 patches, did you perform a git rebase? One ColdFire patch "Fix CFI Flash low level Read/Write macro" is required. The original macros have address and value swap, and it will cause exception whenever there is a CFI flash low level read/write performs.
Your current branch set to patched. Use "git-rebase master patched" to update the patches from master branch (after f188896c2f1594fe749fdb99bbc8c54023cfab3a) to patched branch.
Regards, TsiChung

*** Unexpected exception *** Vector Number: 2 Format: 04 Fault Status: 8
PC: 00fea364 SR: 00002708 SP: 00f8fe30 D0: 00000004 D1: 00000004 D2: ffe00154 D3: 00000055 D4: 00fea2ce D5: 00ff3106 D6: 00fea2ce D7: 00f9ff8a A0: 98989898 A1: 00fff422 A2: 00fff422 A3: 00fff422 A4: 00fea3ae A5: 00ff7500 A6: 00f8fe88
*** Please Reset Board! ***
I made a branch and followed the procedure you outlined a couple of posts ago, and I get the same error. However, once you pick up the CFI patch it works properly.
Can you please confirm that you've picked up the CFI patch? If so, can you let us know what hardware you're trying to run this on.
Matt

I know this is a rather long email, but I want to give all the details. Bear with me :-).
I was under the impression that the CFI patch was already included in the f188896c... commit and that I didn't need to apply it. I had tried the git-rebase, but it gave me errors and then wouldn't build. I assumed that the git-rebase step was only required for future patches, so figured I would sort it out later. I should have mentioned that in my last email, I apologize for the miscommunication.
Here's the git-rebase output:
david@chiron:~/u-boot-coldfire$ git-rebase master patched Already on branch "patched" First, rewinding head to replay your work on top of it...
HEAD is now at 33dac03... Coding Style Cleanup; update CHANGELOG
Applying ColdFire: Added MCF5275 cpu support.
Wrote tree ab2c1c1174d5a83b77fb13ef256dea1ad52bfc76 Committed: 70fb3f277a4032eb9d94e840247a9912de4678be
Applying ColdFire: Added M5275EVB support.
error: patch failed: MAKEALL:648 error: MAKEALL: patch does not apply Using index info to reconstruct a base tree... Falling back to patching base and 3-way merge... Auto-merged MAKEALL Auto-merged Makefile Wrote tree de37f7363a7d043338a21751cbedfbc1cff75ab8 Committed: dcba0b1aea040e60724b6fabd273f3ce42efa36f
Resulting in these build errors:
make[1]: Leaving directory `/home/david/u-boot/drivers/pcmcia' make -C drivers/spi/ make[1]: Entering directory `/home/david/u-boot/drivers/spi' mpc8xxx_spi.c:26:29: error: asm/mpc8xxx_spi.h: No such file or directory make[1]: *** No rule to make target `.depend', needed by `libspi.a'. Stop. make[1]: Leaving directory `/home/david/u-boot/drivers/spi' make: *** [drivers/spi/libspi.a] Error 2
I have applied the CFI patch from the original email using git-am, that seems to work fine. U-boot compiles successfully with these warnings:
david@chiron:~/u-boot$ ./MAKEALL M5275EVB Configuring for M5275EVB board... board.c: In function 'init_baudrate': board.c:179: warning: pointer targets in passing argument 2 of 'getenv_r' differ in signedness board.c:182: warning: pointer targets in passing argument 1 of 'simple_strtoul' differ in signedness m68k_linux.c: In function 'do_bootm_linux': m68k_linux.c:154: warning: implicit declaration of function 'do_reset' m68k-elf-ld: warning: library search path "/lib" is unsafe for cross-compilation m68k-elf-ld: warning: library search path "/usr/lib" is unsafe for cross-compilation m68k-elf-ld: warning: library search path "/usr/local/lib" is unsafe for cross-compilation ./MAKEALL: 265: ppc_8xx-size: not found
I programmed the board (an M5275EVB Rev. B) with the srec using CF Flasher, and U-Boot boots to the prompt.
However, I've run into these problems, and I'm wondering if guys have as well, or if I'm doing something wrong.
1) I can't save environment variables using saveenv. I can change them just fine, and saveenv runs as usual, but on reset, I get a "*** Warning - bad CRC, using default environment "
example:
-> printenv
bootcmd=bootm ffe40000 bootdelay=5
baudrate=19200
ethaddr=00:06:3b:01:41:55
eth1addr=00:0e:0c:bc:e5:60
stdin=serial
stdout=serial
stderr=serial
ethact=FEC0
Environment size: 156/8188 bytes -> setenv ipaddr 192.168.1.101
-> printenv
bootcmd=bootm ffe40000 bootdelay=5
baudrate=19200
ethaddr=00:06:3b:01:41:55
eth1addr=00:0e:0c:bc:e5:60
stdin=serial
stdout=serial
stderr=serial
ethact=FEC0
ipaddr=192.168.1.101
Environment size: 177/8188 bytes -> saveenv
Saving Environment to Flash... Un-Protected 1 sectors Erasing Flash... . done
Erased 1 sectors Writing to Flash... done Protected 1 sectors ->
U-Boot 1.3.1-ge4d87286 (Jan 26 2008 - 13:23:51)
CPU: Freescale Coldfire MCF5275 at 150 MHz Board: Freescale MCF5275 EVB I2C: ready DRAM: 16 MB FLASH: 2 MB *** Warning - bad CRC, using default environment
etc.
2) Ethernet does not seem to work. After setting the ipaddr, serverip, and netmask variables, I run tftpboot and don't get anything but checksum errors. The TFTP transfer works fine with the exact same setup (router, ip addresses, etc.) when I use dBug. I've run Wireshark on the ethernet interface and haven't seen a single packet from the board while running the tftpboot command. I've tried pinging the board, seen the packets sent on Wireshark, and got no response.
-> printenv
bootcmd=bootm ffe40000 bootdelay=5
baudrate=19200
ethaddr=00:06:3b:01:41:55
eth1addr=00:0e:0c:bc:e5:60
stdin=serial
stdout=serial
stderr=serial
ethact=FEC0
ipaddr=192.168.1.101
serverip=192.168.1.100
netmask=255.255.255.0
Environment size: 222/8188 bytes -> tftpboot 0x50000 image.bin
Using FEC0 device TFTP from server 192.168.1.100; our IP address is 192.168.1.101
Filename 'image.bin'.
Load address: 0x50000 Loading: checksum bad checksum bad checksum bad
Abort
->
Anything to clear this up would help. Do either of you have ethernet and saveenv working? Thanks for your help and your patience.
-David

- I can't save environment variables using saveenv. I can change them just fine, and saveenv runs as usual, but on reset, I get a "*** Warning - bad CRC, using default environment "
I have the same problem. I haven't done any testing with the saveenv so it more than likely needs some tweaking. The README mentions it quite a bit so you may want to start there.
- Ethernet does not seem to work. After setting the ipaddr, serverip, and netmask variables, I run tftpboot and don't get anything but checksum errors
...
I've tried pinging the board, seen the packets sent on Wireshark, and got no response.
I use DHCP to get my IP address: -> setenv autoload no -> dhcp BOOTP broadcast 1 DHCP client bound to address XXX.XXX.XXX.152 -> ping XXX.XXX.XXX.189 Using FEC0 device host XXX.XXX.XXX.189 is alive
However, if I try to ping the board I get a "Destination Host Unreachable" error - apparently this is normal U-Boot behaviour.
I can also successfully use TFTP. -> set serverip XXX.XXX.XXX.55 -> tftpboot 20000 image.bin Using FEC0 device TFTP from server XXX.XXX.XXX.55; our IP address is XXX.XXX.XXX.152 Filename 'image.bin'. Load address: 0x20000 Loading: ################################################################# done Bytes transferred = 1279856 (138770 hex)
I'm no real expert on this board/CPU so, other than sharing the commands I've used, I'm afraid I can't provide too much advice. I'm going to start looking into the saveenv problem now.
Matt

Matthew,
I spotted a few issues:
1. in cpu/mcf52x2/interrupt.c should be imlr0 &= 0xFFFFFFFE;
2. in include/asm-m68k/immap.h CFG_TMRINTR_PRI should set to 0x1E for timer interrupt to work probably. #define CFG_TMRINTR_PRI (0x1E)
3. in board/freescale/m5275evb/u-boot.lds, this will take care the environment problem. When the . = DEFINED(env_offset) ? env_offset : .; is commented, u-boot does not know where to retrieve the env data from flash; therefore, it always shows bad CRC when booting.
cpu/mcf52x2/start.o (.text) common/dlmalloc.o (.text) lib_generic/string.o (.text) ilb_generic/zlib.o (.text)
. = DEFINED(env_offset) ? env_offset : .; common/environment.o (.text)
Regards, TsiChung

1. in cpu/mcf52x2/interrupt.c should be imlr0 &= 0xFFFFFFFE;
Could you please specify whether you're referring to the line in the interrupt_init() function or dtimer_intr_setup() function (or both)?
2. in include/asm-m68k/immap.h CFG_TMRINTR_PRI should set to
0x1E for timer interrupt to work probably. #define CFG_TMRINTR_PRI (0x1E)
OK, I've changed that.
3. in board/freescale/m5275evb/u-boot.lds, this will take care
the environment problem. When the . = DEFINED(env_offset) ? env_offset : .; is commented, u-boot does not know where to retrieve the env data from flash; therefore, it always shows bad CRC when booting.
I've changed this too, and I can confirm it works.
If you can clear up the first point I'll send out a new patch asap.
Matt

I use DHCP to get my IP address: -> setenv autoload no -> dhcp BOOTP broadcast 1 DHCP client bound to address XXX.XXX.XXX.152 -> ping XXX.XXX.XXX.189 Using FEC0 device host XXX.XXX.XXX.189 is alive
I've tried DHCP as well, and I get the following: -> dhcp BOOTP broadcast 1 checksum bad checksum bad
Abort
Have tried pinging the devel computer as well: -> ping 192.168.1.100 Using FEC0 device checksum bad checksum bad
Abort ping failed; host 192.168.1.100 is not alive
DHCP on the router is working fine; other computers on the LAN get IP addresses without any trouble. I have also tried using DHCP with the board plugged into my college's network which uses DHCP, still didn't work. Have also tried using static IPs with a crossover cable straight from the board to the computer, and that didn't work either. I'm using FEC0 and have tested the cable. TsiChung, have you had any Ethernet problems? Is it possible that I need some other patch that was recently applied?
I modified u-boot.lds to fix the saveenv, and it worked fine for me.
Thanks, -David
participants (3)
-
David van Geest
-
Liew Tsi Chung
-
Matthew Fettke