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#c runtime 33SRCS_os += ../lib/libc/memcpy-armv7m.S ../lib/libc/memset.c ../lib/libc/memcmp.c ../lib/libc/memmove.c 34 35#c runtime for bootloader 36SRCS_bl += ../lib/libc/memcpy-armv7m.S ../lib/libc/memset.c ../lib/libc/memcmp.c ../lib/libc/memmove.c 37 38#floating point runtime (ARM) 39SRCS_os += external/arm/arm_sin_cos_f32.c 40FLAGS += -DARM_MATH_CM4 -D__FPU_PRESENT 41 42#floating point runtime (FreeBSD) 43SRCS_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 44FLAGS += -DFLT_EVAL_METHOD 45 46#extra deps 47DEPS += $(wildcard inc/cpu/$(CPU)/*.h) 48 49#bad words for C-M4F 50BADWORDS += "__floatundisf=When casting a uint64_t to float, use floatFromUint64" 51BADWORDS += "__floatdisf=When casting a int64_t to float, use floatFromInt64" 52BADWORDS += "__fixunssfdi=When casting a float to a uint64_t, use floatToUint64" 53BADWORDS += "__fixsfdi=When casting a float to a int64_t, use floatToInt64" 54BADWORDS += "__aeabi_uldivmod=Do not ever divide uint64_t by anything, see cpuMath.h" 55BADWORDS += "__aeabi_ldivmod=Do not ever divide int64_t by anything, see cpuMath.h" 56BADWORDS += "sinf=include nanhub_math.h before using sinf()" 57BADWORDS += "cosf=include nanhub_math.h before using cosf()" 58BADWORDS += "asinf=include nanhub_math.h before using asinf()" 59 60#all softfloat double funcs are forbidden 61BADWORDS += __muldf3 __divdf3 __subdf3 __adddf3 __truncdfsf2 62 63 64 65 66