blob: 20459c92e26ed92f536ea6e8ab9716bd8425c6ae [file] [log] [blame]
Stefan Roese23d8d342007-06-06 11:42:13 +02001#
2# (C) Copyright 2007
3# Stefan Roese, DENX Software Engineering, sr@denx.de.
4#
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02005# SPDX-License-Identifier: GPL-2.0+
Stefan Roese23d8d342007-06-06 11:42:13 +02006#
7
8include $(TOPDIR)/config.mk
9include $(TOPDIR)/nand_spl/board/$(BOARDDIR)/config.mk
10
Wolfgang Denk29547c62011-03-31 16:26:29 -050011nandobj := $(OBJTREE)/nand_spl/
12
Stefan Roese23d8d342007-06-06 11:42:13 +020013LDSCRIPT= $(TOPDIR)/nand_spl/board/$(BOARDDIR)/u-boot.lds
Haiying Wang39358732011-02-22 16:38:05 -050014LDFLAGS := -T $(nandobj)u-boot.lds -Ttext $(CONFIG_SYS_TEXT_BASE) $(LDFLAGS) \
15 $(LDFLAGS_FINAL)
Stefan Roese23d8d342007-06-06 11:42:13 +020016AFLAGS += -DCONFIG_NAND_SPL
17CFLAGS += -DCONFIG_NAND_SPL
18
Stefan Roese41d11a82007-10-31 20:58:34 +010019SOBJS = start.o resetvec.o cache.o
Stefan Roese80d99a42007-06-19 16:42:31 +020020COBJS = gpio.o nand_boot.o nand_ecc.o memory.o ndfc.o pll.o
Stefan Roese23d8d342007-06-06 11:42:13 +020021
22SRCS := $(addprefix $(obj),$(SOBJS:.o=.S) $(COBJS:.o=.c))
23OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
24__OBJS := $(SOBJS) $(COBJS)
Wolfgang Denk29547c62011-03-31 16:26:29 -050025LNDIR := $(nandobj)board/$(BOARDDIR)
Stefan Roese23d8d342007-06-06 11:42:13 +020026
Stefan Roese80d99a42007-06-19 16:42:31 +020027ALL = $(nandobj)u-boot-spl $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin \
28 $(nandobj)System.map
Stefan Roese23d8d342007-06-06 11:42:13 +020029
30all: $(obj).depend $(ALL)
31
32$(nandobj)u-boot-spl-16k.bin: $(nandobj)u-boot-spl
33 $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary $< $@
34
35$(nandobj)u-boot-spl.bin: $(nandobj)u-boot-spl
36 $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
37
Wolfgang Denk18d46c02009-08-17 14:00:53 +020038$(nandobj)u-boot-spl: $(OBJS) $(nandobj)u-boot.lds
Scott Wood9d6b2272010-12-10 15:13:39 -060039 cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) $(PLATFORM_LIBS) \
Stefan Roese23d8d342007-06-06 11:42:13 +020040 -Map $(nandobj)u-boot-spl.map \
41 -o $(nandobj)u-boot-spl
42
Stefan Roese80d99a42007-06-19 16:42:31 +020043$(nandobj)System.map: $(nandobj)u-boot-spl
44 @$(NM) $< | \
45 grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
46 sort > $(nandobj)System.map
47
Wolfgang Denk18d46c02009-08-17 14:00:53 +020048$(nandobj)u-boot.lds: $(LDSCRIPT)
49 $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$^ >$@
50
Stefan Roese23d8d342007-06-06 11:42:13 +020051# create symbolic links for common files
52
53# from cpu directory
Stefan Roese41d11a82007-10-31 20:58:34 +010054$(obj)cache.S:
55 @rm -f $(obj)cache.S
Stefan Roese88fbf932010-04-15 16:07:28 +020056 ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/cache.S $(obj)cache.S
Stefan Roese41d11a82007-10-31 20:58:34 +010057
Stefan Roese23d8d342007-06-06 11:42:13 +020058$(obj)gpio.c:
59 @rm -f $(obj)gpio.c
Stefan Roese88fbf932010-04-15 16:07:28 +020060 ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/gpio.c $(obj)gpio.c
Stefan Roese23d8d342007-06-06 11:42:13 +020061
62$(obj)ndfc.c:
63 @rm -f $(obj)ndfc.c
Stefan Roese913fd052009-07-16 15:12:48 +020064 ln -s $(SRCTREE)/drivers/mtd/nand/ndfc.c $(obj)ndfc.c
Stefan Roese23d8d342007-06-06 11:42:13 +020065
66$(obj)resetvec.S:
67 @rm -f $(obj)resetvec.S
Stefan Roese88fbf932010-04-15 16:07:28 +020068 ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/resetvec.S $(obj)resetvec.S
Stefan Roese23d8d342007-06-06 11:42:13 +020069
70$(obj)start.S:
71 @rm -f $(obj)start.S
Stefan Roese88fbf932010-04-15 16:07:28 +020072 ln -s $(SRCTREE)/arch/powerpc/cpu/ppc4xx/start.S $(obj)start.S
Stefan Roese23d8d342007-06-06 11:42:13 +020073
74# from board directory
75$(obj)memory.c:
76 @rm -f $(obj)memory.c
77 ln -s $(SRCTREE)/board/amcc/acadia/memory.c $(obj)memory.c
78
Stefan Roese80d99a42007-06-19 16:42:31 +020079$(obj)pll.c:
80 @rm -f $(obj)pll.c
81 ln -s $(SRCTREE)/board/amcc/acadia/pll.c $(obj)pll.c
82
Stefan Roese23d8d342007-06-06 11:42:13 +020083# from nand_spl directory
84$(obj)nand_boot.c:
85 @rm -f $(obj)nand_boot.c
86 ln -s $(SRCTREE)/nand_spl/nand_boot.c $(obj)nand_boot.c
87
Marcel Ziswileraea68562007-12-30 03:30:46 +010088# from drivers/mtd/nand directory
Stefan Roese23d8d342007-06-06 11:42:13 +020089$(obj)nand_ecc.c:
90 @rm -f $(obj)nand_ecc.c
Jean-Christophe PLAGNIOL-VILLARD82ca9742007-11-24 21:26:56 +010091 ln -s $(SRCTREE)/drivers/mtd/nand/nand_ecc.c $(obj)nand_ecc.c
Stefan Roese23d8d342007-06-06 11:42:13 +020092
93#########################################################################
94
95$(obj)%.o: $(obj)%.S
96 $(CC) $(AFLAGS) -c -o $@ $<
97
98$(obj)%.o: $(obj)%.c
99 $(CC) $(CFLAGS) -c -o $@ $<
100
101# defines $(obj).depend target
102include $(SRCTREE)/rules.mk
103
104sinclude $(obj).depend
105
106#########################################################################