blob: 35f871662df19ac9b20c769a1ef5d0ebc4e1459c [file] [log] [blame]
Wolfgang Denk6cb142f2006-03-12 02:12:27 +01001#
2# (C) Copyright 2000-2002
3# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4#
Wolfgang Denk1a459662013-07-08 09:37:19 +02005# SPDX-License-Identifier: GPL-2.0+
Wolfgang Denk6cb142f2006-03-12 02:12:27 +01006#
7
Mike Frysinger1ea6bcd2009-06-14 23:33:14 -04008CROSS_COMPILE ?= bfin-uclinux-
9
Wolfgang Denk8ae86b72011-02-04 14:25:17 +010010CONFIG_STANDALONE_LOAD_ADDR ?= 0x1000 -m elf32bfin
Mike Frysinger262ae0a2009-09-03 23:12:47 -040011
Mike Frysingerfbcf8e82010-12-23 14:58:37 -050012ifeq ($(CONFIG_BFIN_CPU),)
13CONFIG_BFIN_CPU := \
14 $(shell awk '$$2 == "CONFIG_BFIN_CPU" { print $$3 }' \
15 $(src)include/configs/$(BOARD).h)
16else
17CONFIG_BFIN_CPU := $(strip $(subst ",,$(CONFIG_BFIN_CPU)))
18endif
Mike Frysinger9171fc82008-03-30 15:46:13 -040019CONFIG_BFIN_BOOT_MODE := $(strip $(subst ",,$(CONFIG_BFIN_BOOT_MODE)))
20
Robin Getzc4db3352009-08-17 15:23:02 +000021PLATFORM_RELFLAGS += -ffixed-P3 -fomit-frame-pointer -mno-fdpic
Mike Frysinger00036132008-02-04 19:26:55 -050022PLATFORM_CPPFLAGS += -DCONFIG_BLACKFIN
Mike Frysinger0858b832008-02-04 19:26:55 -050023
Haiying Wang6dc1eceb2011-02-22 16:38:05 -050024LDFLAGS_FINAL += --gc-sections
Nobuhiro Iwamatsu8aba9dc2011-01-06 10:23:54 +090025LDFLAGS += -m elf32bfin
Mike Frysinger6957a622008-10-24 18:18:16 -040026PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections
27
Mike Frysingerf7ce12c2008-02-18 05:26:48 -050028PLATFORM_RELFLAGS += -mcpu=$(CONFIG_BFIN_CPU)
Mike Frysingerf7ce12c2008-02-18 05:26:48 -050029
Mike Frysinger3e883372009-06-15 00:25:19 -040030ifneq ($(CONFIG_BFIN_BOOT_MODE),BFIN_BOOT_BYPASS)
Daniel Schwierzeck4e0fbb92011-07-13 05:11:01 +000031ALL-y += $(obj)u-boot.ldr
Mike Frysinger3e883372009-06-15 00:25:19 -040032endif
Mike Frysinger76d82182009-07-21 22:17:36 -040033ifeq ($(CONFIG_ENV_IS_EMBEDDED_IN_LDR),y)
34CREATE_LDR_ENV = $(obj)tools/envcrc --binary > $(obj)env-ldr.o
Mike Frysingere29ad972011-11-02 23:49:03 -040035HOSTCFLAGS_NOPED_ADSP := \
Mike Frysinger48c00fe2010-09-26 07:00:38 +000036 $(shell $(CPP) -dD - -mcpu=$(CONFIG_BFIN_CPU) </dev/null \
37 | awk '$$2 ~ /ADSP/ { print "-D" $$2 }')
Mike Frysingere29ad972011-11-02 23:49:03 -040038HOSTCFLAGS_NOPED += $(HOSTCFLAGS_NOPED_ADSP)
Mike Frysinger76d82182009-07-21 22:17:36 -040039else
40CREATE_LDR_ENV =
41endif
Mike Frysinger3e883372009-06-15 00:25:19 -040042
Mike Frysinger0858b832008-02-04 19:26:55 -050043SYM_PREFIX = _
Mike Frysinger94a91e22008-02-04 19:26:57 -050044
Mike Frysinger02778f22009-04-24 23:39:41 -040045LDR_FLAGS-y :=
46LDR_FLAGS-$(CONFIG_BFIN_BOOTROM_USES_EVT1) += -J
47
Mike Frysinger746290d2008-08-07 18:55:30 -040048LDR_FLAGS += --bmode $(subst BFIN_BOOT_,,$(CONFIG_BFIN_BOOT_MODE))
Mike Frysinger94a91e22008-02-04 19:26:57 -050049LDR_FLAGS += --use-vmas
Peter Tyser03b70042010-04-12 22:28:02 -050050LDR_FLAGS += --initcode $(obj)$(CPUDIR)/initcode.o
Mike Frysinger67c28292008-10-06 04:42:33 -040051ifneq ($(CONFIG_BFIN_BOOT_MODE),BFIN_BOOT_UART)
Mike Frysinger76d82182009-07-21 22:17:36 -040052LDR_FLAGS-$(CONFIG_ENV_IS_EMBEDDED_IN_LDR) += \
53 --punchit $$(($(CONFIG_ENV_OFFSET))):$$(($(CONFIG_ENV_SIZE))):$(obj)env-ldr.o
Mike Frysinger67c28292008-10-06 04:42:33 -040054endif
Mike Frysingerf7ce12c2008-02-18 05:26:48 -050055ifneq (,$(findstring s,$(MAKEFLAGS)))
Mike Frysinger94a91e22008-02-04 19:26:57 -050056LDR_FLAGS += --quiet
57endif
Mike Frysinger02778f22009-04-24 23:39:41 -040058
59LDR_FLAGS += $(LDR_FLAGS-y)
Mike Frysinger9ff67e52009-06-14 06:29:07 -040060
Mike Frysingerec4c6932010-12-23 14:19:23 -050061# Set some default LDR flags based on boot mode.
62LDR_FLAGS += $(LDR_FLAGS-$(CONFIG_BFIN_BOOT_MODE))
63
Mike Frysingerfbb21ff2010-12-23 14:13:41 -050064ifneq ($(CONFIG_SYS_TEXT_BASE),)
65$(error do not set CONFIG_SYS_TEXT_BASE for Blackfin boards)
66endif