# $NetBSD: Makefile.arm,v 1.51 2019/11/11 22:45:27 joerg Exp $ # Makefile for NetBSD # # This makefile is constructed from a machine description: # config machineid # Most changes should be made in the machine description # /sys/arch//conf/``machineid'' # after which you should do # config machineid # Machine generic makefile changes should be made in # /sys/arch/arm/conf/Makefile.arm # after which config should be rerun for all machines of that type. # # To specify debugging, add the config line: makeoptions DEBUG="-g" # A better way is to specify -g only for a few files. # # makeoptions DEBUGLIST="uvm* trap if_*" USETOOLS?= no NEED_OWN_INSTALL_TARGET?=no .include ## ## (1) port identification ## THISARM= $S/arch/${MACHINE} ARM= $S/arch/arm GENASSYM_CONF= ${ARM}/arm32/genassym.cf .-include "$S/arch/${MACHINE}/conf/Makefile.${MACHINE}.inc" ## ## (2) compile settings ## # CPPFLAGS set by platform-specific Makefile fragment. AFLAGS+= -x assembler-with-cpp COPTS.arm32_kvminit.c+= -fno-stack-protector COPTS.vfp_init.c= -mfpu=vfp CLANG_OBSOLETE_MULTI_ST= ${${ACTIVE_CC} == "clang":? -Wa,-W :} AFLAGS.bcopyinout.S+= -marm AFLAGS.blockio.S+= -marm ${CLANG_OBSOLETE_MULTI_ST} AFLAGS.copystr.S+= -marm AFLAGS.cpufunc_asm.S+= ${CLANG_OBSOLETE_MULTI_ST} AFLAGS.cpuswitch.S+= -marm -mfpu=vfp AFLAGS.exception.S+= -marm ${CLANG_OBSOLETE_MULTI_ST} AFLAGS.fiq_subr.S+= ${CLANG_OBSOLETE_MULTI_ST} AFLAGS.fusu.S+= -marm AFLAGS.irq_dispatch.S+= -marm ${CLANG_OBSOLETE_MULTI_ST} AFLAGS.locore.S+= -marm ${CLANG_OBSOLETE_MULTI_ST} CFLAGS+= -mfloat-abi=soft # This files use instructions deprecated for ARMv7+, but still # included in kernel that build with higher -mcpu=... settings. CPPFLAGS.cpufunc_asm_armv4.S+= -mcpu=arm8 CPPFLAGS.cpufunc_asm_armv6.S+= -mcpu=arm1136j-s CPPFLAGS.cpufunc_asm_arm11.S+= -mcpu=arm1136j-s CPPFLAGS.cpufunc_asm_xscale.S+= -mcpu=xscale .if !empty(MACHINE_ARCH:Mearmv6*) || !empty(MACHINE_ARCH:Mearmv7*) # XXX # # Workaround for alignment faults on ARMv6+, at least occur with # axe(4) and athn(4) drivers. # # For ARMv6+, unaligned access is enabled by default. However, it # cannot be used for non-cacheable memory, which is used as DMA # buffers. This results in alignment faults above. A real fix is # to use cacheable memory as DMA buffers. However, it breaks some # drivers, awge(4) and vchiq(4) at least. # # Until we figure out problems and fix them, we choose a fail-safe # workaround here; forbid unaligned memory access for whole kernel. # Affects on performance is negligibly small as far as we can see. # # See PR kern/54486 for more details. CFLAGS+= -mno-unaligned-access .endif ## ## (3) libkern and compat ## OPT_MODULAR= %MODULAR% ## ## (4) local objects, compile rules, and dependencies ## MD_OBJS+= ${SYSTEM_FIRST_OBJ} locore.o MD_CFILES+= MD_SFILES+= ${SYSTEM_FIRST_SFILE} ${ARM}/arm32/locore.S .if defined(SYSTEM_FIRST_OBJ) ${SYSTEM_FIRST_OBJ}: ${SYSTEM_FIRST_SFILE} assym.h ${NORMAL_S} .endif locore.o: ${ARM}/arm32/locore.S assym.h ${NORMAL_S} ## ## (5) link settings ## LOADADDRESS?= 0xF0000000 LINKFLAGS_NORMAL= -X # Strip ARM mapping symbols from the kernel image, as they interfere # with ddb. Do it differently if 'makeoptions DEBUG="-g"' was specified. .if !defined(DEBUG) || empty(DEBUG:M-g*) SYSTEM_LD_TAIL?= ${OBJCOPY} --wildcard --strip-symbol='[$$][atd]' \ --strip-symbol='[$$][atd]\.*' $@; \ ${SIZE} $@; chmod 755 $@ .else STRIPFLAGS=-g --wildcard --strip-symbol='[$$][atd]' \ --strip-symbol='[$$][atd]\.*' .endif ## ## (6) port specific target dependencies ## # depend on CPU configuration cpufunc.o cpufunc_asm.o: Makefile # depend on DIAGNOSTIC etc. cpuswitch.o fault.o machdep.o: Makefile # various assembly files that depend on assym.h atomic.o bcopy_page.o bcopyinout.o copystr.o cpuswitch.o cpu_in_cksum.o: assym.h exception.o fiq_subr.o fusu.o irq_dispatch.o isa_irq.o sigcode.o: assym.h spl.o vectors.o: assym.h ## ## (7) misc settings ## ## ## (8) config(8) generated machinery ## %INCLUDES %OBJS %CFILES %SFILES %LOAD %RULES ## ## (9) after the config file is inserted ## .for f in ${SFILES:T:Mcpufunc_asm*} AFLAGS.${f}+=-marm .endfor ## ## (10) port independent kernel machinery ## .include "$S/conf/Makefile.kern.inc" ## ## (11) Appending make options. ## %MAKEOPTIONSAPPEND