Makefile 8.64 KB
Newer Older
Neil Turton's avatar
Neil Turton committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
# Copyright 1996 Acorn Computers Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Makefile for Kernel
#

18
COMPONENT       = Kernel
19 20 21 22 23

ifeq (${MAKECMDGOALS},install)
EXP_HDR         = ${INSTDIR}.Hdr.Interface
C_EXP_HDR       = ${INSTDIR}.C.Global.h
else
24
C_EXP_HDR       = <cexport$dir>.Global.h
25 26
endif

Jeffrey Lee's avatar
Jeffrey Lee committed
27 28 29 30 31 32 33
# Keep SyncLib out of the kernel for now:
# 1. We're cheating a bit by using an app build of SyncLib, which means the few
#    C bits will be performing stack limit checking & extension
# 2. We don't have a way of unlocking mutexes/spinlocks when recovering from
#    aborts
USE_SYNCLIB    ?= FALSE

34 35
TOKHELPSRC      = ${TOKENSOURCE}
HELPSRC         = HelpStrs
Jeffrey Lee's avatar
Jeffrey Lee committed
36
OBJS            = GetAll
37
KERNEL_MODULE   = bin${SEP}${COMPONENT}
Jeffrey Lee's avatar
Jeffrey Lee committed
38 39
ASFLAGS        += -PD "FreezeDevRel SETL {${FREEZE_DEV_REL}}" -PD "USE_SYNCLIB SETL {${USE_SYNCLIB}}"
CFLAGS         += -ff -APCS 3/32bit/nofp/noswst -DKERNEL
40 41
CUSTOMROM       = custom
CUSTOMEXP       = custom
42
CUSTOMSA        = custom
43 44
EXPORTS         = ${EXP_HDR}.AMBControl \
                  ${EXP_HDR}.DBellDevice \
Jeffrey Lee's avatar
Jeffrey Lee committed
45
                  ${EXP_HDR}.EnvNumbers \
46 47
                  ${EXP_HDR}.HALDevice \
                  ${EXP_HDR}.HALEntries \
48
                  ${EXP_HDR}.ModHand \
49
                  ${EXP_HDR}.OSEntries \
50
                  ${EXP_HDR}.OSMem \
51
                  ${EXP_HDR}.OSMisc \
52 53
                  ${EXP_HDR}.OSRSI6 \
                  ${EXP_HDR}.PL310 \
54 55 56 57 58
                  ${EXP_HDR}.PublicWS \
                  ${EXP_HDR}.RISCOS \
                  ${EXP_HDR}.Variables \
                  ${EXP_HDR}.VduExt \
                  ${EXP_HDR}.VIDCList \
59
                  ${EXP_HDR}.VideoDevice \
60
                  ${C_EXP_HDR}.HALDevice \
61 62
                  ${C_EXP_HDR}.HALEntries \
                  ${C_EXP_HDR}.ModHand \
63
                  ${C_EXP_HDR}.OSEntries \
64
                  ${C_EXP_HDR}.OSMem \
65
                  ${C_EXP_HDR}.OSMisc \
66
                  ${C_EXP_HDR}.OSRSI6 \
67 68
                  ${C_EXP_HDR}.RISCOS \
                  ${C_EXP_HDR}.Variables \
69 70
                  ${C_EXP_HDR}.VduExt \
                  ${C_EXP_HDR}.VIDCList
Jeffrey Lee's avatar
Jeffrey Lee committed
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
ifeq (${USE_SYNCLIB},TRUE)
CFLAGS	       += -DUSE_SYNCLIB
LIBS            = ${SYNCLIB}
endif

#
# AbortTrap:
#
VPATH += aborttrap
OBJS += aborttrap atarm atcontext atinstr aterrors atmem

DECGEN = <Tools$Dir>.Misc.decgen.decgen

# Work out which instructions to include support for; this is just to reduce
# code size, and doesn't affect the handling of the instructions
# Note that FPA is only included in IOMD builds
ABORTTRAP_ACTIONS_ARM = ARMv3 ARMv4 ARMv5TE ARMv6 ARMv6K ARMv6T2 ARMv8 VFP ASIMD

