Makefile.arm revision 1.53
1# $NetBSD: Makefile.arm,v 1.53 2020/01/06 07:40:45 skrll 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 39CLANG_OBSOLETE_MULTI_ST= ${${ACTIVE_CC} == "clang":? -Wa,-W :} 40AFLAGS.bcopyinout.S+= -marm 41AFLAGS.blockio.S+= -marm ${CLANG_OBSOLETE_MULTI_ST} 42AFLAGS.copystr.S+= -marm 43AFLAGS.cpufunc_asm.S+= ${CLANG_OBSOLETE_MULTI_ST} 44AFLAGS.cpuswitch.S+= -marm -mfpu=vfp 45AFLAGS.exception.S+= -marm ${CLANG_OBSOLETE_MULTI_ST} 46AFLAGS.fiq_subr.S+= ${CLANG_OBSOLETE_MULTI_ST} 47AFLAGS.fusu.S+= -marm 48AFLAGS.irq_dispatch.S+= -marm ${CLANG_OBSOLETE_MULTI_ST} 49AFLAGS.locore.S+= -marm ${CLANG_OBSOLETE_MULTI_ST} 50CFLAGS+= -mfloat-abi=soft 51 52# This files use instructions deprecated for ARMv7+, but still 53# included in kernel that build with higher -mcpu=... settings. 54CPPFLAGS.cpufunc_asm_armv4.S+= -mcpu=arm8 55CPPFLAGS.cpufunc_asm_armv6.S+= -mcpu=arm1136j-s 56CPPFLAGS.cpufunc_asm_arm11.S+= -mcpu=arm1136j-s 57CPPFLAGS.cpufunc_asm_xscale.S+= -mcpu=xscale 58 59.if !empty(MACHINE_ARCH:Mearmv6*) || !empty(MACHINE_ARCH:Mearmv7*) 60# XXX 61# 62# Workaround for alignment faults on ARMv6+, at least occur with 63# axe(4) and athn(4) drivers. 64# 65# For ARMv6+, unaligned access is enabled by default. However, it 66# cannot be used for non-cacheable memory, which is used as DMA 67# buffers. This results in alignment faults above. A real fix is 68# to use cacheable memory as DMA buffers. However, it breaks some 69# drivers, awge(4) and vchiq(4) at least. 70# 71# Until we figure out problems and fix them, we choose a fail-safe 72# workaround here; forbid unaligned memory access for whole kernel. 73# Affects on performance is negligibly small as far as we can see. 74# 75# See PR kern/54486 for more details. 76CFLAGS+= -mno-unaligned-access 77.endif 78 79OPT_DDB= %DDB% 80.if !empty(OPT_DDB) && ${HAVE_GCC:U0} > 0 81CFLAGS+= -mapcs-frame 82.endif 83 84## 85## (3) libkern and compat 86## 87OPT_MODULAR= %MODULAR% 88 89## 90## (4) local objects, compile rules, and dependencies 91## 92MD_OBJS+= ${SYSTEM_FIRST_OBJ} locore.o 93MD_CFILES+= 94MD_SFILES+= ${SYSTEM_FIRST_SFILE} ${ARM}/arm32/locore.S 95 96.if defined(SYSTEM_FIRST_OBJ) 97${SYSTEM_FIRST_OBJ}: ${SYSTEM_FIRST_SFILE} assym.h 98 ${NORMAL_S} 99.endif 100 101locore.o: ${ARM}/arm32/locore.S assym.h 102 ${NORMAL_S} 103 104## 105## (5) link settings 106## 107LOADADDRESS?= 0xF0000000 108LINKFLAGS_NORMAL= -X 109# Strip ARM mapping symbols from the kernel image, as they interfere 110# with ddb. Do it differently if 'makeoptions DEBUG="-g"' was specified. 111.if !defined(DEBUG) || empty(DEBUG:M-g*) 112SYSTEM_LD_TAIL?= ${OBJCOPY} --wildcard --strip-symbol='[$$][atd]' \ 113 --strip-symbol='[$$][atd]\.*' $@; \ 114 ${SIZE} $@; chmod 755 $@ 115.else 116STRIPFLAGS=-g --wildcard --strip-symbol='[$$][atd]' \ 117 --strip-symbol='[$$][atd]\.*' 118.endif 119 120## 121## (6) port specific target dependencies 122## 123 124# depend on CPU configuration 125cpufunc.o cpufunc_asm.o: Makefile 126 127# depend on DIAGNOSTIC etc. 128cpuswitch.o fault.o machdep.o: Makefile 129 130# various assembly files that depend on assym.h 131atomic.o bcopy_page.o bcopyinout.o copystr.o cpuswitch.o cpu_in_cksum.o: assym.h 132exception.o fiq_subr.o fusu.o irq_dispatch.o isa_irq.o sigcode.o: assym.h 133spl.o vectors.o: assym.h 134 135## 136## (7) misc settings 137## 138 139## 140## (8) config(8) generated machinery 141## 142%INCLUDES 143 144%OBJS 145 146%CFILES 147 148%SFILES 149 150%LOAD 151 152%RULES 153 154## 155## (9) after the config file is inserted 156## 157 158.for f in ${SFILES:T:Mcpufunc_asm*} 159AFLAGS.${f}+=-marm 160.endfor 161 162## 163## (10) port independent kernel machinery 164## 165 166.include "$S/conf/Makefile.kern.inc" 167 168## 169## (11) Appending make options. 170## 171%MAKEOPTIONSAPPEND 172