Makefile 8.54 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
# Keep SyncLib out of the kernel for now:
Jeffrey Lee's avatar
Jeffrey Lee committed
28
# 1. We don't have a way of unlocking mutexes/spinlocks when recovering from
Jeffrey Lee's avatar
Jeffrey Lee committed
29 30 31
#    aborts
USE_SYNCLIB    ?= FALSE

32 33
TOKHELPSRC      = ${TOKENSOURCE}
HELPSRC         = HelpStrs
Jeffrey Lee's avatar
Jeffrey Lee committed
34
OBJS            = GetAll
35
KERNEL_MODULE   = bin${SEP}${COMPONENT}
36 37
ASFLAGS        += -PD "FreezeDevRel SETL {${FREEZE_DEV_REL}}" -PD "USE_SYNCLIB SETL {${USE_SYNCLIB}}" -PD "RISCOS_KERNEL SETL {TRUE}"
CFLAGS         += -ff -APCS 3/32bit/nofp/noswst -DRISCOS_KERNEL
38 39
CUSTOMROM       = custom
CUSTOMEXP       = custom
40
CUSTOMSA        = custom
41 42
EXPORTS         = ${EXP_HDR}.AMBControl \
                  ${EXP_HDR}.DBellDevice \
Jeffrey Lee's avatar
Jeffrey Lee committed
43
                  ${EXP_HDR}.EnvNumbers \
44 45
                  ${EXP_HDR}.HALDevice \
                  ${EXP_HDR}.HALEntries \
46
                  ${EXP_HDR}.ModHand \
47
                  ${EXP_HDR}.OSEntries \
48
                  ${EXP_HDR}.OSMem \
49
                  ${EXP_HDR}.OSMisc \
50 51
                  ${EXP_HDR}.OSRSI6 \
                  ${EXP_HDR}.PL310 \
52 53 54 55 56
                  ${EXP_HDR}.PublicWS \
                  ${EXP_HDR}.RISCOS \
                  ${EXP_HDR}.Variables \
                  ${EXP_HDR}.VduExt \
                  ${EXP_HDR}.VIDCList \
57
                  ${EXP_HDR}.VideoDevice \
58
                  ${C_EXP_HDR}.HALDevice \
59 60
                  ${C_EXP_HDR}.HALEntries \
                  ${C_EXP_HDR}.ModHand \
61
                  ${C_EXP_HDR}.OSEntries \
62
                  ${C_EXP_HDR}.OSMem \
63
                  ${C_EXP_HDR}.OSMisc \
64
                  ${C_EXP_HDR}.OSRSI6 \
65 66
                  ${C_EXP_HDR}.RISCOS \
                  ${C_EXP_HDR}.Variables \
67 68
                  ${C_EXP_HDR}.VduExt \
                  ${C_EXP_HDR}.VIDCList
Jeffrey Lee's avatar
Jeffrey Lee committed
69 70
ifeq (${USE_SYNCLIB},TRUE)
CFLAGS	       += -DUSE_SYNCLIB
Jeffrey Lee's avatar
Jeffrey Lee committed
71
LIBS            = ${SYNCLIB}k
Jeffrey Lee's avatar
Jeffrey Lee committed
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
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
108 109 110 111
# 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
112
CFLAGS += $(addprefix -DABORTTRAP_,${ABORTTRAP_ACTIONS})
113 114 115

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

121 122 123 124 125
# 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
126 127 128 129 130 131 132 133 134 135 136 137
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
138
        $(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
139 140 141 142 143 144 145

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
146
#
147
# Custom ROM:
Neil Turton's avatar
Neil Turton committed
148
#
149 150
rom: ${KERNEL_MODULE}
	@${ECHO} ${COMPONENT}: rom module built
Neil Turton's avatar
Neil Turton committed
151

152 153 154 155 156
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

157 158 159 160 161 162 163
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
164
${KERNEL_MODULE}: ${ROM_OBJECTS} ${DIRS} ${LIBS} kstrip
165
	${MKDIR} bin
166
	SetEval KernelBase "4" + STR ( 227858432 + ( HALSize LEFT ( LEN HALSize - 1 ) ) * 1024 )
Jeffrey Lee's avatar
Jeffrey Lee committed
167 168
	Do ${LD} -aif -base <KernelBase> -RW-base 0xff000000 -bin -d -o ${KERNEL_MODULE}_aif ${ROM_OBJECTS} ${LIBS}
	Do kstrip ${KERNEL_MODULE}_aif ${KERNEL_MODULE}
169
	${TOGPA} -s ${KERNEL_MODULE}_aif ${KERNEL_MODULE}_gpa
Neil Turton's avatar
Neil Turton committed
170

171 172
GetAll.o: ${TOKHELPSRC}

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

179 180 181
${EXP_HDR}.AMBControl: hdr.AMBControl
	${CP} hdr.AMBControl $@ ${CPFLAGS}

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

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

188 189
${EXP_HDR}.HALDevice: hdr.HALDevice
	${CP} hdr.HALDevice $@ ${CPFLAGS}
190

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

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

197 198
${EXP_HDR}.OSEntries: hdr.OSEntries
	${CP} hdr.OSEntries $@ ${CPFLAGS}
199

200 201 202
${EXP_HDR}.OSMem: hdr.OSMem
	${CP} hdr.OSMem $@ ${CPFLAGS}

203 204
${EXP_HDR}.OSMisc: hdr.OSMisc
	${CP} hdr.OSMisc $@ ${CPFLAGS}
205

206 207 208 209 210
${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
211 212 213 214 215 216 217

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

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

218 219 220
${EXP_HDR}.Variables: hdr.Variables
	${CP} hdr.Variables $@ ${CPFLAGS}

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

224 225
${EXP_HDR}.VIDCList: hdr.VIDCList
	${CP} hdr.VIDCList $@ ${CPFLAGS}
226

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

${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 $@
236

237 238
${C_EXP_HDR}.ModHand: hdr.ModHand
	${MKDIR} ${C_EXP_HDR}
239
	${HDR2H} hdr.ModHand $@
240

241 242 243
${C_EXP_HDR}.OSEntries: Global.h.OSEntries h.OSEntries
	${FAPPEND} $@ h.OSEntries Global.h.OSEntries

244 245 246 247
${C_EXP_HDR}.OSMem: hdr.OSMem
	${MKDIR} ${C_EXP_HDR}
	${HDR2H} hdr.OSMem $@

248 249 250 251
${C_EXP_HDR}.OSMisc: hdr.OSMisc
	${MKDIR} ${C_EXP_HDR}
	${HDR2H} hdr.OSMisc $@

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

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

260 261
${C_EXP_HDR}.Variables: hdr.Variables
	${MKDIR} ${C_EXP_HDR}
262
	${HDR2H} hdr.Variables $@
263

264 265
${C_EXP_HDR}.VduExt: hdr.VduExt
	${MKDIR} ${C_EXP_HDR}
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285
	${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
286 287 288 289
	${RM} kstrip

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

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