ABORTTRAP_ENCODINGS_ARM = Build:decgen.encodings.ARMv7 \
                          Build:decgen.encodings.ARMv7_ASIMD \
                          Build:decgen.encodings.ARMv7_VFP \
                          Build:decgen.encodings.ARMv8_AArch32 \
                          Build:decgen.encodings.FPA

ifneq (,$(findstring $(MACHINE),IOMD))
ABORTTRAP_ACTIONS_ARM = ARMv3 ARMv4 FPA
endif
ifneq (,$(findstring $(MACHINE),Tungsten))
ABORTTRAP_ACTIONS_ARM = ARMv3 ARMv4 ARMv5TE
endif
ifneq (,$(findstring $(MACHINE),ARM11ZF))
ABORTTRAP_ACTIONS_ARM = ARMv3 ARMv4 ARMv5TE ARMv6 ARMv6K VFP
endif
ifneq (,$(findstring $(MACHINE),CortexA7 CortexA8 CortexA9))
ABORTTRAP_ACTIONS_ARM = ARMv3 ARMv4 ARMv5TE ARMv6 ARMv6K ARMv6T2 VFP ASIMD
endif

ABORTTRAP_ACTIONS = ${ABORTTRAP_ACTIONS_ARM}

Jeffrey Lee's avatar
Jeffrey Lee committed
110 111 112 113
# Have decgen use a pre-warmed cache file to speed up decoder generation. Please
# remember to submit the files if they change!
ABORTTRAP_CACHE = $(subst $(subst x,,x x),_,$(strip ${ABORTTRAP_ACTIONS_ARM}))

Jeffrey Lee's avatar
Jeffrey Lee committed
114
CFLAGS += $(addprefix -DABORTTRAP_,${ABORTTRAP_ACTIONS})
115 116 117

include StdTools
include AAsmModule
118
include StdRules
Jeffrey Lee's avatar
Jeffrey Lee committed
119 120 121
ifeq (${USE_SYNCLIB},TRUE)
include AppLibs
endif
Neil Turton's avatar
Neil Turton committed
122

123 124 125 126 127
# Override this to "TRUE" in the components file if
# you want an odd-numbered (development) build to be
# a 'freezable' build - e.g. with no ROM debug output
FREEZE_DEV_REL ?= FALSE

Jeffrey Lee's avatar
Jeffrey Lee committed
128 129 130 131 132 133 134 135 136 137 138 139
ROM_OBJECTS = $(addsuffix .o,${OBJS})

#
# AbortTrap:
#

clean ::
        @IfThere aborttrap.c.atarm     Then delete aborttrap.c.atarm

ABORTTRAP_ARM_DEPS = $(addprefix aborttrap.actions.,${ABORTTRAP_ACTIONS_ARM})

aborttrap.c.atarm: $(ABORTTRAP_ARM_DEPS) aborttrap.c.atpre $(ABORTTRAP_ENCODINGS_ARM)
Jeffrey Lee's avatar
Jeffrey Lee committed
140
        $(DECGEN) -bits=32 -e "-DCDP={ne(coproc,1)}" "-DLDC_STC={ne(coproc,1)}{ne(coproc,2)}" "-DMRC_MCR={ne(coproc,1)}" -DVFP1=(cond:4) "-DVFP2={ne(cond,15)}" -DAS1(X)=1111001[X] -DAS2=11110100 -DAS3=(cond:4)1110 "-DAS4={ne(cond,15)}" "-DCC={ne(cond,15)}" $(ABORTTRAP_ENCODINGS_ARM) -valid -a $(addprefix aborttrap/actions/,${ABORTTRAP_ACTIONS_ARM}) -default=DEFAULT -o aborttrap/atarm.c -name=aborttrap_arm -pre aborttrap/atpre.c -updatecache aborttrap/cache/${ABORTTRAP_CACHE}
Jeffrey Lee's avatar
Jeffrey Lee committed
141 142 143 144 145 146 147

o.atarm: aborttrap.c.atarm
	${CC} ${CFLAGS} -o $@ aborttrap.c.atarm

