Skip to content

Commit

Permalink
[PATCH] xtensa: Architecture support for Tensilica Xtensa Part 2
Browse files Browse the repository at this point in the history
The attached patches provides part 2 of an architecture implementation for the
Tensilica Xtensa CPU series.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Chris Zankel authored and Linus Torvalds committed Jun 24, 2005
1 parent 8e1a6dd commit 4bedea9
Show file tree
Hide file tree
Showing 13 changed files with 3,279 additions and 0 deletions.
37 changes: 37 additions & 0 deletions arch/xtensa/boot/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#
# arch/xtensa/boot/Makefile
#
# This file is subject to the terms and conditions of the GNU General Public
# License. See the file "COPYING" in the main directory of this archive
# for more details.
#
#


CFLAGS += -fno-builtin -Iarch/$(ARCH)/boot/include
HOSTFLAGS += -Iarch/$(ARCH)/boot/include

BIG_ENDIAN := $(shell echo -e "\#ifdef __XTENSA_EL__\nint little;\n\#else\nint big;\n\#endif" | $(CC) -E -|grep -c big)


export CFLAGS
export AFLAGS
export BIG_ENDIAN

# Subdirs for the boot loader(s)

bootdir-$(CONFIG_XTENSA_PLATFORM_ISS) += boot-elf
bootdir-$(CONFIG_XTENSA_PLATFORM_XT2000) += boot-redboot boot-elf

subdir-y := lib/

subdir-y += boot-elf/ boot-redboot/

zImage zImage.initrd Image Image.initrd: $(bootdir-y)

$(bootdir-y): $(addprefix $(obj)/,$(subdir-y)) \
$(addprefix $(obj)/,$(host-progs))
$(Q)$(MAKE) $(build)=$(obj)/$@ $(MAKECMDGOALS)



52 changes: 52 additions & 0 deletions arch/xtensa/boot/boot-elf/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#
# This file is subject to the terms and conditions of the GNU General Public
# License. See the file "COPYING" in the main directory of this archive
# for more details.
#

GZIP = gzip
GZIP_FLAGS = -v9fc

ifeq ($(BIG_ENDIAN),1)
OBJCOPY_ARGS := -O elf32-xtensa-be
else
OBJCOPY_ARGS := -O elf32-xtensa-le
endif

export OBJCOPY_ARGS

boot-y := bootstrap.o

OBJS := $(addprefix $(obj)/,$(boot-y))

