Skip to content

Commit

Permalink
sunxi spl: Add minimal FEL SPL (CONFIG_SPL_FEL)
Browse files Browse the repository at this point in the history
Allwinner CPUs supports an USB bootmode called FEL where the USB
host can upload code via a simple USB protocol. To execute anything
bigger than a few KB the board first needsto be initialized and
that is the job of the FEL SPL.
  • Loading branch information
hno committed May 24, 2013
1 parent 68ec8e9 commit 79272ff
Show file tree
Hide file tree
Showing 6 changed files with 99 additions and 8 deletions.
10 changes: 9 additions & 1 deletion arch/arm/cpu/armv7/sunxi/Makefile
Expand Up @@ -28,6 +28,8 @@ include $(TOPDIR)/config.mk

LIB = $(obj)lib$(SOC).o

TARGETS = $(obj).depend $(LIB)

COBJS += timer.o
COBJS += dram.o
COBJS += board.o
Expand All @@ -45,10 +47,16 @@ COBJS += cmd_watchdog.o
endif
endif

ifdef CONFIG_SPL_BUILD
ifdef CONFIG_SPL_FEL
TARGETS += $(obj)start.o
endif
endif

SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
OBJS := $(addprefix $(obj),$(COBJS) $(COBJS-y) $(SOBJS))

all: $(obj).depend $(LIB)
all: $(TARGETS)

$(LIB): $(OBJS)
$(call cmd_link_o_target, $(OBJS))
Expand Down
1 change: 1 addition & 0 deletions arch/arm/cpu/armv7/sunxi/start.c
@@ -0,0 +1 @@
/* Intentionally empty. Only needed to get FEL SPL link line right */
59 changes: 59 additions & 0 deletions arch/arm/cpu/armv7/sunxi/u-boot-spl-fel.lds
@@ -0,0 +1,59 @@
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
OUTPUT_ARCH(arm)
ENTRY(s_init)
SECTIONS
{
. = 0x00002000;
. = ALIGN(4);
.text :
{
*(.text.s_init)
*(.text*)
}
. = ALIGN(4);
.rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) }
. = ALIGN(4);
.data : {
*(.data*)
}
. = ALIGN(4);
. = .;
. = ALIGN(4);
.rel.dyn : {
__rel_dyn_start = .;
*(.rel*)
__rel_dyn_end = .;
}
.dynsym : {
__dynsym_start = .;
*(.dynsym)
}
. = ALIGN(4);
.note.gnu.build-id :
{
*(.note.gnu.build-id)
}
_end = .;
. = ALIGN(4096);
.mmutable : {
*(.mmutable)
}
.bss_start __rel_dyn_start (OVERLAY) : {
KEEP(*(.__bss_start));
__bss_base = .;
}
.bss __bss_base (OVERLAY) : {
*(.bss*)
. = ALIGN(4);
__bss_limit = .;
}
.bss_end __bss_limit (OVERLAY) : {
KEEP(*(.__bss_end));
}
/DISCARD/ : { *(.dynstr*) }
/DISCARD/ : { *(.dynamic*) }
/DISCARD/ : { *(.plt*) }
/DISCARD/ : { *(.interp*) }
/DISCARD/ : { *(.gnu*) }
/DISCARD/ : { *(.note*) }
}
2 changes: 2 additions & 0 deletions boards.cfg
Expand Up @@ -317,9 +317,11 @@ colibri_t20_iris arm armv7:arm720t colibri_t20_iris toradex
u8500_href arm armv7 u8500 st-ericsson u8500
snowball arm armv7 snowball st-ericsson u8500
A13-OLinuXino arm armv7 sunxi - sunxi sun5i:A13_OLINUXINO,SPL,STATUSLED=201
A13-OLinuXino_FEL arm armv7 sunxi - sunxi sun5i:A13_OLINUXINO,SPL_FEL
A13-OLinuXinoM arm armv7 sunxi - sunxi sun5i:A13_OLINUXINOM,SPL,NO_AXP
A13_MID arm armv7 sunxi - sunxi sun5i:A13_MID,SPL
Cubieboard arm armv7 sunxi - sunxi sun4i:CUBIEBOARD,SPL
Cubieboard_FEL arm armv7 sunxi - sunxi sun4i:CUBIEBOARD,SPL_FEL
Cubieboard_512 arm armv7 sunxi - sunxi sun4i:CUBIEBOARD_512,SPL
EOMA68-A10 arm armv7 sunxi - sunxi sun4i:EOMA68_A10,SPL,MMC_SUNXI_SLOT=3
Hackberry arm armv7 sunxi - sunxi sun4i:HACKBERRY,SPL
Expand Down
33 changes: 26 additions & 7 deletions include/configs/sunxi-common.h
Expand Up @@ -271,29 +271,46 @@
#define CONFIG_CMD_ZFS /* with this we can access ZFS bootfs */