od.atarm: aborttrap.c.atarm
	${CC} $(filter-out ${C_NO_FNAMES},${CFLAGS}) ${CDFLAGS} -o $@ aborttrap.c.atarm

Neil Turton's avatar
Neil Turton committed
148
#
149
# Custom ROM:
Neil Turton's avatar
Neil Turton committed
150
#
151 152
rom: ${KERNEL_MODULE}
	@${ECHO} ${COMPONENT}: rom module built
Neil Turton's avatar
Neil Turton committed
153

154 155 156 157 158
install_rom: ${KERNEL_MODULE}
	${CP} ${KERNEL_MODULE} ${INSTDIR}${SEP}${TARGET} ${CPFLAGS}
	${CP} ${KERNEL_MODULE}_gpa ${INSTDIR}${SEP}${TARGET}_gpa ${CPFLAGS}
	@${ECHO} ${COMPONENT}: rom module installed

159 160 161 162 163 164 165
inst_dirs:
	${MKDIR} ${EXP_HDR}
	${MKDIR} ${C_EXP_HDR}

install: ${EXPORTS} inst_dirs
	@${ECHO} ${COMPONENT}: header files installed

Jeffrey Lee's avatar
Jeffrey Lee committed
166
${KERNEL_MODULE}: ${ROM_OBJECTS} ${DIRS} ${LIBS} kstrip
167
	${MKDIR} bin
168
	SetEval KernelBase "4" + STR ( 227858432 + ( HALSize LEFT ( LEN HALSize - 1 ) ) * 1024 )
Jeffrey Lee's avatar
Jeffrey Lee committed
169 170
	Do ${LD} -aif -base <KernelBase> -RW-base 0xff000000 -bin -d -o ${KERNEL_MODULE}_aif ${ROM_OBJECTS} ${LIBS}
	Do kstrip ${KERNEL_MODULE}_aif ${KERNEL_MODULE}
171
	${TOGPA} -s ${KERNEL_MODULE}_aif ${KERNEL_MODULE}_gpa
Neil Turton's avatar
Neil Turton committed
172

173 174
GetAll.o: ${TOKHELPSRC}

Neil Turton's avatar
Neil Turton committed
175
#
176
# Custom exports:
Neil Turton's avatar
Neil Turton committed
177 178
#
export: ${EXPORTS}
179
	@${ECHO} ${COMPONENT}: export complete
180

181 182 183
${EXP_HDR}.AMBControl: hdr.AMBControl
	${CP} hdr.AMBControl $@ ${CPFLAGS}

Neil Turton's avatar
Neil Turton committed
184 185
${EXP_HDR}.EnvNumbers: hdr.EnvNumbers
	${CP} hdr.EnvNumbers $@ ${CPFLAGS}
186

Jeffrey Lee's avatar
Jeffrey Lee committed
187 188 189
${EXP_HDR}.DBellDevice: hdr.DBellDevice
	${CP} hdr.DBellDevice $@ ${CPFLAGS}

190 191
${EXP_HDR}.HALDevice: hdr.HALDevice
	${CP} hdr.HALDevice $@ ${CPFLAGS}
192

193 194
${EXP_HDR}.HALEntries: hdr.HALEntries
	${CP} hdr.HALEntries $@ ${CPFLAGS}
Neil Turton's avatar
Neil Turton committed
195 196 197

${EXP_HDR}.ModHand: hdr.ModHand
	${CP} hdr.ModHand $@ ${CPFLAGS}
198

199 200
${EXP_HDR}.OSEntries: hdr.OSEntries
	${CP} hdr.OSEntries $@ ${CPFLAGS}
201

202 203 204
${EXP_HDR}.OSMem: hdr.OSMem
	${CP} hdr.OSMem $@ ${CPFLAGS}

205 206
${EXP_HDR}.OSMisc: hdr.OSMisc
	${CP} hdr.OSMisc $@ ${CPFLAGS}
207

208 209 210 211 212
${EXP_HDR}.OSRSI6: hdr.OSRSI6
	${CP} hdr.OSRSI6 $@ ${CPFLAGS}

${EXP_HDR}.PL310: hdr.PL310
	${CP} hdr.PL310 $@ ${CPFLAGS}
