9
0
Fork 0
barebox/arch/arm/Makefile

272 lines
8.4 KiB
Makefile
Raw Normal View History

2007-07-05 16:01:13 +00:00
CPPFLAGS += -D__ARM__ -fno-strict-aliasing
# Explicitly specifiy 32-bit ARM ISA since toolchain default can be -mthumb:
CPPFLAGS +=$(call cc-option,-marm,)
2007-07-05 16:01:14 +00:00
ifeq ($(CONFIG_CPU_BIG_ENDIAN),y)
CPPFLAGS += -mbig-endian
AS += -EB
LD += -EB
else
CPPFLAGS += -mlittle-endian
AS += -EL
LD += -EL
endif
comma = ,
# This selects which instruction set is used.
# Note that GCC does not numerically define an architecture version
# macro, but instead defines a whole series of macros which makes
# testing for a specific architecture or later rather impossible.
arch-$(CONFIG_CPU_32v7) :=-D__LINUX_ARM_ARCH__=7 $(call cc-option,-march=armv7-a,-march=armv5t -Wa$(comma)-march=armv7-a)
arch-$(CONFIG_CPU_32v6) :=-D__LINUX_ARM_ARCH__=6 $(call cc-option,-march=armv6,-march=armv5t -Wa$(comma)-march=armv6)
arch-$(CONFIG_CPU_32v5) :=-D__LINUX_ARM_ARCH__=5 $(call cc-option,-march=armv5te,-march=armv4t)
arch-$(CONFIG_CPU_32v4T) :=-D__LINUX_ARM_ARCH__=4 -march=armv4t
# This selects how we optimise for the processor.
tune-$(CONFIG_CPU_ARM920T) :=-mtune=arm9tdmi
tune-$(CONFIG_CPU_ARM926T) :=-mtune=arm9tdmi
tune-$(CONFIG_CPU_XSCALE) :=$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale
ifeq ($(CONFIG_AEABI),y)
CFLAGS_ABI :=-mabi=aapcs-linux -mno-thumb-interwork
else
CFLAGS_ABI :=$(call cc-option,-mapcs-32,-mabi=apcs-gnu) $(call cc-option,-mno-thumb-interwork,)
endif
ifeq ($(CONFIG_ARM_UNWIND),y)
CFLAGS_ABI +=-funwind-tables
endif
ifeq ($(CONFIG_THUMB2_BAREBOX),y)
AFLAGS_AUTOIT :=$(call as-option,-Wa$(comma)-mimplicit-it=always,-Wa$(comma)-mauto-it)
AFLAGS_NOWARN :=$(call as-option,-Wa$(comma)-mno-warn-deprecated,-Wa$(comma)-W)
CFLAGS_THUMB2 :=-mthumb $(AFLAGS_AUTOIT) $(AFLAGS_NOWARN)
AFLAGS_THUMB2 :=$(CFLAGS_THUMB2) -Wa$(comma)-mthumb
endif
CPPFLAGS += $(CFLAGS_ABI) $(arch-y) $(tune-y) -msoft-float $(CFLAGS_THUMB2)
AFLAGS += -include asm/unified.h -msoft-float $(AFLAGS_THUMB2)
# Machine directory name. This list is sorted alphanumerically
# by CONFIG_* macro name.
machine-$(CONFIG_ARCH_AT91) := at91
machine-$(CONFIG_ARCH_BCM2835) := bcm2835
machine-$(CONFIG_ARCH_CLPS711X) := clps711x
machine-$(CONFIG_ARCH_DAVINCI) := davinci
machine-$(CONFIG_ARCH_EP93XX) := ep93xx
machine-$(CONFIG_ARCH_HIGHBANK) := highbank
machine-$(CONFIG_ARCH_IMX) := imx
machine-$(CONFIG_ARCH_MXS) := mxs
machine-$(CONFIG_ARCH_MVEBU) := mvebu
machine-$(CONFIG_ARCH_NOMADIK) := nomadik
machine-$(CONFIG_ARCH_NETX) := netx
machine-$(CONFIG_ARCH_OMAP) := omap
machine-$(CONFIG_ARCH_PXA) := pxa
machine-$(CONFIG_ARCH_ROCKCHIP) := rockchip
machine-$(CONFIG_ARCH_SAMSUNG) := samsung
machine-$(CONFIG_ARCH_SOCFPGA) := socfpga
machine-$(CONFIG_ARCH_VERSATILE) := versatile
machine-$(CONFIG_ARCH_VEXPRESS) := vexpress
machine-$(CONFIG_ARCH_TEGRA) := tegra
machine-$(CONFIG_ARCH_UEMD) := uemd
machine-$(CONFIG_ARCH_ZYNQ) := zynq
# Board directory name. This list is sorted alphanumerically
# by CONFIG_* macro name.
#
# DO NOT ADD NEW ENTRIES TO THIS LIST!
# Add to arch/arm/boards/Makefile instead.
#
# These are here only because they have a board specific config.h.
# TODO: Get rid of board specific config.h and move these to
# arch/arm/boards/Makefile aswell.
board-$(CONFIG_MACH_A9M2410) += a9m2410
board-$(CONFIG_MACH_A9M2440) += a9m2440
board-$(CONFIG_MACH_AT91RM9200EK) += at91rm9200ek
board-$(CONFIG_MACH_MINI2440) += friendlyarm-mini2440
board-$(CONFIG_MACH_MINI6410) += friendlyarm-mini6410
board-$(CONFIG_MACH_PCM027) += phytec-phycore-pxa270
board-$(CONFIG_MACH_TINY210) += friendlyarm-tiny210
board-$(CONFIG_MACH_TINY6410) += friendlyarm-tiny6410
machdirs := $(patsubst %,arch/arm/mach-%/,$(machine-y))
ifeq ($(KBUILD_SRC),)
CPPFLAGS += $(patsubst %,-I%include,$(machdirs))
else
CPPFLAGS += $(patsubst %,-I$(srctree)/%include,$(machdirs))
endif
2007-07-05 16:01:24 +00:00
TEXT_BASE = $(CONFIG_TEXT_BASE)
2007-07-05 16:01:14 +00:00
CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE)
2007-07-05 16:01:14 +00:00
ifndef CONFIG_MODULES
# Add cleanup flags
CPPFLAGS += -fdata-sections -ffunction-sections
LDFLAGS_barebox += -static --gc-sections
endif
ifdef CONFIG_RELOCATABLE
LDFLAGS_barebox += -pie
endif
ifdef CONFIG_IMAGE_COMPRESSION
KBUILD_BINARY := arch/arm/pbl/zbarebox.bin
else
KBUILD_BINARY := barebox.bin
endif
barebox.netx: $(KBUILD_BINARY)
$(Q)scripts/gen_netx_image -i $< -o barebox.netx \
--sdramctrl=$(CONFIG_NETX_SDRAM_CTRL) \
--sdramtimctrl=$(CONFIG_NETX_SDRAM_TIMING_CTRL) \
--memctrl=$(CONFIG_NETX_MEM_CTRL) \
--entrypoint=$(CONFIG_TEXT_BASE) \
--cookie=$(CONFIG_NETX_COOKIE);
ifeq ($(machine-y),netx)
KBUILD_IMAGE := barebox.netx
endif
barebox.s5p: $(KBUILD_BINARY)
$(Q)scripts/s5p_cksum $< barebox.s5p
ifeq ($(CONFIG_ARCH_S5PCxx),y)
KBUILD_IMAGE := barebox.s5p
endif
quiet_cmd_mlo ?= IFT $@
cmd_mlo ?= scripts/omap_signGP -o MLO -l $(TEXT_BASE) -c $<
MLO: $(KBUILD_BINARY)
$(call if_changed,mlo)
ifeq ($(CONFIG_OMAP_BUILD_IFT),y)
KBUILD_IMAGE := MLO
endif
quiet_cmd_davinci_ubl_image = UBL-IMG $@
cmd_davinci_ubl_image = set -e; \
scripts/mkublheader $< > $@; \
cat $< >> $@
barebox.ubl: $(KBUILD_BINARY) FORCE
$(call if_changed,davinci_ubl_image)
ifeq ($(CONFIG_ARCH_DAVINCI),y)
KBUILD_IMAGE := barebox.ubl
endif
quiet_cmd_am35xx_spi_image = SPI-IMG $@
cmd_am35xx_spi_image = scripts/mk-am3xxx-spi-image -s am35xx -a $(TEXT_BASE) $< > $@
barebox.spi: $(KBUILD_BINARY) FORCE
$(call if_changed,am35xx_spi_image)
MLO.spi: MLO FORCE
$(call if_changed,am35xx_spi_image)
ifeq ($(CONFIG_OMAP_BUILD_SPI),y)
KBUILD_IMAGE := MLO.spi
endif
quiet_cmd_zynq_image = ZYNQ-IMG $@
cmd_zynq_image = scripts/zynq_mkimage $< $@
barebox.zynq: $(KBUILD_BINARY) FORCE
$(call if_changed,zynq_image)
ifeq ($(machine-y),zynq)
KBUILD_IMAGE := barebox.zynq
endif
arm: integrate kwbimage in the image generation When a ARCH_MVEBU platform is selected, generate barebox.kwb and barebox.kwbuart images from barebox.bin, using kwbimage. barebox.kwb is generated by executing kwbimage on the board kwbimage.cfg file, and is therefore designed to be booted from the default boot media of the board, as defined by kwbimage.cfg (typically a NAND flash or SPI flash). barebox.kwbuart is generated by executing kwbimage on the board kwbimage.cfg file, but by overriding the boot media to be UART. This image is suitable for usage with the kwbtool and is generally useful for recovery purposes. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Tested-by: Gregory CLEMENT <gregory.clement@free-electrons.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Squashed this fixup: arm: ensure the build doesn't fail when kwbimage lacks the binary blob mach-mvebu images for Armada 370 and Armada XP SoC require a DDR3 training code which should be extracted from existing bootable images for the relevant board. When such binary blob has not been extracted, the build of the .kwb and .kwbuart images will fail. This is annoying as it makes the build of all Armada 370/XP defconfig fail, which can be a problem for automated builds. This proposal makes the failure of kwbimage not a fatal failure for the build process, and shows a warning. The user therefore sees: ==================================================================== KWB barebox.kwb Didn't find the file 'plathome-openblocks-ax3-binary.0' in '/home/thomas/projets/barebox' which is mandatory to generate the image This file generally contains the DDR3 training code, and should be extracted from an existing bootable image for your board. See 'kwbimage -x' to extract it from an existing image. Could not create image WARNING: Couldn't create KWB image due to previous errors. KWBUART barebox.kwbuart Didn't find the file 'plathome-openblocks-ax3-binary.0' in '/home/thomas/projets/barebox' which is mandatory to generate the image This file generally contains the DDR3 training code, and should be extracted from an existing bootable image for your board. See 'kwbimage -x' to extract it from an existing image. Could not create image WARNING Couldn't create KWB image due to previous errors. ==================================================================== The only drawback is that barebox-flash-image, which normally points to barebox.kwb, becomes a stale symbolic link. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-09 09:52:48 +00:00
KWBIMAGE_OPTS = \
-c -i $(srctree)/$(BOARD)/kwbimage.cfg -d $(TEXT_BASE) -e $(TEXT_BASE)
quiet_cmd_kwbimage = KWB $@
cmd_kwbimage = scripts/kwbimage -p $< $(KWBIMAGE_OPTS) -o $@ || \
echo "WARNING: Couldn't create KWB image due to previous errors."
quiet_cmd_kwbimage_uart = KWBUART $@
cmd_kwbimage_uart = scripts/kwbimage -m uart -p $< $(KWBIMAGE_OPTS) -o $@ || \
echo "WARNING Couldn't create KWB image due to previous errors."
barebox.kwb: $(KBUILD_BINARY) FORCE
$(call if_changed,kwbimage)
barebox.kwbuart: $(KBUILD_BINARY) FORCE
$(call if_changed,kwbimage_uart)
ifeq ($(CONFIG_ARCH_MVEBU),y)
KBUILD_IMAGE := barebox.kwb barebox.kwbuart
endif
barebox.imximg: $(KBUILD_BINARY) FORCE
$(call if_changed,imx_image)
boarddir = $(srctree)/arch/arm/boards
imxcfg-$(CONFIG_MACH_FREESCALE_MX53_SMD) += $(boarddir)/freescale-mx53-smd/flash-header.imxcfg
imxcfg-$(CONFIG_MACH_MX6Q_ARM2) += $(boarddir)/freescale-mx6-arm2/flash-header.imxcfg
imxcfg-$(CONFIG_MACH_CCMX51) += $(boarddir)/ccxmx51/flash-header.imxcfg
imxcfg-$(CONFIG_MACH_TX51) += $(boarddir)/karo-tx51/flash-header-karo-tx51.imxcfg
imxcfg-$(CONFIG_MACH_GUF_VINCELL) += $(boarddir)/guf-vincell/flash-header.imxcfg
imxcfg-$(CONFIG_MACH_EUKREA_CPUIMX51SD) += $(boarddir)/eukrea_cpuimx51/flash-header.imxcfg
imxcfg-$(CONFIG_MACH_FREESCALE_MX25_3STACK) += $(boarddir)/freescale-mx25-3ds/flash-header.imxcfg
imxcfg-$(CONFIG_MACH_FREESCALE_MX35_3STACK) += $(boarddir)/freescale-mx35-3ds/flash-header.imxcfg
imxcfg-$(CONFIG_MACH_TQMA53) += $(boarddir)/tqma53/flash-header.imxcfg
imxcfg-$(CONFIG_MACH_EUKREA_CPUIMX25) += $(boarddir)/eukrea_cpuimx25/flash-header.imxcfg
imxcfg-$(CONFIG_MACH_EUKREA_CPUIMX35) += $(boarddir)/eukrea_cpuimx35/flash-header.imxcfg
imxcfg-$(CONFIG_TX53_REV_1011) += $(boarddir)/karo-tx53/flash-header-tx53-rev1011.imxcfg
imxcfg-$(CONFIG_TX53_REV_XX30) += $(boarddir)/karo-tx53/flash-header-tx53-revxx30.imxcfg
ifneq ($(imxcfg-y),)
CFG_barebox.imximg := $(imxcfg-y)
KBUILD_IMAGE := barebox.imximg
endif
pbl := arch/arm/pbl
$(pbl)/zbarebox.S $(pbl)/zbarebox.bin $(pbl)/zbarebox: barebox.bin FORCE
$(Q)$(MAKE) $(build)=$(pbl) $@
archclean:
$(MAKE) $(clean)=$(pbl)
dts := arch/arm/dts
%.dtb: scripts
$(Q)$(MAKE) $(build)=$(dts) $(dts)/$@
KBUILD_IMAGE ?= $(KBUILD_BINARY)
2007-07-05 16:01:14 +00:00
archprepare: maketools
maketools:
$(Q)$(MAKE) $(build)=arch/arm/tools include/generated/mach-types.h
2007-07-05 16:01:14 +00:00
PHONY += maketools
ifneq ($(board-y),)
BOARD := arch/arm/boards/$(board-y)/
2007-07-05 16:01:14 +00:00
else
BOARD :=
2007-07-05 16:01:14 +00:00
endif
2007-10-17 15:57:55 +00:00
ifneq ($(machine-y),)
MACH := arch/arm/mach-$(machine-y)/
2007-07-05 16:01:14 +00:00
else
MACH :=
2007-07-05 16:01:14 +00:00
endif
common-y += $(BOARD) arch/arm/boards/ $(MACH)
common-y += arch/arm/lib/ arch/arm/cpu/
common-$(CONFIG_OFTREE) += arch/arm/dts/
lds-y := arch/arm/lib/barebox.lds
common- += $(patsubst %,arch/arm/boards/%/,$(board-))
CLEAN_FILES += include/generated/mach-types.h arch/arm/lib/barebox.lds barebox-flash-image