Home | History | Annotate | Download | only in cortexm4
      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 
     22 LIB_PATH := lib
     23 
     24 #defines
     25 FLAGS += -DCPU_NUM_PERSISTENT_RAM_BITS=32
     26 
     27 #cpu runtime
     28 SRCS_os += \
     29     os/cpu/$(CPU)/atomicBitset.c \
     30     os/cpu/$(CPU)/cpu.c \
     31     os/cpu/$(CPU)/pendsv.c \
     32     os/cpu/$(CPU)/atomic.c \
     33     os/cpu/$(CPU)/appSupport.c \
     34     os/cpu/$(CPU)/cpuMath.c \
     35 
     36 #cpu runtime for bootloader
     37 SRCS_bl += os/cpu/$(CPU)/cpu.c
     38 
     39 #c runtime
     40 SRCS_os += \
     41     $(LIB_PATH)/libc/memcpy-armv7m.S \
     42     $(LIB_PATH)/libc/memset.c \
     43     $(LIB_PATH)/libc/memcmp.c \
     44     $(LIB_PATH)/libc/memmove.c \
     45 
     46 #c runtime for bootloader
     47 SRCS_bl += \
     48     $(LIB_PATH)/libc/memcpy-armv7m.S \
     49     $(LIB_PATH)/libc/memset.c \
     50     $(LIB_PATH)/libc/memcmp.c \
     51     $(LIB_PATH)/libc/memmove.c \
     52 
     53 #floating point runtime (ARM)
     54 SRCS_os += external/arm/arm_sin_cos_f32.c
     55 FLAGS += -DARM_MATH_CM4 -D__FPU_PRESENT
     56 
     57 #floating point runtime (FreeBSD)
     58 SRCS_os += \
     59     external/freebsd/lib/msun/src/e_atan2f.c \
     60     external/freebsd/lib/msun/src/e_expf.c \
     61     external/freebsd/lib/msun/src/s_atanf.c \
     62 
     63 FLAGS += -DFLT_EVAL_METHOD -Iexternal/freebsd/lib/msun/src
     64 
     65 #extra deps
     66 DEPS += $(wildcard os/cpu/$(CPU)/inc/cpu/*.h)
     67 DEPS += $(wildcard os/cpu/$(CPU)/inc/cpu/cmsis/*.h)
     68 
     69 #bad words for C-M4F
     70 BADWORDS += "__floatundisf=When casting a uint64_t to float, use floatFromUint64"
     71 BADWORDS += "__floatdisf=When casting a int64_t to float, use floatFromInt64"
     72 BADWORDS += "__fixunssfdi=When casting a float to a uint64_t, use floatToUint64"
     73 BADWORDS += "__fixsfdi=When casting a float to a int64_t, use floatToInt64"
     74 BADWORDS += "__aeabi_uldivmod=Do not ever divide uint64_t by anything, see cpuMath.h"
     75 BADWORDS += "__aeabi_ldivmod=Do not ever divide int64_t by anything, see cpuMath.h"
     76 BADWORDS += "sinf=include nanohub_math.h before using sinf()"
     77 BADWORDS += "cosf=include nanohub_math.h before using cosf()"
     78 BADWORDS += "asinf=include nanohub_math.h before using asinf()"
     79 
     80 #all softfloat double funcs are forbidden
     81 BADWORDS += __muldf3 __divdf3 __subdf3 __adddf3 __truncdfsf2
     82 
     83 $(info Included CORTEX-M4 CPU)
     84