board/neo1973/lowlevel_foo.S: http://people.openmoko.org/laforge/tmp/bbt-20070206/lowlevel_foo.S board/neo1973/lowlevel_foo.lds: http://people.openmoko.org/laforge/tmp/bbt-20070206/lowlevel_foo.lds board/neo1973/Makefile: added building of lowlevel_foo.bin (based on http://people.openmoko.org/laforge/tmp/bbt-20070206/lowlevel_foo.build.sh) Index: u-boot/board/neo1973/common/lowlevel_foo.S =================================================================== --- /dev/null +++ u-boot/board/neo1973/common/lowlevel_foo.S @@ -0,0 +1,82 @@ + +_start: + b reset +undefvec: + b undefvec +swivec: + b swivec +pabtvec: + b pabtvec +dabtvec: + b dabtvec +rsvdvec: + b rsvdvec +irqvec: + b irqvec +fiqvec: + b fiqvec + +reset: + /* + * set the cpu to SVC32 mode + */ + mrs r0,cpsr + bic r0,r0,#0x1f + orr r0,r0,#0xd3 + msr cpsr,r0 + +/* turn off the watchdog */ +#define pWTCON 0x53000000 +#define INTMSK 0x4A000008 /* Interupt-Controller base addresses */ +#define INTSUBMSK 0x4A00001C +#define CLKDIVN 0x4C000014 /* clock divisor register */ + + ldr r0, =pWTCON + mov r1, #0x0 + str r1, [r0] + + mov r1, #0xffffffff + ldr r0, =INTMSK + str r1, [r0] + ldr r1, =0x3ff + ldr r0, =INTSUBMSK + str r1, [r0] + + /* FCLK:HCLK:PCLK = 1:2:4 */ + /* default FCLK is 120 MHz ! */ + ldr r0, =CLKDIVN + mov r1, #3 + str r1, [r0] + + bl cpu_init_crit + ldr r0,=TEXT_BASE + mov pc, r0 + +cpu_init_crit: + /* + * flush v4 I/D caches + */ + mov r0, #0 + mcr p15, 0, r0, c7, c7, 0 /* flush v3/v4 cache */ + mcr p15, 0, r0, c8, c7, 0 /* flush v4 TLB */ + + /* + * disable MMU stuff and caches + */ + mrc p15, 0, r0, c1, c0, 0 + bic r0, r0, #0x00002300 @ clear bits 13, 9:8 (--V- --RS) + bic r0, r0, #0x00000087 @ clear bits 7, 2:0 (B--- -CAM) + orr r0, r0, #0x00000002 @ set bit 2 (A) Align + orr r0, r0, #0x00001000 @ set bit 12 (I) I-Cache + mcr p15, 0, r0, c1, c0, 0 + + /* + * before relocating, we have to setup RAM timing + * because memory timing is board-dependend, you will + * find a lowlevel_init.S in your board directory. + */ + mov ip, lr + bl lowlevel_init + mov lr, ip + mov pc, lr + Index: u-boot/board/neo1973/common/lowlevel_foo.lds =================================================================== --- /dev/null +++ u-boot/board/neo1973/common/lowlevel_foo.lds @@ -0,0 +1,56 @@ +/* + * (C) Copyright 2002 + * Gary Jennejohn, DENX Software Engineering, + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") +OUTPUT_ARCH(arm) +ENTRY(_start) +SECTIONS +{ + . = 0x00000000; + + . = ALIGN(4); + .text : + { + lowlevel_foo.o (.text) + *(.text) + } + + . = ALIGN(4); + .rodata : { *(.rodata) } + + . = ALIGN(4); + .data : { *(.data) } + + . = ALIGN(4); + .got : { *(.got) } + + . = .; + __u_boot_cmd_start = .; + .u_boot_cmd : { *(.u_boot_cmd) } + __u_boot_cmd_end = .; + + . = ALIGN(4); + __bss_start = .; + .bss : { *(.bss) } + _end = .; +} Index: u-boot/board/neo1973/gta01/Makefile =================================================================== --- u-boot.orig/board/neo1973/gta01/Makefile +++ u-boot/board/neo1973/gta01/Makefile @@ -28,14 +28,31 @@ OBJS := gta01.o pcf50606.o ../common/cmd_neo1973.o ../common/jbt6k74.o ../common/udc.o SOBJS := ../common/lowlevel_init.o +.PHONY: all + +all: $(LIB) lowevel_foo.bin + $(LIB): $(OBJS) $(SOBJS) $(AR) crv $@ $(OBJS) $(SOBJS) +lowlevel_foo.o: ../common/lowlevel_foo.S + $(CC) -c -DTEXT_BASE=0x33F80000 -march=armv4 \ + -o lowlevel_foo.o ../common/lowlevel_foo.S + +lowlevel_foo: lowlevel_foo.o ../common/lowlevel_init.o ../common/lowlevel_foo.lds + $(LD) -T ../common/lowlevel_foo.lds -Ttext 0x33f80000 -Bstatic \ + ../common/lowlevel_init.o lowlevel_foo.o -o lowlevel_foo + +lowevel_foo.bin: lowlevel_foo + $(CROSS_COMPILE)objcopy --gap-fill=0xff -O binary \ + lowlevel_foo lowlevel_foo.bin + + clean: - rm -f $(SOBJS) $(OBJS) + rm -f $(SOBJS) $(OBJS) lowlevel_foo lowlevel_foo.o distclean: clean - rm -f $(LIB) core *.bak .depend + rm -f $(LIB) core *.bak .depend lowlevel_foo.bin ######################################################################### Index: u-boot/board/qt2410/Makefile =================================================================== --- u-boot.orig/board/qt2410/Makefile +++ u-boot/board/qt2410/Makefile @@ -28,14 +28,31 @@ OBJS := qt2410.o flash.o SOBJS := lowlevel_init.o +.PHONY: all + +all: $(LIB) lowevel_foo.bin + $(LIB): $(OBJS) $(SOBJS) $(AR) crv $@ $(OBJS) $(SOBJS) +lowlevel_foo.o: ../neo1973/common/lowlevel_foo.S + $(CC) -c -DTEXT_BASE=0x33F80000 -march=armv4 \ + -o lowlevel_foo.o ../neo1973/common/lowlevel_foo.S + +lowlevel_foo: lowlevel_foo.o lowlevel_init.o \ + ../neo1973/common/lowlevel_foo.lds + $(LD) -T ../neo1973/common/lowlevel_foo.lds -Ttext 0x33f80000 -Bstatic \ + lowlevel_init.o lowlevel_foo.o -o lowlevel_foo + +lowevel_foo.bin: lowlevel_foo + $(CROSS_COMPILE)objcopy --gap-fill=0xff -O binary \ + lowlevel_foo lowlevel_foo.bin + clean: - rm -f $(SOBJS) $(OBJS) + rm -f $(SOBJS) $(OBJS) lowlevel_foo lowlevel_foo.o distclean: clean - rm -f $(LIB) core *.bak .depend + rm -f $(LIB) core *.bak .depend lowlevel_foo.bin #########################################################################