Makefile.arm revision 1.50
1# $NetBSD: Makefile.arm,v 1.50 2019/08/26 17:18:42 rin Exp $ 2 3# Makefile for NetBSD 4# 5# This makefile is constructed from a machine description: 6# config machineid 7# Most changes should be made in the machine description 8# /sys/arch/<arch>/conf/``machineid'' 9# after which you should do 10# config machineid 11# Machine generic makefile changes should be made in 12# /sys/arch/arm/conf/Makefile.arm 13# after which config should be rerun for all machines of that type. 14# 15# To specify debugging, add the config line: makeoptions DEBUG="-g" 16# A better way is to specify -g only for a few files. 17# 18# makeoptions DEBUGLIST="uvm* trap if_*" 19 20USETOOLS?= no 21NEED_OWN_INSTALL_TARGET?=no 22.include <bsd.own.mk> 23 24## 25## (1) port identification 26## 27THISARM= $S/arch/${MACHINE} 28ARM= $S/arch/arm 29GENASSYM_CONF= ${ARM}/arm32/genassym.cf 30.-include "$S/arch/${MACHINE}/conf/Makefile.${MACHINE}.inc" 31 32## 33## (2) compile settings 34## 35# CPPFLAGS set by platform-specific Makefile fragment. 36AFLAGS+= -x assembler-with-cpp 37COPTS.arm32_kvminit.c+= -fno-stack-protector 38COPTS.vfp_init.c= -mfpu=vfp 39AFLAGS.bcopyinout.S+=-marm 40AFLAGS.cpuswitch.S+=-marm -mfpu=vfp 41AFLAGS.locore.S+=-marm 42AFLAGS.fusu.S+=-marm 43AFLAGS.exception.S+=-marm 44AFLAGS.irq_dispatch.S+=-marm 45AFLAGS.blockio.S+=-marm 46AFLAGS.copystr.S+=-marm 47CFLAGS+= -mfloat-abi=soft 48 49# This files use instructions deprecated for ARMv7+, but still 50# included in kernel that build with higher -mcpu=... settings. 51CPPFLAGS.cpufunc_asm_armv4.S+= -mcpu=arm8 52CPPFLAGS.cpufunc_asm_armv6.S+= -mcpu=arm1136j-s 53CPPFLAGS.cpufunc_asm_arm11.S+= -mcpu=arm1136j-s 54CPPFLAGS.cpufunc_asm_xscale.S+= -mcpu=xscale 55 56.if !empty(MACHINE_ARCH:Mearmv6*) || !empty(MACHINE_ARCH:Mearmv7*) 57# XXX 58# 59# Workaround for alignment faults on ARMv6+, at least occur with 60# axe(4) and athn(4) drivers. 61# 62# For ARMv6+, unaligned access is enabled by default. However, it 63# cannot be used for non-cacheable memory, which is used as DMA 64# buffers. This results in alignment faults above. A real fix is 65# to use cacheable memory as DMA buffers. However, it breaks some 66# drivers, awge(4) and vchiq(4) at least. 67# 68# Until we figure out problems and fix them, we choose a fail-safe 69# workaround here; forbid unaligned memory access for whole kernel. 70# Affects on performance is negligibly small as far as we can see. 71# 72# See PR kern/54486 for more details. 73CFLAGS+= -mno-unaligned-access 74.endif 75 76## 77## (3) libkern and compat 78## 79OPT_MODULAR= %MODULAR% 80 81## 82## (4) local objects, compile rules, and dependencies 83## 84MD_OBJS+= ${SYSTEM_FIRST_OBJ} locore.o 85MD_CFILES+= 86MD_SFILES+= ${SYSTEM_FIRST_SFILE} ${ARM}/arm32/locore.S 87 88.if defined(SYSTEM_FIRST_OBJ) 89${SYSTEM_FIRST_OBJ}: ${SYSTEM_FIRST_SFILE} assym.h 90 ${NORMAL_S} 91.endif 92 93locore.o: ${ARM}/arm32/locore.S assym.h 94 ${NORMAL_S} 95 96## 97## (5) link settings 98## 99LOADADDRESS?= 0xF0000000 100LINKFLAGS_NORMAL= -X 101# Strip ARM mapping symbols from the kernel image, as they interfere 102# with ddb. Do it differently if 'makeoptions DEBUG="-g"' was specified. 103.if !defined(DEBUG) || empty(DEBUG:M-g*) 104SYSTEM_LD_TAIL?= ${OBJCOPY} --wildcard --strip-symbol='[$$][atd]' \ 105 --strip-symbol='[$$][atd]\.*' $@; \ 106 ${SIZE} $@; chmod 755 $@ 107.else 108STRIPFLAGS=-g --wildcard --strip-symbol='[$$][atd]' \ 109 --strip-symbol='[$$][atd]\.*' 110.endif 111 112## 113## (6) port specific target dependencies 114## 115 116# depend on CPU configuration 117cpufunc.o cpufunc_asm.o: Makefile 118 119# depend on DIAGNOSTIC etc. 120cpuswitch.o fault.o machdep.o: Makefile 121 122# various assembly files that depend on assym.h 123atomic.o bcopy_page.o bcopyinout.o copystr.o cpuswitch.o cpu_in_cksum.o: assym.h 124exception.o fiq_subr.o fusu.o irq_dispatch.o isa_irq.o sigcode.o: assym.h 125spl.o vectors.o: assym.h 126 127## 128## (7) misc settings 129## 130 131## 132## (8) config(8) generated machinery 133## 134%INCLUDES 135 136%OBJS 137 138%CFILES 139 140%SFILES 141 142%LOAD 143 144%RULES 145 146## 147## (9) after the config file is inserted 148## 149 150.for f in ${SFILES:T:Mcpufunc_asm*} 151AFLAGS.${f}+=-marm 152.endfor 153 154## 155## (10) port independent kernel machinery 156## 157 158.include "$S/conf/Makefile.kern.inc" 159 160## 161## (11) Appending make options. 162## 163%MAKEOPTIONSAPPEND 164