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 17 GCC = $(CROSS_COMPILE)gcc 18 OBJCOPY = $(CROSS_COMPILE)objcopy 19 20 FLAGS += -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 21 APPFLAGS += -Wl,-T misc/cpu/$(CPU)/app.lkr -mno-pic-data-is-text-relative 22 23 #defines 24 FLAGS += -DCPU_NUM_PERSISTENT_RAM_BITS=32 25 26 #cpu runtime 27 SRCS_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 30 SRCS_bl += src/cpu/$(CPU)/cpu.c 31 32 #floating point runtime (ARM) 33 SRCS_os += external/arm/arm_cos_f32.c external/arm/arm_sin_f32.c external/arm/arm_common_tables.c 34 FLAGS += -DARM_MATH_CM4 -D__FPU_PRESENT 35 36 #floating point runtime (FreeBSD) 37 SRCS_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 38 FLAGS += -DFLT_EVAL_METHOD 39 40 #extra deps 41 DEPS += $(wildcard inc/cpu/$(CPU)/*.h) 42 43 #bad words for C-M4F 44 BADWORDS += "__floatundisf=When casting a uint64_t to float, use floatFromUint64" 45 BADWORDS += "__floatdisf=When casting a int64_t to float, use floatFromInt64" 46 BADWORDS += "__fixunssfdi=When casting a float to a uint64_t, use floatToUint64" 47 BADWORDS += "__fixsfdi=When casting a float to a int64_t, use floatToInt64" 48 BADWORDS += "__aeabi_uldivmod=Do not ever divide uint64_t by anything, see cpuMath.h" 49 BADWORDS += "__aeabi_ldivmod=Do not ever divide int64_t by anything, see cpuMath.h" 50 BADWORDS += "sinf=include nanhub_math.h before using sinf()" 51 BADWORDS += "cosf=include nanhub_math.h before using cosf()" 52 BADWORDS += "asinf=include nanhub_math.h before using asinf()" 53 54 #all softfloat double funcs are forbidden 55 BADWORDS += __muldf3 __divdf3 __subdf3 __adddf3 __truncdfsf2 56 57 58 59 60