Re: u-boot & uImage on M5282LITE
Allon Stern <[email protected]>
| Newsgroups | gmane.comp.hardware.motorola.microcontrollers.coldfire |
|---|---|
| Message-ID | <[email protected]> |
On Feb 20, 2008, at 8:06 AM, alex wrote (offlist):
> I am also starting a project on this board and would love if you
> gave a clear instruction list of how you built u-boot and put it
> on the internal flash. I would like the board to boot automatically
> to uclinux if i have the EXT_BOOT jumper open. Thanks for any
> help you can provide.
Why certainly! I'm sending this to the list to document for others
who may also be interested.
Limitation: I haven't worked out writeable access to internal flash;
if you want to change the environment, you have to compile in the
changes. I've been very careful not to write to the external flash,
since I don't have any BDM tools running yet, and I don't want to
destroy the load of dBUG that resides there. I've considered putting
the environment in external flash, but haven't done so yet. Anyway,
this is just a development board - when my real hardware shows up,
I'll be putting more effort into it :)
Firstly, I started with u-boot 1.3.1
I don't know if the change to m68k_config.mk is strictly necessary,
but I made it anyway, and it got caught up in the patch.
I made some changes to the include/configs/M5282EVB.h file, partly to
change the environment, partly to change the flash configuration as a
safety, and partly to change the load address.
The default load address is 0x10000. This is fine if you load a
binary there and give uboot the command to "go" at that address.
I wanted to pass boot arguments to a linux kernel, however; A u-boot
header is at the beginning of a uImage file; to make it so the kernel
still loaded at 0x10000, I changed the load address to 0xFFC0. Then I
could "bootp" to load an image, and "bootm" to boot it.
The kernel changes to read the boot arguments is another topic for
another day :)
I had it working in 2.6.19; I've moved to 2.6.24-uc0, and have yet to
apply the changes there.
Anyway.....
Apply the patches below to a stock u-boot 1.3.1.
Then, in the top level u-boot directory:
$ make M5282EVB_config
$ make
This will make the u-boot binary.
I could never get dBUG on the M5282LITE board to download over the
network, so I use a serial transfer.
The s-record file for u-boot is based at the load address -
0xF0000000. You can't download it directly to flash, however. First
you have to download to ram, then copy it to flash. You can specify a
negative offset to the dl command in dBUG:
dBUG> dl -efff0000
The offset of -0xEFFF0000 will load u-boot at 0x10000. Note that dBUG
erroneously reports the offset as 0x10010000 when if finishes loading..
It will prompt you to start the download.
I use minicom; in minicom, ^A-S will prompt you for an upload. Select
"ascii", then select the u-boot.srec file that you built in the u-
boot directory.
After it transfers, minicom prompts you to hit a key to continue.
dBUG will tell you if it was successful.
Assuming it was, copy the image to flash.
dBUG> fl write F0000000 10000 20000
This copies 20000 bytes which is more than u-boot takes up, but it's
a whole flash block; this way you don't have to be concerned with how
much space u-boot actually occupies. The "fl write" command
automatically erases the flash block first.
Then remove the EXT_BOOT jumper, reset the board, and it should come
up in u-boot.
If you want to return to dBUG, just reinstall the jumper and reset
the board.
Enjoy!
Here are my changes to u-boot. Note that you may want to edit the
default environment in the M5282EVB.h file. I use dhcp, bootp, and an
NFS root filesystem here. This is just what I did, YMMV. Not intended
to be a distributed patch or anything.
--- u-boot-1.3.1/m68k_config.mk 2007-12-06 04:21:19.000000000 -0500
+++ u-boot/m68k_config.mk 2008-02-18 19:14:43.000000000 -0500
@@ -21,5 +21,5 @@
# MA 02111-1307 USA
#
-PLATFORM_CPPFLAGS += -DCONFIG_M68K -D__M68K__
+PLATFORM_CPPFLAGS += -DCONFIG_M68K -D__M68K__ -m528x
PLATFORM_LDFLAGS += -n
--- u-boot-1.3.1/include/configs/M5282EVB.h 2007-12-06
04:21:19.000000000 -0500
+++ u-boot/include/configs/M5282EVB.h 2008-02-18 16:44:01.000000000
-0500
@@ -48,8 +48,9 @@
/* Configuration for environment
* Environment is embedded in u-boot in the second sector of the flash
*/
-#define CFG_ENV_ADDR 0xffe04000
-#define CFG_ENV_SIZE 0x2000
+/*#define CFG_ENV_ADDR 0xffe04000*/
+#define CFG_ENV_ADDR 0xf0040000
+#define CFG_ENV_SIZE 0x4000
#define CFG_ENV_IS_IN_FLASH 1
/*
@@ -96,24 +97,19 @@
#define CONFIG_BOOTDELAY 5
#ifdef CONFIG_MCFFEC
# define CONFIG_ETHADDR 00:e0:0c:bc:e5:60
+#if 0
# define CONFIG_IPADDR 192.162.1.2
# define CONFIG_NETMASK 255.255.255.0
# define CONFIG_SERVERIP 192.162.1.1
# define CONFIG_GATEWAYIP 192.162.1.1
+#endif
# define CONFIG_OVERWRITE_ETHADDR_ONCE
#endif /* CONFIG_MCFFEC */
#define CONFIG_HOSTNAME M5272C3
#define CONFIG_EXTRA_ENV_SETTINGS \
"netdev=eth0\0" \
- "loadaddr=10000\0" \
- "u-boot=u-boot.bin\0" \
- "load=tftp ${loadaddr) ${u-boot}\0" \
- "upd=run load; run prog\0" \
- "prog=prot off ffe00000 ffe3ffff;" \
- "era ffe00000 ffe3ffff;" \
- "cp.b ${loadaddr} ffe00000 ${filesize};"\
- "save\0" \
+ "loadaddr=FFC0\0" \
""
#define CFG_PROMPT "-> "
@@ -193,6 +189,8 @@
#define CFG_FLASH_CFI
#ifdef CFG_FLASH_CFI
+#define USE_EXTERNAL_FLASH
+#ifdef USE_EXTERNAL_FLASH
# define CFG_FLASH_CFI_DRIVER 1
# define CFG_FLASH_SIZE 0x1000000 /* Max size that the board might
have */
# define CFG_FLASH_CFI_WIDTH FLASH_CFI_16BIT
@@ -201,8 +199,19 @@
# define CFG_FLASH_PROTECTION /* "Real" (hardware) sectors
protection */
# define CFG_FLASH_CHECKSUM
# define CFG_FLASH_BANKS_LIST { CFG_FLASH_BASE }
+#else
+# define CFG_FLASH_CFI_DRIVER 1
+# define CFG_FLASH_SIZE 0x80000 /* Max size that the board might
have */
+# define CFG_FLASH_CFI_WIDTH FLASH_CFI_32BIT
+# define CFG_MAX_FLASH_BANKS 8 /* max number of memory banks */
+# define CFG_MAX_FLASH_SECT 32 /* max number of sectors on one chip */
+# define CFG_FLASH_PROTECTION /* "Real" (hardware) sectors
protection */
+# define CFG_FLASH_CHECKSUM
+# define CFG_FLASH_BANKS_LIST { CFG_INT_FLASH_BASE }
+#endif
#endif
+
/
*-----------------------------------------------------------------------
* Cache Configuration
*/
-
allon