Added primary and secondary bootloaders

SVN-Revision: 6626
This commit is contained in:
Hamish Guthrie 2007-03-20 09:59:17 +00:00
parent ccb99d82df
commit 285c45e7fd
11 changed files with 6399 additions and 10 deletions

View file

@ -0,0 +1,18 @@
config AT91_ROMBOOT
bool "Build romboot loader"
depends LINUX_2_6_AT91
default y
config AT91_UBOOT
bool "Build u-boot loader"
depends LINUX_2_6_AT91
default y
config UBOOT_TARGET
string "U-Boot Board Configuration"
default "vlink"
help
For all supported boards there are reqdy-to-use default
configurations available; just type "<board_name>".

View file

@ -5,16 +5,25 @@
# See /LICENSE for more information.
#
TARGET_DEVICE_TABLE:=$(TOPDIR)/target/linux/vlink-2.6/image/device_table.txt
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/image.mk
define Build/Clean
$(MAKE) -C romboot clean
$(MAKE) -C u-boot clean
endef
define Build/Compile
$(MAKE) -C romboot compile
# $(MAKE) -C u-boot configure
$(MAKE) -C u-boot compile
endef
define Image/Prepare
cp $(LINUX_DIR)/arch/arm/boot/uImage $(KDIR)/uImage
cp $(KDIR)/romboot/romboot.bin $(KDIR)/romboot.bin
cp $(KDIR)/u-boot-1.1.4/u-boot.bin $(KDIR)/u-boot.bin
cat $(KDIR)/romboot/romboot.block $(KDIR)/u-boot-1.1.4/u-boot.block > $(KDIR)/loaders.block
endef
define Image/BuildKernel
@ -25,12 +34,4 @@ define Image/Build
$(call Image/Build/$(1),$(1))
endef
define Image/Build/jffs2-64k
dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).img bs=65536 conv=sync
endef
define Image/Build/jffs2-128k
dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).img bs=131072 conv=sync
endef
$(eval $(call BuildImage))

View file

@ -0,0 +1,28 @@
#
# Copyright (C) 2006 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
# $Id$
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=romboot
PKG_VERSION:=0.1
PKG_RELEASE:=1
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)
PKG_SOURCE:=$(PKG_NAME).tar.gz
PKG_SOURCE_URL:=http://www.teest.com/at91
PKG_MD5SUM:=
PKG_CAT:=zcat
include $(INCLUDE_DIR)/package.mk
define Build/InstallDev
dd if=$(PKG_BUILD_DIR)/romboot.bin of=$(PKG_BUILD_DIR)/romboot.block bs=32k count=1 conv=sync
endef
$(eval $(call Build/DefaultTargets))

View file

