599
|
1 |
# Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
2 |
# All rights reserved.
|
|
3 |
# This component and the accompanying materials are made available
|
|
4 |
# under the terms of "Eclipse Public License v1.0"
|
|
5 |
# which accompanies this distribution, and is available
|
|
6 |
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
7 |
#
|
|
8 |
# Initial Contributors:
|
|
9 |
# Nokia Corporation - initial contribution.
|
|
10 |
#
|
|
11 |
# Contributors:
|
|
12 |
#
|
|
13 |
# Description:
|
|
14 |
#
|
|
15 |
|
|
16 |
# To guarantee there is a slash at the end of EPOCROOT in case there is not.
|
|
17 |
# This is needed to ensure compatibility with SBSv1.
|
|
18 |
TMPROOT:=$(subst \,/,$(EPOCROOT))
|
|
19 |
EPOCROOT:=$(patsubst %/,%,$(TMPROOT))/
|
|
20 |
|
|
21 |
include $(EPOCROOT)epoc32/tools/shell/$(notdir $(basename $(SHELL))).mk
|
|
22 |
|
|
23 |
|
|
24 |
# Set the source directory
|
|
25 |
SRCDIR = $(EXTENSION_ROOT)/nandboot/miniboot
|
|
26 |
TARGETDIR = $(EPOCROOT)epoc32/release/$(PLATFORM_PATH)
|
|
27 |
EPOCINCDIR = $(EPOCROOT)epoc32/include/lubbock/nand
|
|
28 |
|
|
29 |
#Rules
|
|
30 |
vpath %.s $(SRCDIR)
|
|
31 |
vpath %.inc $(SRCDIR) $(EPOCINCDIR)
|
|
32 |
vpath %.ginc $(BUILDLOC)
|
|
33 |
|
|
34 |
# Build directory
|
|
35 |
BUILDLOC = $(EPOCBLD)$(call sbsadd,/base/lubbock)
|
|
36 |
|
|
37 |
## Set the target name
|
|
38 |
INCLUDES := nand.inc lubbock.inc
|
|
39 |
EPOCINCLUDES := nand_fbr_offset.inc
|
|
40 |
SRC := miniboot.s lubbock.s
|
|
41 |
TARGET=$(TARGETDIR)/lubbock_miniboot.bin
|
|
42 |
TMPTARGET = $(BUILDLOC)/miniboot.exe
|
|
43 |
|
|
44 |
# Set the code and data base addresses
|
|
45 |
# Since miniboot is PIC this is just to placate the linker
|
|
46 |
LINKBASE = 0x0000000
|
|
47 |
|
|
48 |
ARMASM_OUT := $(shell armasm 2>&1)
|
|
49 |
ARMASM_OUT_4 := $(word 4,$(ARMASM_OUT))
|
|
50 |
# Use GCC toolchain if no other is available
|
|
51 |
# NB! Need to keep updating/extending allowable range of RVCT versions!!
|
|
52 |
TOOLVER := GCC
|
|
53 |
RVCTSTR := $(strip $(findstring RVCT, $(ARMASM_OUT_4)))
|
|
54 |
ifeq "$(RVCTSTR)" "RVCT"
|
|
55 |
TOOLVER := RVCT
|
|
56 |
OP := --
|
|
57 |
OB := o
|
|
58 |
endif
|
|
59 |
|
|
60 |
ifeq "$(TOOLVER)" "RVCT"
|
|
61 |
ASM_MACROS += USE_CXSF
|
|
62 |
|
|
63 |
ASM := armasm
|
|
64 |
LINK := armlink
|
|
65 |
FROMELF := fromelf
|
|
66 |
OBJEXT := o
|
|
67 |
INCEXT := inc
|
|
68 |
|
|
69 |
ASMINCPATHCMD := $(foreach dir,$(SRCDIR),$(join -I ,$(dir))) $(foreach dir,$(EPOCINCDIR),$(join -I ,$(dir)))
|
|
70 |
ASMINCFBRPATH := $(foreach fir,$(EPOCINCDIR),$(join -I ,$(fir)))
|
|
71 |
ASM_MACRO_CMD := $(foreach macro,$(ASM_MACROS),$(OP)predefine "$(macro) SETL {TRUE}")
|
|
72 |
AFLAGS := -g $(OP)keep $(ASM_MACRO_CMD) $(ASMINCPATHCMD) $(ASMINCFBRPATH)
|
|
73 |
|
|
74 |
SYMOPT := $(OP)symdefs
|
|
75 |
ASMTYP := ARMASM
|
|
76 |
LINKFILE :=
|
|
77 |
define do_asm
|
|
78 |
$(ASM) $(AFLAGS) -$(OB) $@ $(OP)LIST $(join $(basename $@),.lst) $<
|
|
79 |
endef
|
|
80 |
|
|
81 |
LFLAGS := $(OP)ro-base $(LINKBASE) $(OP)entry $(LINKBASE) $(OP)map
|
|
82 |
|
|
83 |
define do_link
|
|
84 |
$(LINK) $(LFLAGS) -$(OB) $@ $(filter %.$(OBJEXT),$^)
|
|
85 |
endef
|
|
86 |
|
|
87 |
define do_strip
|
|
88 |
$(FROMELF) $(OP)bin $(OP)output $@ $<
|
|
89 |
endef
|
|
90 |
endif
|
|
91 |
|
|
92 |
|
|
93 |
#GCC build options
|
|
94 |
ifeq "$(TOOLVER)" "GCC"
|
|
95 |
ASM := as
|
|
96 |
AFLAGS := -mapcs-32 -R -n -I$(BUILDLOC)
|
|
97 |
|
|
98 |
LINKFLAGS = -n -x --section-alignment 4 --file-alignment 2 -no-whole-archive
|
|
99 |
OBJEXT := o
|
|
100 |
INCEXT := ginc
|
|
101 |
LINKFILE = $(SRCDIR)/miniboot.lnk
|
|
102 |
define do_headers
|
|
103 |
perl $(EPOCROOT)epoc32/tools/armasm2as.pl $< $@
|
|
104 |
endef
|
|
105 |
define do_asm
|
|
106 |
perl $(EPOCROOT)epoc32/tools/armasm2as.pl $< $(join $(basename $@),.s)
|
|
107 |
$(AS) $(AFLAGS) -o $@ $(join $(basename $@),.s)
|
|
108 |
endef
|
|
109 |
define do_link
|
|
110 |
ld -o "$(TMPTARGET)" --start $(FULLOBJECTS) --script=$(LINKFILE)
|
|
111 |
endef
|
|
112 |
define do_strip
|
|
113 |
strip -O binary -o "$(TARGET)" "$(TMPTARGET)"
|
|
114 |
$(ERASE) $(call slash2generic,"$(TMPTARGET)")
|
|
115 |
echo Built $(TARGET)
|
|
116 |
endef
|
|
117 |
PROCESS_INCLUDES := 1
|
|
118 |
endif
|
|
119 |
|
|
120 |
|
|
121 |
OBJECTS := $(foreach f,$(SRC),$(basename $(f)).$(OBJEXT))
|
|
122 |
|
|
123 |
FULLOBJECTS := $(addprefix $(BUILDLOC)/,$(OBJECTS))
|
|
124 |
|
|
125 |
|
|
126 |
#Include processing
|
|
127 |
FULLINCLUDES := $(addprefix $(SRCDIR)/,$(INCLUDES))
|
|
128 |
#Object processing
|
|
129 |
FULLSRC := $(addprefix $(SRCDIR)/,$(SRC))
|
|
130 |
|
|
131 |
ifdef PROCESS_INCLUDES
|
|
132 |
GCCSRC := $(addprefix $(EPOCBLD)/,$(SRC))
|
|
133 |
FULLINCLUDES := $(foreach f,$(FULLINCLUDES),$(basename $(f)).$(INCEXT))
|
|
134 |
|
|
135 |
EPOCFULLINCLUDES := $(foreach f,$(EPOCINCLUDES),$(basename $(f)).$(INCEXT))
|
|
136 |
EPOCFULLINCLUDES := $(addprefix $(BUILDLOC)/,$(EPOCFULLINCLUDES))
|
|
137 |
|
|
138 |
|
|
139 |
#Creation of headers
|
|
140 |
$(FULLINCLUDES) : $(SRCDIR)/%.$(INCEXT) : %.inc
|
|
141 |
$(do_headers)
|
|
142 |
$(EPOCFULLINCLUDES) : $(BUILDLOC)/%.$(INCEXT) : %.inc
|
|
143 |
$(do_headers)
|
|
144 |
|
|
145 |
else
|
|
146 |
|
|
147 |
#Armasm sytax specifc asm rule goes here
|
|
148 |
|
|
149 |
EPOCFULLINCLUDES:= $(addprefix $(EPOCINCDIR)/,$(EPOCINCLUDES))
|
|
150 |
endif
|
|
151 |
|
|
152 |
|
|
153 |
#Strip
|
|
154 |
$(call abldquote,$(TARGET)) : $(call abldquote,$(TMPTARGET)) $(call pipe,$(TARGETDIR) $(BUILDLOC))
|
|
155 |
$(do_strip)
|
|
156 |
|
|
157 |
#Link
|
|
158 |
$(call abldquote,$(TMPTARGET)) : $(FULLOBJECTS)
|
|
159 |
$(do_link)
|
|
160 |
|
|
161 |
#Objects
|
|
162 |
$(FULLOBJECTS) : $(BUILDLOC)/%.$(OBJEXT) : %.s $(FULLINCLUDES) $(EPOCFULLINCLUDES) $(call pipe,$(BUILDLOC))
|
|
163 |
$(do_asm)
|
|
164 |
|
|
165 |
# make directories
|
|
166 |
$(call abldquote,$(TARGETDIR)) :
|
|
167 |
@$(call ifnotexistd,"$(TARGETDIR)")
|
|
168 |
|
|
169 |
$(call abldquote,$(BUILDLOC)) :
|
|
170 |
@$(call ifnotexistd,"$(BUILDLOC)")
|
|
171 |
|
|
172 |
$(EPOCBLD) :
|
|
173 |
@$(call ifnotexistd,"$(EPOCBLD)")
|
|
174 |
|
|
175 |
|
|
176 |
MAKMAKE :
|
|
177 |
echo Nothing to do
|
|
178 |
echo $(BUILDLOC)
|
|
179 |
|
|
180 |
FREEZE :
|
|
181 |
echo Nothing to do
|
|
182 |
echo $(BUILDLOC)
|
|
183 |
|
|
184 |
LIB :
|
|
185 |
echo Nothing to do
|
|
186 |
echo $(BUILDLOC)
|
|
187 |
|
|
188 |
CLEANLIB :
|
|
189 |
echo Nothing to do
|
|
190 |
echo $(BUILDLOC)
|
|
191 |
|
|
192 |
RESOURCE :
|
|
193 |
echo Nothing to do
|
|
194 |
echo $(BUILDLOC)
|
|
195 |
|
|
196 |
FINAL :
|
|
197 |
echo Nothing to do
|
|
198 |
echo $(BUILDLOC)
|
|
199 |
|
|
200 |
|
|
201 |
|
|
202 |
BLD SAVESPACE : $(call abldquote,$(TARGETDIR)) $(EPOCBLD) $(call abldquote,$(TARGET)) $(call sbsadd,$(BUILDLOC))
|
|
203 |
|
|
204 |
RELEASABLES :
|
|
205 |
@echo "$(TARGET)"
|
|
206 |
|
|
207 |
CLEAN :
|
|
208 |
-$(ERASE) $(call slash2generic,"$(TARGET)")
|
|
209 |
-$(ERASE) $(call slash2generic,"$(EPOCBLD)/*.*")
|
|
210 |
# -$(ERASE) "$(TARGET)"
|
|
211 |
# -$(ERASE) "$(EPOCBLD)/*.*"
|
|
212 |
|