1# 2# Copyright (C) 2016 The Android Open Source Project 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15# 16 17GCC = $(CROSS_COMPILE)gcc 18OBJCOPY = $(CROSS_COMPILE)objcopy 19 20FLAGS += -mthumb -mcpu=cortex-m4 -march=armv7e-m -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -mno-thumb-interwork -ffast-math -fsingle-precision-constant -DARM -DUSE_NANOHUB_FLOAT_RUNTIME 21APPFLAGS += -Wl,-T misc/cpu/$(CPU)/app.lkr -mno-pic-data-is-text-relative 22 23#defines 24FLAGS += -DCPU_NUM_PERSISTENT_RAM_BITS=32 25 26#cpu runtime 27SRCS_os += src/cpu/$(CPU)/atomicBitset.c src/cpu/$(CPU)/cpu.c src/cpu/$(CPU)/pendsv.c src/cpu/$(CPU)/atomic.c src/cpu/$(CPU)/appSupport.c src/cpu/$(CPU)/cpuMath.c 28 29#cpu runtime for bootloader 30SRCS_bl += src/cpu/$(CPU)/cpu.c 31 32#floating point runtime (ARM) 33SRCS_os += external/arm/arm_cos_f32.c external/arm/arm_sin_f32.c external/arm/arm_common_tables.c 34FLAGS += -DARM_MATH_CM4 -D__FPU_PRESENT 35 36#floating point runtime (FreeBSD) 37SRCS_os += external/freebsd/lib/msun/src/e_atan2f.c external/freebsd/lib/msun/src/e_expf.c external/freebsd/lib/msun/src/s_atanf.c 38FLAGS += -DFLT_EVAL_METHOD 39 40#extra deps 41DEPS += $(wildcard inc/cpu/$(CPU)/*.h) 42 43#bad words for C-M4F 44BADWORDS += "__floatundisf=When casting a uint64_t to float, use floatFromUint64" 45BADWORDS += "__floatdisf=When casting a int64_t to float, use floatFromInt64" 46BADWORDS += "__fixunssfdi=When casting a float to a uint64_t, use floatToUint64" 47BADWORDS += "__fixsfdi=When casting a float to a int64_t, use floatToInt64" 48BADWORDS += "__aeabi_uldivmod=Do not ever divide uint64_t by anything, see cpuMath.h" 49BADWORDS += "__aeabi_ldivmod=Do not ever divide int64_t by anything, see cpuMath.h" 50BADWORDS += "sinf=include nanhub_math.h before using sinf()" 51BADWORDS += "cosf=include nanhub_math.h before using cosf()" 52BADWORDS += "asinf=include nanhub_math.h before using asinf()" 53 54#all softfloat double funcs are forbidden 55BADWORDS += __muldf3 __divdf3 __subdf3 __adddf3 __truncdfsf2 56 57 58 59 60