blob: f7bdf9207d14674ced54773703cc190068f392bc [file] [log] [blame]
Dipen Dudhat2f143ed2011-07-28 14:47:28 -05001#
2# (C) Copyright 2007
3# Stefan Roese, DENX Software Engineering, sr@denx.de.
4#
5# Copyright 2011 Freescale Semiconductor, Inc.
6#
7# See file CREDITS for list of people who contributed to this
8# project.
9#
10# This program is free software; you can redistribute it and/or
11# modify it under the terms of the GNU General Public License as
12# published by the Free Software Foundation; either version 2 of
13# the License, or (at your option) any later version.
14#
15# This program is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18# GNU General Public License for more details.
19#
20# You should have received a copy of the GNU General Public License
21# along with this program; if not, write to the Free Software
22# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
23# MA 02111-1307 USA
24#
25
26NAND_SPL := y
27CONFIG_SYS_TEXT_BASE_SPL := 0xff800000
28PAD_TO := 0xff802000
29
30include $(TOPDIR)/config.mk
31
32nandobj := $(OBJTREE)/nand_spl/
33
34LDSCRIPT= $(TOPDIR)/$(CPUDIR)/u-boot-nand_spl.lds
35LDFLAGS := -T $(nandobj)u-boot-nand_spl.lds -Ttext $(CONFIG_SYS_TEXT_BASE_SPL) $(LDFLAGS) \
36 $(LDFLAGS_FINAL)
37AFLAGS += -DCONFIG_NAND_SPL
38CFLAGS += -DCONFIG_NAND_SPL
39
40SOBJS = start.o resetvec.o ticks.o
Scott Wood5847d782012-09-20 16:35:21 -050041COBJS = cache.o cpu_init_early.o spl_minimal.o fsl_law.o law.o \
Scott Woodfac86242012-08-17 19:46:29 -050042 nand_boot.o nand_boot_fsl_ifc.o ns16550.o tlb.o tlb_table.o
Dipen Dudhat2f143ed2011-07-28 14:47:28 -050043
44SRCS := $(addprefix $(obj),$(SOBJS:.o=.S) $(COBJS:.o=.c))
45OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
46__OBJS := $(SOBJS) $(COBJS)
47LNDIR := $(nandobj)board/$(BOARDDIR)
48
49ALL = $(nandobj)u-boot-spl $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin
50
51all: $(obj).depend $(ALL)
52
53$(nandobj)u-boot-spl-16k.bin: $(nandobj)u-boot-spl
54 $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary $< $@
55
56$(nandobj)u-boot-spl.bin: $(nandobj)u-boot-spl
57 $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
58
59$(nandobj)u-boot-spl: $(OBJS) $(nandobj)u-boot-nand_spl.lds
60 cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) $(PLATFORM_LIBS) \
61 -Map $(nandobj)u-boot-spl.map \
62 -o $(nandobj)u-boot-spl
63
Albert ARIBAUDc24895e2013-02-25 00:59:00 +000064$(nandobj)u-boot-nand_spl.lds: $(LDSCRIPT)
Scott Wood67de9572012-11-13 12:30:39 +000065 $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -I$(nandobj)board/$(BOARDDIR) \
66 -ansi -D__ASSEMBLY__ -P - <$< >$@
Dipen Dudhat2f143ed2011-07-28 14:47:28 -050067
68# create symbolic links for common files
69
70$(obj)cache.c:
71 @rm -f $(obj)cache.c
72 ln -sf $(SRCTREE)/arch/powerpc/lib/cache.c $(obj)cache.c
73
74$(obj)cpu_init_early.c:
75 @rm -f $(obj)cpu_init_early.c
76 ln -sf $(SRCTREE)/$(CPUDIR)/cpu_init_early.c $(obj)cpu_init_early.c
77
Scott Wood5847d782012-09-20 16:35:21 -050078$(obj)spl_minimal.c:
79 @rm -f $(obj)spl_minimal.c
80 ln -sf $(SRCTREE)/$(CPUDIR)/spl_minimal.c $(obj)spl_minimal.c
Dipen Dudhat2f143ed2011-07-28 14:47:28 -050081
82$(obj)fsl_law.c:
83 @rm -f $(obj)fsl_law.c
Scott Wood3d488722012-08-17 16:17:50 -050084 ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc8xxx/law.c $(obj)fsl_law.c
Dipen Dudhat2f143ed2011-07-28 14:47:28 -050085
86$(obj)law.c:
87 @rm -f $(obj)law.c
88 ln -sf $(SRCTREE)/board/$(BOARDDIR)/law.c $(obj)law.c
89
90$(obj)nand_boot_fsl_ifc.c:
91 @rm -f $(obj)nand_boot_fsl_ifc.c
92 ln -sf $(SRCTREE)/nand_spl/nand_boot_fsl_ifc.c \
93 $(obj)nand_boot_fsl_ifc.c
94
95$(obj)ns16550.c:
96 @rm -f $(obj)ns16550.c
97 ln -sf $(SRCTREE)/drivers/serial/ns16550.c $(obj)ns16550.c
98
99$(obj)resetvec.S:
100 @rm -f $(obj)resetvec.S
101 ln -s $(SRCTREE)/$(CPUDIR)/resetvec.S $(obj)resetvec.S
102
103$(obj)fixed_ivor.S:
104 @rm -f $(obj)fixed_ivor.S
105 ln -sf $(SRCTREE)/$(CPUDIR)/fixed_ivor.S $(obj)fixed_ivor.S
106
107$(obj)start.S: $(obj)fixed_ivor.S
108 @rm -f $(obj)start.S
109 ln -sf $(SRCTREE)/$(CPUDIR)/start.S $(obj)start.S
110
111$(obj)ticks.S:
112 @rm -f $(obj)ticks.S
113 ln -sf $(SRCTREE)/arch/powerpc/lib/ticks.S $(obj)ticks.S
114
115$(obj)tlb.c:
116 @rm -f $(obj)tlb.c
117 ln -sf $(SRCTREE)/$(CPUDIR)/tlb.c $(obj)tlb.c
118
119$(obj)tlb_table.c:
120 @rm -f $(obj)tlb_table.c
121 ln -sf $(SRCTREE)/board/$(BOARDDIR)/tlb.c $(obj)tlb_table.c
122
123ifneq ($(OBJTREE), $(SRCTREE))
124$(obj)nand_boot.c:
125 @rm -f $(obj)nand_boot.c
126 ln -s $(SRCTREE)/nand_spl/board/$(BOARDDIR)/nand_boot.c $(obj)nand_boot.c
Dipen Dudhat2f143ed2011-07-28 14:47:28 -0500127endif
128
129#########################################################################
130
131$(obj)%.o: $(obj)%.S
132 $(CC) $(AFLAGS) -c -o $@ $<
133
134$(obj)%.o: $(obj)%.c
135 $(CC) $(CFLAGS) -c -o $@ $<
136
137# defines $(obj).depend target
138include $(SRCTREE)/rules.mk
139
140sinclude $(obj).depend
141
142#########################################################################