@ -0,0 +1,57 @@
diff -uNr romboot/main.cpp romboot.new/main.cpp
--- romboot/main.cpp 2004-07-16 17:10:04.000000000 +0200
+++ romboot.new/main.cpp 2006-03-03 02:27:37.000000000 +0100
@@ -23,12 +23,12 @@
#define AT91C_UBOOT_DATAFLASH_ADDR 0xC0008000
// crystal= 18.432MHz
-//#define AT91C_PLLA_VALUE 0x2026BE04 // -> 179.712MHz
-//#define AT91C_PLLA_MCK 0x0000202
+#define AT91C_PLLA_VALUE 0x2026BE04 // -> 179.712MHz
+#define AT91C_PLLA_MCK 0x0000202
// crystal= 20.000MHz
-#define AT91C_PLLA_VALUE 0x2023BE04 // -> 180MHz
-#define AT91C_PLLA_MCK 0x0000202
+//#define AT91C_PLLA_VALUE 0x2023BE04 // -> 180MHz
+//#define AT91C_PLLA_MCK 0x0000202
#define DELAY_MAIN_FREQ 1000
#define DISP_LINE_LEN 16
@@ -151,7 +151,7 @@
//*-----------------------------------------------------------------------------
void AT91F_DisplayMenu(void)
{
- printf("\n\rATMEL LOADER %s %s %s\n\r", AT91C_VERSION, __DATE__, __TIME__);
+ printf("\n\rFDL LOADER %s %s %s\n\r", AT91C_VERSION, __DATE__, __TIME__);
printf(menu_separ);
AT91F_DataflashPrintInfo();
printf(menu_separ);
@@ -306,6 +306,19 @@
AT91F_SetPLL();
}
+void LedCode(void)
+{
+ int *pRegister;
+ pRegister = (int *)0xFFFFF800; // Enable port C peripheral reg
+ *pRegister = 0x3c00;
+ pRegister = (int *)0xFFFFF810; // Output Enable reg
+ *pRegister = 0x3c00;
+ pRegister = (int *)0xFFFFF830; // Set data
+ *pRegister = 0x1400;
+ pRegister = (int *)0xFFFFF834; // Clear bits
+ *pRegister = 0x2800;
+}
+
void AT91F_StartUboot(unsigned int dummy, void *pvoid)
{
printf("Load U-BOOT from dataflash[%x] to SDRAM[%x]\n\r", AT91C_UBOOT_DATAFLASH_ADDR, AT91C_UBOOT_ADDR);
@@ -313,6 +326,7 @@
printf("Set PLLA to 180Mhz and Master clock to 60Mhz and start U-BOOT\n\r");
//* Reset registers
AT91F_ResetRegisters();
+ LedCode();
Jump(AT91C_UBOOT_ADDR);
while(1);
}

View file

@ -0,0 +1,50 @@
--- romboot/Makefile.old 2007-03-18 09:29:20.000000000 +0100
+++ romboot/Makefile 2007-03-18 09:29:13.000000000 +0100
@@ -0,0 +1,47 @@
+LINKFLAGS= -T elf32-littlearm.lds -Ttext 0
+COMPILEFLAGS= -Os
+TARGET=romboot
+OBJFILES=cstartup_ram.o asm_isr.o jump.o at45.o com.o dataflash.o \
+ init.o main.o stdio.o _udivsi3.o _umodsi3.o div0.o
+LIBRARIES=
+INCLUDES= -Iinclude
+
+all:$(TARGET)
+
+$(TARGET): $(OBJFILES)
+ $(LD) $(OBJFILES) -o $(TARGET).out $(LINKFLAGS) -n
+ $(OBJCOPY) $(TARGET).out -O binary $(TARGET).bin
+
+asm_isr.o: asm_isr.S
+ $(CC) -c -Iinclude -o $@ $<
+
+cstartup_ram.o: cstartup_ram.S
+ $(CC) -c -Iinclude -o $@ $<
+
+jump.o: jump.S
+ $(CC) -c -Iinclude -o $@ $<
+
+_udivsi3.o: _udivsi3.S
+ $(CC) -c $<
+
+_umodsi3.o: _umodsi3.S
+ $(CC) -c $<
+
+#%.o: %.S
+# $(CC) -c $(INCLUDES) -o $@ $<
+
+%.o: %.cpp
+ $(CC) -c $(COMPILEFLAGS) $(INCLUDES) -o $@ $<
+
+div0.o: div0.c
+ $(CC) -c $(COMPILEFLAGS) $<
+
+clean:
+ rm $(OBJFILES) -f
+ rm *~ -f
+ rm $(TARGET) -f
+
+
+#LD="$CROSS"ld
+
+

View file

@ -0,0 +1,37 @@
#
# Copyright (C) 2006 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
# $Id$
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=u-boot
PKG_VERSION:=1.1.4
PKG_RELEASE:=1
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=ftp://ftp.denx.de/pub/u-boot
PKG_MD5SUM:=
PKG_CAT:=bzcat
include $(INCLUDE_DIR)/package.mk
UBOOT_CONFIG=$(strip $(subst ",, $(CONFIG_UBOOT_TARGET)))
define Build/Compile
$(MAKE) -C $(PKG_BUILD_DIR) $(UBOOT_CONFIG)_config
export CROSS_COMPILE=$(TARGET_CROSS); \
$(MAKE) -C $(PKG_BUILD_DIR)
endef
define Build/InstallDev
dd if=$(PKG_BUILD_DIR)/u-boot.bin of=$(PKG_BUILD_DIR)/u-boot.block bs=232k count=1 conv=sync
# mv $(PKG_BUILD_DIR) $(KERNEL_BUILD_DIR)/$(PKG_NAME)
endef
$(eval $(call Build/DefaultTargets))

View file

@ -0,0 +1,91 @@
--- u-boot-1.1.4/cpu/arm920t/config.mk 2005-12-16 17:39:27.000000000 +0100
+++ u-boot-1.1.4.klaus/cpu/arm920t/config.mk 2006-02-27 19:07:41.000000000 +0100
@@ -30,5 +30,5 @@
# Supply options according to compiler version
#
# =========================================================================
-PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)
+PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32)
PLATFORM_RELFLAGS +=$(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,))
--- u-boot-1.1.4/cpu/arm920t/start.S 2005-12-16 17:39:27.000000000 +0100
+++ u-boot-1.1.4.klaus/cpu/arm920t/start.S 2006-02-22 16:45:24.000000000 +0100
@@ -237,6 +237,7 @@
*/
+#ifndef CONFIG_SKIP_LOWLEVEL_INIT
cpu_init_crit:
/*
* flush v4 I/D caches
@@ -265,6 +266,7 @@
mov lr, ip
mov pc, lr
+#endif
/*
*************************************************************************
--- u-boot-1.1.4/examples/Makefile 2005-12-16 17:39:27.000000000 +0100
+++ u-boot-1.1.4.klaus/examples/Makefile 2006-03-02 02:37:14.000000000 +0100
@@ -30,7 +30,7 @@
endif
ifeq ($(ARCH),arm)
-LOAD_ADDR = 0xc100000
+LOAD_ADDR = 0x21000000
endif
ifeq ($(ARCH),mips)
--- u-boot-1.1.4/include/config.h 1970-01-01 01:00:00.000000000 +0100
+++ u-boot-1.1.4.klaus/include/config.h 2006-02-27 19:04:46.000000000 +0100
@@ -0,0 +1,2 @@
+/* Automatically generated - do not edit */
+#include <configs/at91rm9200dk.h>
--- u-boot-1.1.4/include/config.mk 1970-01-01 01:00:00.000000000 +0100
+++ u-boot-1.1.4.klaus/include/config.mk 2006-02-27 19:04:46.000000000 +0100
@@ -0,0 +1,4 @@
+ARCH = arm
+CPU = arm920t
+BOARD = at91rm9200dk
+SOC = at91rm9200
--- u-boot-1.1.4/include/configs/at91rm9200dk.h 2005-12-16 17:39:27.000000000 +0100
+++ u-boot-1.1.4.klaus/include/configs/at91rm9200dk.h 2006-02-26 22:44:17.000000000 +0100
@@ -25,6 +25,11 @@
#ifndef __CONFIG_H
#define __CONFIG_H
+// Added 2 defines to skip re-init lowlevel and relocate HCG HLH
+//
+#define CONFIG_SKIP_LOWLEVEL_INIT
+#define CONFIG_SKIP_RELOCATE_UBOOT
+
/* ARM asynchronous clock */
#define AT91C_MAIN_CLOCK 179712000 /* from 18.432 MHz crystal (18432000 / 4 * 39) */
#define AT91C_MASTER_CLOCK 59904000 /* peripheral clock (AT91C_MASTER_CLOCK / 3) */
@@ -165,12 +170,12 @@
#define CFG_FLASH_ERASE_TOUT (2*CFG_HZ) /* Timeout for Flash Erase */
#define CFG_FLASH_WRITE_TOUT (2*CFG_HZ) /* Timeout for Flash Write */
-#undef CFG_ENV_IS_IN_DATAFLASH
+#define CFG_ENV_IS_IN_DATAFLASH
#ifdef CFG_ENV_IS_IN_DATAFLASH
-#define CFG_ENV_OFFSET 0x20000
+#define CFG_ENV_OFFSET 0x21000
#define CFG_ENV_ADDR (CFG_DATAFLASH_LOGIC_ADDR_CS0 + CFG_ENV_OFFSET)
-#define CFG_ENV_SIZE 0x2000 /* 0x8000 */
+#define CFG_ENV_SIZE 0x8400 /* 0x8000 */
#else
#define CFG_ENV_IS_IN_FLASH 1
#ifdef CONFIG_SKIP_LOWLEVEL_INIT
--- u-boot-1.1.4/Makefile 2005-12-16 17:39:27.000000000 +0100
+++ u-boot-1.1.4.klaus/Makefile 2006-03-02 02:49:23.000000000 +0100
@@ -57,7 +57,7 @@
CROSS_COMPILE = powerpc-linux-
endif
ifeq ($(ARCH),arm)
-CROSS_COMPILE = arm-linux-
+CROSS_COMPILE = ../staging_dir/bin/arm-linux-
endif
ifeq ($(ARCH),i386)
ifeq ($(HOSTARCH),i387)

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,14 @@
--- u-boot-1.1.4.org/lib_arm/board.c 2006-06-05 12:36:22.000000000 +0200
+++ u-boot-1.1.4.tmp/lib_arm/board.c 2006-06-05 12:36:44.000000000 +0200
@@ -332,6 +332,11 @@
}
#endif /* CONFIG_DRIVER_SMC91111 || CONFIG_DRIVER_LAN91C96 */
+#ifdef CONFIG_MACH_VLINK
+ printf("Initialising MAC address\n\r");
+ eth_init(gd->bd);
+#endif
+
/* Initialize from environment */
if ((s = getenv ("loadaddr")) != NULL) {
load_addr = simple_strtoul (s, NULL, 16);

View file

@ -0,0 +1,15 @@
--- u-boot-1.1.4.ttt/include/configs/vlink.h 2006-06-05 15:57:37.000000000 +0200
+++ u-boot-1.1.4/include/configs/vlink.h 2006-06-07 13:11:01.000000000 +0200
@@ -105,9 +105,9 @@
#define CONFIG_COMMANDS \
((CONFIG_CMD_DFL | CFG_CMD_MII |\
- CFG_CMD_DHCP ) & \
- ~(CFG_CMD_BDI | \
- CFG_CMD_IMI | \
+ CFG_CMD_DHCP | \
+ CFG_CMD_BDI ) & \
+ ~(CFG_CMD_IMI | \
CFG_CMD_AUTOSCRIPT | \
CFG_CMD_FPGA | \
CFG_CMD_MISC | \

View file

@ -0,0 +1,13 @@
diff -urN u-boot-1.1.4.old/cpu/arm920t/config.mk u-boot-1.1.4/cpu/arm920t/config.mk
--- u-boot-1.1.4.old/cpu/arm920t/config.mk 2007-03-19 12:44:39.000000000 +0100
+++ u-boot-1.1.4/cpu/arm920t/config.mk 2007-03-20 09:23:54.000000000 +0100
@@ -21,8 +21,7 @@
# MA 02111-1307 USA
#
-PLATFORM_RELFLAGS += -fno-strict-aliasing -fno-common -ffixed-r8 \
- -msoft-float
+PLATFORM_RELFLAGS += -fno-strict-aliasing -fno-common -ffixed-r8
PLATFORM_CPPFLAGS += -march=armv4
# =========================================================================