Image: vmlinux $(OBJS)
$(OBJCOPY) --strip-all -R .comment -R .xt.insn -O binary \
vmlinux vmlinux.tmp
$(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
--add-section image=vmlinux.tmp \
--set-section-flags image=contents,alloc,load,load,data \
$(OBJS) $@.tmp
$(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) \
-T arch/$(ARCH)/boot/boot-elf/boot.ld \
-o arch/$(ARCH)/boot/$@.elf $@.tmp
rm -f $@.tmp vmlinux.tmp

Image.initrd: vmlinux $(OBJS)
$(OBJCOPY) --strip-all -R .comment -R .xt.insn -O binary \
--add-section .initrd=arch/$(ARCH)/boot/ramdisk \
--set-section-flags .initrd=contents,alloc,load,load,data \
vmlinux vmlinux.tmp
$(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
--add-section image=vmlinux.tmp \
--set-section-flags image=contents,alloc,load,load,data \
$(OBJS) $@.tmp
$(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) \
-T arch/$(ARCH)/boot/boot-elf/boot.ld \
-o arch/$(ARCH)/boot/$@.elf $@.tmp
rm -f $@.tmp vmlinux.tmp


zImage: Image

zImage.initrd: Image.initrd

71 changes: 71 additions & 0 deletions arch/xtensa/boot/boot-elf/boot.ld
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
OUTPUT_ARCH(xtensa)

SECTIONS
{
.start 0xD0000000 : { *(.start) }

.text 0xD0000000:
{
__reloc_start = . ;
_text_start = . ;
*(.literal .text.literal .text)
_text_end = . ;
}

.rodata ALIGN(0x04):
{
*(.rodata)
*(.rodata1)
}

.data ALIGN(0x04):
{
*(.data)
*(.data1)
*(.sdata)
*(.sdata2)
*(.got.plt)
*(.got)
*(.dynamic)
}

__reloc_end = . ;

.initrd ALIGN(0x10) :
{
boot_initrd_start = . ;
*(.initrd)
boot_initrd_end = .;
}

. = ALIGN(0x10);
__image_load = . ;
.image 0xd0001000:
{
_image_start = .;
*(image)
. = (. + 3) & ~ 3;
_image_end = . ;
}


.bss ((LOADADDR(.image) + SIZEOF(.image) + 3) & ~ 3):
{
__bss_start = .;
*(.sbss)
*(.scommon)
*(.dynbss)
*(.bss)
__bss_end = .;
}
_end = .;
_param_start = .;

.ResetVector.text 0xfe000020 :
{
*(.ResetVector.text)
}


PROVIDE (end = .);
}
37 changes: 37 additions & 0 deletions arch/xtensa/boot/boot-elf/bootstrap.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

#include <xtensa/config/specreg.h>
#include <xtensa/config/core.h>

#include <linux/config.h>
#include <asm/bootparam.h>


/* ResetVector
*/
.section .ResetVector.text, "ax"
.global _ResetVector
_ResetVector:
_j reset
.align 4
RomInitAddr:
.word 0xd0001000
RomBootParam:
.word _bootparam
reset:
l32r a0, RomInitAddr
l32r a2, RomBootParam
movi a3, 0
movi a4, 0
jx a0

.align 4
.section .bootstrap.data, "aw"

.globl _bootparam
_bootparam:
.short BP_TAG_FIRST
.short 4
.long BP_VERSION
.short BP_TAG_LAST
.short 0
.long 0
35 changes: 35 additions & 0 deletions arch/xtensa/boot/boot-redboot/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#
# This file is subject to the terms and conditions of the GNU General Public
# License. See the file "COPYING" in the main directory of this archive
# for more details.
#

GZIP = gzip
GZIP_FLAGS = -v9fc
ifeq ($(BIG_ENDIAN),1)
OBJCOPY_ARGS := -O elf32-xtensa-be
else
OBJCOPY_ARGS := -O elf32-xtensa-le
endif

LD_ARGS = -T $(obj)/boot.ld

boot-y := bootstrap.o

OBJS := $(addprefix $(obj)/,$(boot-y))
LIBS := arch/$(ARCH)/boot/lib/lib.a arch/$(ARCH)/lib/lib.a

LIBGCC := $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)

zImage: vmlinux $(OBJS) $(LIBS)
$(OBJCOPY) --strip-all -R .comment -R .xt.insn -O binary \
$(TOPDIR)/vmlinux vmlinux.tmp
gzip -vf9 vmlinux.tmp
$(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
--add-section image=vmlinux.tmp.gz \
--set-section-flags image=contents,alloc,load,load,data \
$(OBJS) $@.tmp
$(LD) $(LD_ARGS) -o $@.elf $@.tmp $(LIBS) -L/xtensa-elf/lib $(LIBGCC)
$(OBJCOPY) -S -O binary $@.elf arch/$(ARCH)/boot/images/$@.redboot
# rm -f $@.tmp $@.elf vmlinux.tmp.gz

66 changes: 66 additions & 0 deletions arch/xtensa/boot/boot-redboot/boot.ld
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
OUTPUT_ARCH(xtensa)

SECTIONS
{
.start 0xD0200000 : { *(.start) }

.text :
{
__reloc_start = . ;
_text_start = . ;
*(.literal .text.literal .text)
_text_end = . ;
}

.rodata ALIGN(0x04):
{
*(.rodata)
*(.rodata1)
}

.data ALIGN(0x04):
{
*(.data)
*(.data1)
*(.sdata)
*(.sdata2)
*(.got.plt)
*(.got)
*(.dynamic)
}

__reloc_end = . ;

.initrd ALIGN(0x10) :
{
boot_initrd_start = . ;
*(.initrd)
boot_initrd_end = .;
}

. = ALIGN(0x10);
__image_load = . ;
.image 0xd0001000: AT(__image_load)
{
_image_start = .;
*(image)
. = (. + 3) & ~ 3;
_image_end = . ;
}


.bss ((LOADADDR(.image) + SIZEOF(.image) + 3) & ~ 3):
{
__bss_start = .;
*(.sbss)
*(.scommon)
*(.dynbss)
*(.bss)
__bss_end = .;
}
_end = .;
_param_start = .;


PROVIDE (end = .);
}
Loading

0 comments on commit 4bedea9

Please sign in to comment.