Wolfgang Denk | 6cb142f | 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 | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 5 | # SPDX-License-Identifier: GPL-2.0+ |
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 6 | # |
| 7 | |
Masahiro Yamada | 9b6e2c3 | 2014-02-28 14:33:30 +0900 | [diff] [blame] | 8 | ifeq ($(CROSS_COMPILE),) |
| 9 | CROSS_COMPILE := bfin-uclinux- |
| 10 | endif |
Mike Frysinger | 1ea6bcd | 2009-06-14 23:33:14 -0400 | [diff] [blame] | 11 | |
Wolfgang Denk | 8ae86b7 | 2011-02-04 14:25:17 +0100 | [diff] [blame] | 12 | CONFIG_STANDALONE_LOAD_ADDR ?= 0x1000 -m elf32bfin |
Mike Frysinger | 262ae0a | 2009-09-03 23:12:47 -0400 | [diff] [blame] | 13 | |
Mike Frysinger | fbcf8e8 | 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 | 9e41403 | 2014-02-04 17:24:24 +0900 | [diff] [blame] | 17 | $(srctree)/include/configs/$(BOARD).h) |
Mike Frysinger | fbcf8e8 | 2010-12-23 14:58:37 -0500 | [diff] [blame] | 18 | else |
Masahiro Yamada | a8c0754 | 2013-12-05 15:08:31 +0900 | [diff] [blame] | 19 | CONFIG_BFIN_CPU := $(strip $(CONFIG_BFIN_CPU:"%"=%)) |
Mike Frysinger | fbcf8e8 | 2010-12-23 14:58:37 -0500 | [diff] [blame] | 20 | endif |
Masahiro Yamada | a8c0754 | 2013-12-05 15:08:31 +0900 | [diff] [blame] | 21 | CONFIG_BFIN_BOOT_MODE := $(strip $(CONFIG_BFIN_BOOT_MODE:"%"=%)) |
Mike Frysinger | 9171fc8 | 2008-03-30 15:46:13 -0400 | [diff] [blame] | 22 | |
Robin Getz | c4db335 | 2009-08-17 15:23:02 +0000 | [diff] [blame] | 23 | PLATFORM_RELFLAGS += -ffixed-P3 -fomit-frame-pointer -mno-fdpic |
Mike Frysinger | 0858b83 | 2008-02-04 19:26:55 -0500 | [diff] [blame] | 24 | |
Haiying Wang | 6dc1eceb | 2011-02-22 16:38:05 -0500 | [diff] [blame] | 25 | LDFLAGS_FINAL += --gc-sections |
Nobuhiro Iwamatsu | 8aba9dc | 2011-01-06 10:23:54 +0900 | [diff] [blame] | 26 | LDFLAGS += -m elf32bfin |
Mike Frysinger | 6957a62 | 2008-10-24 18:18:16 -0400 | [diff] [blame] | 27 | PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections |
| 28 | |
Mike Frysinger | f7ce12c | 2008-02-18 05:26:48 -0500 | [diff] [blame] | 29 | PLATFORM_RELFLAGS += -mcpu=$(CONFIG_BFIN_CPU) |
Mike Frysinger | f7ce12c | 2008-02-18 05:26:48 -0500 | [diff] [blame] | 30 | |
Mike Frysinger | 3e88337 | 2009-06-15 00:25:19 -0400 | [diff] [blame] | 31 | ifneq ($(CONFIG_BFIN_BOOT_MODE),BFIN_BOOT_BYPASS) |
Masahiro Yamada | 9e41403 | 2014-02-04 17:24:24 +0900 | [diff] [blame] | 32 | ALL-y += u-boot.ldr |
Mike Frysinger | 3e88337 | 2009-06-15 00:25:19 -0400 | [diff] [blame] | 33 | endif |
Mike Frysinger | 76d8218 | 2009-07-21 22:17:36 -0400 | [diff] [blame] | 34 | ifeq ($(CONFIG_ENV_IS_EMBEDDED_IN_LDR),y) |
Masahiro Yamada | 9e41403 | 2014-02-04 17:24:24 +0900 | [diff] [blame] | 35 | CREATE_LDR_ENV = tools/envcrc --binary > env-ldr.o |
Mike Frysinger | e29ad97 | 2011-11-02 23:49:03 -0400 | [diff] [blame] | 36 | HOSTCFLAGS_NOPED_ADSP := \ |
Mike Frysinger | 48c00fe | 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 | e29ad97 | 2011-11-02 23:49:03 -0400 | [diff] [blame] | 39 | HOSTCFLAGS_NOPED += $(HOSTCFLAGS_NOPED_ADSP) |
Mike Frysinger | 76d8218 | 2009-07-21 22:17:36 -0400 | [diff] [blame] | 40 | else |
| 41 | CREATE_LDR_ENV = |
| 42 | endif |
Mike Frysinger | 3e88337 | 2009-06-15 00:25:19 -0400 | [diff] [blame] | 43 | |
Mike Frysinger | 0858b83 | 2008-02-04 19:26:55 -0500 | [diff] [blame] | 44 | SYM_PREFIX = _ |
Masahiro Yamada | 026f9cf | 2014-03-05 16:59:40 +0900 | [diff] [blame] | 45 | export SYM_PREFIX |
Mike Frysinger | 94a91e2 | 2008-02-04 19:26:57 -0500 | [diff] [blame] | 46 | |
Mike Frysinger | 02778f2 | 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 | 746290d | 2008-08-07 18:55:30 -0400 | [diff] [blame] | 50 | LDR_FLAGS += --bmode $(subst BFIN_BOOT_,,$(CONFIG_BFIN_BOOT_MODE)) |
Mike Frysinger | 94a91e2 | 2008-02-04 19:26:57 -0500 | [diff] [blame] | 51 | LDR_FLAGS += --use-vmas |
Masahiro Yamada | 9e41403 | 2014-02-04 17:24:24 +0900 | [diff] [blame] | 52 | LDR_FLAGS += --initcode $(CPUDIR)/initcode.o |
Mike Frysinger | 67c2829 | 2008-10-06 04:42:33 -0400 | [diff] [blame] | 53 | ifneq ($(CONFIG_BFIN_BOOT_MODE),BFIN_BOOT_UART) |
Mike Frysinger | 76d8218 | 2009-07-21 22:17:36 -0400 | [diff] [blame] | 54 | LDR_FLAGS-$(CONFIG_ENV_IS_EMBEDDED_IN_LDR) += \ |
Masahiro Yamada | 9e41403 | 2014-02-04 17:24:24 +0900 | [diff] [blame] | 55 | --punchit $$(($(CONFIG_ENV_OFFSET))):$$(($(CONFIG_ENV_SIZE))):env-ldr.o |
Mike Frysinger | 67c2829 | 2008-10-06 04:42:33 -0400 | [diff] [blame] | 56 | endif |
Mike Frysinger | f7ce12c | 2008-02-18 05:26:48 -0500 | [diff] [blame] | 57 | ifneq (,$(findstring s,$(MAKEFLAGS))) |
Mike Frysinger | 94a91e2 | 2008-02-04 19:26:57 -0500 | [diff] [blame] | 58 | LDR_FLAGS += --quiet |
| 59 | endif |
Mike Frysinger | 02778f2 | 2009-04-24 23:39:41 -0400 | [diff] [blame] | 60 | |
| 61 | LDR_FLAGS += $(LDR_FLAGS-y) |
Mike Frysinger | 9ff67e5 | 2009-06-14 06:29:07 -0400 | [diff] [blame] | 62 | |
Mike Frysinger | ec4c693 | 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 | fbb21ff | 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 |