Wolfgang Denk | 97caf67 | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 1 | # |
| 2 | # (C) Copyright 2000-2002 |
| 3 | # Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
| 4 | # |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 5 | # SPDX-License-Identifier: GPL-2.0+ |
Wolfgang Denk | 97caf67 | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 6 | # |
| 7 | |
Masahiro Yamada | f0ac9e0 | 2014-02-28 14:33:30 +0900 | [diff] [blame] | 8 | ifeq ($(CROSS_COMPILE),) |
| 9 | CROSS_COMPILE := bfin-uclinux- |
| 10 | endif |
Mike Frysinger | 8378ba4 | 2009-06-14 23:33:14 -0400 | [diff] [blame] | 11 | |
Wolfgang Denk | 33a5734 | 2011-02-04 14:25:17 +0100 | [diff] [blame] | 12 | CONFIG_STANDALONE_LOAD_ADDR ?= 0x1000 -m elf32bfin |
Mike Frysinger | 5b66044 | 2009-09-03 23:12:47 -0400 | [diff] [blame] | 13 | |
Mike Frysinger | 5b0c128 | 2010-12-23 14:58:37 -0500 | [diff] [blame] | 14 | ifeq ($(CONFIG_BFIN_CPU),) |
| 15 | CONFIG_BFIN_CPU := \ |
| 16 | $(shell awk '$$2 == "CONFIG_BFIN_CPU" { print $$3 }' \ |
Masahiro Yamada | 59f15f2 | 2014-02-04 17:24:24 +0900 | [diff] [blame] | 17 | $(srctree)/include/configs/$(BOARD).h) |
Mike Frysinger | 5b0c128 | 2010-12-23 14:58:37 -0500 | [diff] [blame] | 18 | else |
Masahiro Yamada | 7c9c744 | 2013-12-05 15:08:31 +0900 | [diff] [blame] | 19 | CONFIG_BFIN_CPU := $(strip $(CONFIG_BFIN_CPU:"%"=%)) |
Mike Frysinger | 5b0c128 | 2010-12-23 14:58:37 -0500 | [diff] [blame] | 20 | endif |
Masahiro Yamada | 7c9c744 | 2013-12-05 15:08:31 +0900 | [diff] [blame] | 21 | CONFIG_BFIN_BOOT_MODE := $(strip $(CONFIG_BFIN_BOOT_MODE:"%"=%)) |
Mike Frysinger | 94bae5c | 2008-03-30 15:46:13 -0400 | [diff] [blame] | 22 | |
Robin Getz | 2773d5f | 2009-08-17 15:23:02 +0000 | [diff] [blame] | 23 | PLATFORM_RELFLAGS += -ffixed-P3 -fomit-frame-pointer -mno-fdpic |
Mike Frysinger | a13ad8e | 2008-02-04 19:26:55 -0500 | [diff] [blame] | 24 | |
Haiying Wang | 3935873 | 2011-02-22 16:38:05 -0500 | [diff] [blame] | 25 | LDFLAGS_FINAL += --gc-sections |
Nobuhiro Iwamatsu | b859b8c | 2011-01-06 10:23:54 +0900 | [diff] [blame] | 26 | LDFLAGS += -m elf32bfin |
Mike Frysinger | 26bf0cbe | 2008-10-24 18:18:16 -0400 | [diff] [blame] | 27 | PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections |
| 28 | |
Mike Frysinger | f0dd792 | 2008-02-18 05:26:48 -0500 | [diff] [blame] | 29 | PLATFORM_RELFLAGS += -mcpu=$(CONFIG_BFIN_CPU) |
Mike Frysinger | f0dd792 | 2008-02-18 05:26:48 -0500 | [diff] [blame] | 30 | |
Mike Frysinger | 57047e0 | 2009-06-15 00:25:19 -0400 | [diff] [blame] | 31 | ifneq ($(CONFIG_BFIN_BOOT_MODE),BFIN_BOOT_BYPASS) |
Masahiro Yamada | 59f15f2 | 2014-02-04 17:24:24 +0900 | [diff] [blame] | 32 | ALL-y += u-boot.ldr |
Mike Frysinger | 57047e0 | 2009-06-15 00:25:19 -0400 | [diff] [blame] | 33 | endif |
Mike Frysinger | 45b57bd | 2009-07-21 22:17:36 -0400 | [diff] [blame] | 34 | ifeq ($(CONFIG_ENV_IS_EMBEDDED_IN_LDR),y) |
Masahiro Yamada | 59f15f2 | 2014-02-04 17:24:24 +0900 | [diff] [blame] | 35 | CREATE_LDR_ENV = tools/envcrc --binary > env-ldr.o |
Mike Frysinger | d16452b | 2011-11-02 23:49:03 -0400 | [diff] [blame] | 36 | HOSTCFLAGS_NOPED_ADSP := \ |
Mike Frysinger | 6ca3e8a | 2010-09-26 07:00:38 +0000 | [diff] [blame] | 37 | $(shell $(CPP) -dD - -mcpu=$(CONFIG_BFIN_CPU) </dev/null \ |
| 38 | | awk '$$2 ~ /ADSP/ { print "-D" $$2 }') |
Mike Frysinger | d16452b | 2011-11-02 23:49:03 -0400 | [diff] [blame] | 39 | HOSTCFLAGS_NOPED += $(HOSTCFLAGS_NOPED_ADSP) |
Mike Frysinger | 45b57bd | 2009-07-21 22:17:36 -0400 | [diff] [blame] | 40 | else |
| 41 | CREATE_LDR_ENV = |
| 42 | endif |
Mike Frysinger | 57047e0 | 2009-06-15 00:25:19 -0400 | [diff] [blame] | 43 | |
Mike Frysinger | a13ad8e | 2008-02-04 19:26:55 -0500 | [diff] [blame] | 44 | SYM_PREFIX = _ |
Masahiro Yamada | 958fe8f | 2014-03-05 16:59:40 +0900 | [diff] [blame] | 45 | export SYM_PREFIX |
Mike Frysinger | 908e776 | 2008-02-04 19:26:57 -0500 | [diff] [blame] | 46 | |
Mike Frysinger | a48e0ed | 2009-04-24 23:39:41 -0400 | [diff] [blame] | 47 | LDR_FLAGS-y := |
| 48 | LDR_FLAGS-$(CONFIG_BFIN_BOOTROM_USES_EVT1) += -J |
| 49 | |
Mike Frysinger | 10e86e7 | 2008-08-07 18:55:30 -0400 | [diff] [blame] | 50 | LDR_FLAGS += --bmode $(subst BFIN_BOOT_,,$(CONFIG_BFIN_BOOT_MODE)) |
Mike Frysinger | 908e776 | 2008-02-04 19:26:57 -0500 | [diff] [blame] | 51 | LDR_FLAGS += --use-vmas |
Masahiro Yamada | 59f15f2 | 2014-02-04 17:24:24 +0900 | [diff] [blame] | 52 | LDR_FLAGS += --initcode $(CPUDIR)/initcode.o |
Mike Frysinger | bcb71c2 | 2008-10-06 04:42:33 -0400 | [diff] [blame] | 53 | ifneq ($(CONFIG_BFIN_BOOT_MODE),BFIN_BOOT_UART) |
Mike Frysinger | 45b57bd | 2009-07-21 22:17:36 -0400 | [diff] [blame] | 54 | LDR_FLAGS-$(CONFIG_ENV_IS_EMBEDDED_IN_LDR) += \ |
Masahiro Yamada | 59f15f2 | 2014-02-04 17:24:24 +0900 | [diff] [blame] | 55 | --punchit $$(($(CONFIG_ENV_OFFSET))):$$(($(CONFIG_ENV_SIZE))):env-ldr.o |
Mike Frysinger | bcb71c2 | 2008-10-06 04:42:33 -0400 | [diff] [blame] | 56 | endif |
Mike Frysinger | f0dd792 | 2008-02-18 05:26:48 -0500 | [diff] [blame] | 57 | ifneq (,$(findstring s,$(MAKEFLAGS))) |
Mike Frysinger | 908e776 | 2008-02-04 19:26:57 -0500 | [diff] [blame] | 58 | LDR_FLAGS += --quiet |
| 59 | endif |
Mike Frysinger | a48e0ed | 2009-04-24 23:39:41 -0400 | [diff] [blame] | 60 | |
| 61 | LDR_FLAGS += $(LDR_FLAGS-y) |
Mike Frysinger | 37f4870 | 2009-06-14 06:29:07 -0400 | [diff] [blame] | 62 | |
Mike Frysinger | 785ce79 | 2010-12-23 14:19:23 -0500 | [diff] [blame] | 63 | # Set some default LDR flags based on boot mode. |
| 64 | LDR_FLAGS += $(LDR_FLAGS-$(CONFIG_BFIN_BOOT_MODE)) |
| 65 | |
Mike Frysinger | d6a28fa | 2010-12-23 14:13:41 -0500 | [diff] [blame] | 66 | ifneq ($(CONFIG_SYS_TEXT_BASE),) |
| 67 | $(error do not set CONFIG_SYS_TEXT_BASE for Blackfin boards) |
| 68 | endif |