#define CONFIG_SPL_FRAMEWORK
#define CONFIG_SPL_LIBCOMMON_SUPPORT
#define CONFIG_SPL_SERIAL_SUPPORT
#define CONFIG_SPL_LIBGENERIC_SUPPORT
#define CONFIG_SPL_DISPLAY_PRINT
#define CONFIG_SPL_LIBCOMMON_SUPPORT
#define CONFIG_SPL_SERIAL_SUPPORT
#define CONFIG_SPL_LIBGENERIC_SUPPORT
#define CONFIG_SPL_DISPLAY_PRINT

#ifdef CONFIG_SPL_FEL

#define CONFIG_SPL
#define CONFIG_SPL_LDSCRIPT "arch/arm/cpu/armv7/sunxi/u-boot-spl-fel.lds"
#define CONFIG_SPL_START_S_PATH "arch/arm/cpu/armv7/sunxi"
#define CONFIG_SPL_TEXT_BASE 0x2000
#define CONFIG_SPL_MAX_SIZE 0x4000 /* 24 KB */

#else /* CONFIG_SPL */

#define CONFIG_SPL_BSS_START_ADDR 0x50000000
#define CONFIG_SPL_BSS_MAX_SIZE 0x80000 /* 512 KB */

#define CONFIG_SPL_TEXT_BASE 0x20 /* sram start+header */
#define CONFIG_SPL_MAX_SIZE 0x6000 /* 24 KB */

#define CONFIG_SPL_LIBCOMMON_SUPPORT
#define CONFIG_SPL_LIBDISK_SUPPORT
#define CONFIG_SPL_SERIAL_SUPPORT
#define CONFIG_SPL_LIBGENERIC_SUPPORT
#define CONFIG_SPL_MMC_SUPPORT
#define CONFIG_SPL_DISPLAY_PRINT

/* end of 24KB in sram */
#define LOW_LEVEL_SRAM_STACK 0x00006000
#define CONFIG_SPL_STACK LOW_LEVEL_SRAM_STACK
#define CONFIG_SPL_LDSCRIPT "arch/arm/cpu/armv7/sunxi/u-boot-spl.lds"

/* 32KB offset */
#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR 64
/* SPL starts at offset 8KiB im MMC and has the size of 24KiB */
#define CONFIG_SPL_PAD_TO 24576 /* decimal for 'dd' */

#endif /* CONFIG_SPL */
/* end of 24KB in sram */
#define LOW_LEVEL_SRAM_STACK 0x00006000
#define CONFIG_SPL_STACK LOW_LEVEL_SRAM_STACK

#undef CONFIG_CMD_FPGA
#undef CONFIG_CMD_NET
#undef CONFIG_CMD_NFS
Expand Down Expand Up @@ -335,6 +352,7 @@
#define STATUS_LED_BIT3 CONFIG_STATUSLED1
#endif

#ifndef CONFIG_SPL_BUILD
#ifdef STATUS_LED_BIT
#define CONFIG_GPIO_LED
#define CONFIG_STATUS_LED
Expand All @@ -360,5 +378,6 @@
#define CONFIG_BOARD_SPECIFIC_LED
#define CONFIG_CMD_LED
#endif
#endif

#endif /* _SUNXI_COMMON_CONFIG_H */
2 changes: 2 additions & 0 deletions spl/Makefile
Expand Up @@ -153,8 +153,10 @@ ALL-y += $(obj)$(BOARD)-spl.bin
endif

ifdef CONFIG_SUNXI
ifndef CONFIG_SPL_FEL
ALL-y += $(obj)sunxi-spl.bin
endif
endif

all: $(ALL-y)

Expand Down

0 comments on commit 79272ff

Please sign in to comment.