blob: c6c3c745ec5ca28a8322afc6c65e0633727108de [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
Marek Vasuta0603a32012-10-19 05:00:10 +000035LSTSCRIPT= $(nandobj)/board/$(BOARDDIR)/u-boot.lst
Dipen Dudhat2f143ed2011-07-28 14:47:28 -050036LDFLAGS := -T $(nandobj)u-boot-nand_spl.lds -Ttext $(CONFIG_SYS_TEXT_BASE_SPL) $(LDFLAGS) \
37 $(LDFLAGS_FINAL)
38AFLAGS += -DCONFIG_NAND_SPL
39CFLAGS += -DCONFIG_NAND_SPL
40
41SOBJS = start.o resetvec.o ticks.o
42COBJS = cache.o cpu_init_early.o cpu_init_nand.o fsl_law.o law.o \
Matthew McClintock4a71d582012-08-13 13:21:19 +000043 nand_boot.o nand_boot_fsl_ifc.o ns16550.o tlb.o tlb_table.o \
44 ../common.o
Dipen Dudhat2f143ed2011-07-28 14:47:28 -050045
46SRCS := $(addprefix $(obj),$(SOBJS:.o=.S) $(COBJS:.o=.c))
47OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS))
48__OBJS := $(SOBJS) $(COBJS)
49LNDIR := $(nandobj)board/$(BOARDDIR)
50
51ALL = $(nandobj)u-boot-spl $(nandobj)u-boot-spl.bin $(nandobj)u-boot-spl-16k.bin
52
53all: $(obj).depend $(ALL)
54
55$(nandobj)u-boot-spl-16k.bin: $(nandobj)u-boot-spl
56 $(OBJCOPY) ${OBJCFLAGS} --pad-to=$(PAD_TO) -O binary $< $@
57
58$(nandobj)u-boot-spl.bin: $(nandobj)u-boot-spl
59 $(OBJCOPY) ${OBJCFLAGS} -O binary $< $@
60
61$(nandobj)u-boot-spl: $(OBJS) $(nandobj)u-boot-nand_spl.lds
62 cd $(LNDIR) && $(LD) $(LDFLAGS) $(__OBJS) $(PLATFORM_LIBS) \
63 -Map $(nandobj)u-boot-spl.map \
64 -o $(nandobj)u-boot-spl
65
Marek Vasuta0603a32012-10-19 05:00:10 +000066# The following line expands into whole rule which generates $(LSTSCRIPT),
67# the file containing u-boots LG-array linker section. This is included into
68# $(LDSCRIPT). The function make_u_boot_list is defined in helper.mk file.
69$(eval $(call make_u_boot_list, $(LSTSCRIPT), $(OBJS)))
70$(nandobj)u-boot-nand_spl.lds: $(LDSCRIPT) $(LSTSCRIPT)
Scott Wood67de9572012-11-13 12:30:39 +000071 $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -I$(nandobj)board/$(BOARDDIR) \
72 -ansi -D__ASSEMBLY__ -P - <$< >$@
Dipen Dudhat2f143ed2011-07-28 14:47:28 -050073
74# create symbolic links for common files
75
76$(obj)cache.c:
77 @rm -f $(obj)cache.c
78 ln -sf $(SRCTREE)/arch/powerpc/lib/cache.c $(obj)cache.c
79
80$(obj)cpu_init_early.c:
81 @rm -f $(obj)cpu_init_early.c
82 ln -sf $(SRCTREE)/$(CPUDIR)/cpu_init_early.c $(obj)cpu_init_early.c
83
84$(obj)cpu_init_nand.c:
85 @rm -f $(obj)cpu_init_nand.c
86 ln -sf $(SRCTREE)/$(CPUDIR)/cpu_init_nand.c $(obj)cpu_init_nand.c
87
88$(obj)fsl_law.c:
89 @rm -f $(obj)fsl_law.c
Scott Wood3d488722012-08-17 16:17:50 -050090 ln -sf $(SRCTREE)/arch/powerpc/cpu/mpc8xxx/law.c $(obj)fsl_law.c
Dipen Dudhat2f143ed2011-07-28 14:47:28 -050091
92$(obj)law.c:
93 @rm -f $(obj)law.c
94 ln -sf $(SRCTREE)/board/$(BOARDDIR)/law.c $(obj)law.c
95
96$(obj)nand_boot_fsl_ifc.c:
97 @rm -f $(obj)nand_boot_fsl_ifc.c
98 ln -sf $(SRCTREE)/nand_spl/nand_boot_fsl_ifc.c \
99 $(obj)nand_boot_fsl_ifc.c
100
101$(obj)ns16550.c:
102 @rm -f $(obj)ns16550.c
103 ln -sf $(SRCTREE)/drivers/serial/ns16550.c $(obj)ns16550.c
104
105$(obj)resetvec.S:
106 @rm -f $(obj)resetvec.S
107 ln -s $(SRCTREE)/$(CPUDIR)/resetvec.S $(obj)resetvec.S
108
109$(obj)fixed_ivor.S:
110 @rm -f $(obj)fixed_ivor.S
111 ln -sf $(SRCTREE)/$(CPUDIR)/fixed_ivor.S $(obj)fixed_ivor.S
112
113$(obj)start.S: $(obj)fixed_ivor.S
114 @rm -f $(obj)start.S
115 ln -sf $(SRCTREE)/$(CPUDIR)/start.S $(obj)start.S
116
117$(obj)ticks.S:
118 @rm -f $(obj)ticks.S
119 ln -sf $(SRCTREE)/arch/powerpc/lib/ticks.S $(obj)ticks.S
120
121$(obj)tlb.c:
122 @rm -f $(obj)tlb.c
123 ln -sf $(SRCTREE)/$(CPUDIR)/tlb.c $(obj)tlb.c
124
125$(obj)tlb_table.c:
126 @rm -f $(obj)tlb_table.c
127 ln -sf $(SRCTREE)/board/$(BOARDDIR)/tlb.c $(obj)tlb_table.c
128
129ifneq ($(OBJTREE), $(SRCTREE))
130$(obj)nand_boot.c:
131 @rm -f $(obj)nand_boot.c
132 ln -s $(SRCTREE)/nand_spl/board/$(BOARDDIR)/nand_boot.c $(obj)nand_boot.c
Matthew McClintock4a71d582012-08-13 13:21:19 +0000133$(obj)../common.c:
134 @rm -f $(obj)../common.c
135 ln -s $(SRCTREE)/nand_spl/board/freescale/common.c $(obj)../common.c
Dipen Dudhat2f143ed2011-07-28 14:47:28 -0500136endif
137
138#########################################################################
139
140$(obj)%.o: $(obj)%.S
141 $(CC) $(AFLAGS) -c -o $@ $<
142
143$(obj)%.o: $(obj)%.c
144 $(CC) $(CFLAGS) -c -o $@ $<
145
146# defines $(obj).depend target
147include $(SRCTREE)/rules.mk
148
149sinclude $(obj).depend
150
151#########################################################################