Neil Turton's avatar
Neil Turton committed
213 214 215 216 217 218 219

${EXP_HDR}.PublicWS: hdr.PublicWS
	${CP} hdr.PublicWS $@ ${CPFLAGS}

${EXP_HDR}.RISCOS: hdr.RISCOS
	${CP} hdr.RISCOS $@ ${CPFLAGS}

220 221 222
${EXP_HDR}.Variables: hdr.Variables
	${CP} hdr.Variables $@ ${CPFLAGS}

Neil Turton's avatar
Neil Turton committed
223 224 225
${EXP_HDR}.VduExt: hdr.VduExt
	${CP} hdr.VduExt $@ ${CPFLAGS}

226 227
${EXP_HDR}.VIDCList: hdr.VIDCList
	${CP} hdr.VIDCList $@ ${CPFLAGS}
228

Jeffrey Lee's avatar
Jeffrey Lee committed
229 230
${EXP_HDR}.VideoDevice: hdr.VideoDevice
	${CP} hdr.VideoDevice $@ ${CPFLAGS}
231 232 233 234 235 236 237

${C_EXP_HDR}.HALDevice: Global.h.HALDevice h.HALDevice
	${FAPPEND} $@ h.HALDevice Global.h.HALDevice

${C_EXP_HDR}.HALEntries: hdr.HALEntries
	${MKDIR} ${C_EXP_HDR}
	${HDR2H} hdr.HALEntries $@
238

239 240
${C_EXP_HDR}.ModHand: hdr.ModHand
	${MKDIR} ${C_EXP_HDR}
241
	${HDR2H} hdr.ModHand $@
242

243 244 245
${C_EXP_HDR}.OSEntries: Global.h.OSEntries h.OSEntries
	${FAPPEND} $@ h.OSEntries Global.h.OSEntries

246 247 248 249
${C_EXP_HDR}.OSMem: hdr.OSMem
	${MKDIR} ${C_EXP_HDR}
	${HDR2H} hdr.OSMem $@

250 251 252 253
${C_EXP_HDR}.OSMisc: hdr.OSMisc
	${MKDIR} ${C_EXP_HDR}
	${HDR2H} hdr.OSMisc $@

254
${C_EXP_HDR}.OSRSI6: hdr.OSRSI6
255
	${MKDIR} ${C_EXP_HDR}
256
	${HDR2H} hdr.OSRSI6 $@
Neil Turton's avatar
Neil Turton committed
257

258
${C_EXP_HDR}.RISCOS: hdr.RISCOS
Kevin Bracey's avatar
Kevin Bracey committed
259
	${MKDIR} ${C_EXP_HDR}
260
	${HDR2H} hdr.RISCOS $@
261

262 263
${C_EXP_HDR}.Variables: hdr.Variables
	${MKDIR} ${C_EXP_HDR}
264
	${HDR2H} hdr.Variables $@
265

266 267
${C_EXP_HDR}.VduExt: hdr.VduExt
	${MKDIR} ${C_EXP_HDR}
268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287
	${HDR2H} hdr.VduExt $@

${C_EXP_HDR}.VIDCList: Global.h.VIDCList h.VIDCList
	${FAPPEND} $@ h.VIDCList Global.h.VIDCList

Global.h.HALDevice: hdr.HALDevice
	${MKDIR} Global.h
	${HDR2H} hdr.HALDevice $@

Global.h.OSEntries: hdr.OSEntries
	${MKDIR} Global.h
	${HDR2H} hdr.OSEntries $@

Global.h.VIDCList: hdr.VIDCList
	${MKDIR} Global.h
	${HDR2H} hdr.VIDCList $@

clean::
	${XWIPE} Global ${WFLAGS}
	${XWIPE} bin    ${WFLAGS}
Jeffrey Lee's avatar
Jeffrey Lee committed
288 289 290 291
	${RM} kstrip

kstrip: kstrip.c
	${MAKE} -f kstrip/mk COMPONENT=kstrip THROWBACK=${THROWBACK}
Ben Avison's avatar
Ben Avison committed
292

Neil Turton's avatar
Neil Turton committed
293
# Dynamic dependencies: