]> git.sur5r.net Git - u-boot/commitdiff
Blackfin: add init.elf helper code
authorMike Frysinger <vapier@gentoo.org>
Sat, 7 May 2011 21:55:04 +0000 (17:55 -0400)
committerMike Frysinger <vapier@gentoo.org>
Tue, 12 Jul 2011 06:17:45 +0000 (02:17 -0400)
This creates a standalone ELF that executes just the Blackfin initcode.
This is useful for people who want to program the low level aspects of
the CPU (memory/clocks/etc...) and can easily be used with JTAG for
quick booting while developing.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Makefile
arch/blackfin/cpu/.gitignore
arch/blackfin/cpu/Makefile
arch/blackfin/cpu/init.S [new file with mode: 0644]
arch/blackfin/cpu/init.lds.S [new file with mode: 0644]

index e56fa02b2c1e4356cd934ecda61bc9b383deb5f1..b1e07a7b331256ba5375752d72fdf5aa1cb7c255 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1075,7 +1075,8 @@ clean:
               $(obj)board/voiceblue/eeprom                               \
               $(obj)board/armltd/{integratorap,integratorcp}/u-boot.lds  \
               $(obj)u-boot.lds                                           \
-              $(obj)arch/blackfin/cpu/bootrom-asm-offsets.[chs]
+              $(obj)arch/blackfin/cpu/bootrom-asm-offsets.[chs]          \
+              $(obj)arch/blackfin/cpu/init.{lds,elf}
        @rm -f $(obj)include/bmp_logo.h
        @rm -f $(obj)lib/asm-offsets.s
        @rm -f $(obj)nand_spl/{u-boot.lds,u-boot-nand_spl.lds,u-boot-spl,u-boot-spl.map,System.map}
index 0ec9d5672ed78e58c44a3f492c6d93cf76c79d65..ba986d8ba87d49120e558f00820d37e9e9729568 100644 (file)
@@ -1 +1,4 @@
 bootrom-asm-offsets.[chs]
+
+init.lds
+init.elf
index df10f1bc653295c64c132df90347e6b76160bc97..5deaa9e6a28fa0b9a4ac44e8557609d7e0bd2353 100644 (file)
@@ -13,7 +13,7 @@ include $(TOPDIR)/config.mk
 
 LIB    = $(obj)lib$(CPU).o
 
-EXTRA    :=
+EXTRA    := init.elf
 CEXTRA   := initcode.o
 SEXTRA   := start.o
 SOBJS    := interrupt.o cache.o
@@ -61,6 +61,11 @@ ifneq ($(CONFIG_BFIN_BOOT_MODE),BFIN_BOOT_BYPASS)
        fi
 endif
 
+$(obj)init.lds: init.lds.S
+       $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P $^ -o $@
+$(obj)init.elf: $(obj)init.lds $(obj)init.o $(obj)initcode.o
+       $(LD) $(LDFLAGS) -T $^ -o $@
+
 #########################################################################
 
 # defines $(obj).depend target
diff --git a/arch/blackfin/cpu/init.S b/arch/blackfin/cpu/init.S
new file mode 100644 (file)
index 0000000..f48c113
--- /dev/null
@@ -0,0 +1,9 @@
+#include <asm/blackfin.h>
+ENTRY(_start)
+       sp.l = LO(L1_SRAM_SCRATCH_END - 20);
+       sp.h = HI(L1_SRAM_SCRATCH_END - 20);
+       call _initcode;
+1:
+       emuexcpt;
+       jump 1b;
+END(_start)
diff --git a/arch/blackfin/cpu/init.lds.S b/arch/blackfin/cpu/init.lds.S
new file mode 100644 (file)
index 0000000..602e7c8
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * linker script for simple init.elf
+ *
+ * Copyright (c) 2005-2011 Analog Device Inc.
+ *
+ * Licensed under the GPL-2 or later.
+ */
+
+#include <config.h>
+#include <asm/blackfin.h>
+#undef ALIGN
+#undef ENTRY
+
+OUTPUT_ARCH(bfin)
+
+MEMORY
+{
+       l1_code : ORIGIN = L1_INST_SRAM, LENGTH = L1_INST_SRAM_SIZE
+}
+
+ENTRY(_start)
+SECTIONS
+{
+       .text.l1 : { *(.text .text.*) } >l1_code
+}