1 # Copyright (C) 2013-2015 Czech Technical University in Prague
4 # - Michal Sojka <sojkam1@fel.cvut.cz>
6 # This document contains proprietary information belonging to Czech
7 # Technical University in Prague. Passing on and copying of this
8 # document, and communication of its contents is not permitted
9 # without prior written authorization.
11 # File : Makefile.rules.arm
13 # This file contains variables and rules specific for compilation for
16 makefile_rules_arm_dir := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))
18 ifeq ($(TARGET_CFLAGS),)
19 $(error "Makefile.config must be included before this file")
22 # Code composer studio sets this variable when it invokes make. Let's use it
23 # as a hint for where is the compiler installed.
24 CCS_UTILS_DIR ?= $(or $(wildcard /opt/ti/ccsv5/utils),\
25 $(error Please set CCS_UTILS_DIR variable, e.g. by running 'make CCS_UTILS_DIR=$$HOME/ti/ccsv5/utils'))
27 ARM_COMPILER_DIR ?= $(dir $(CCS_UTILS_DIR))/tools/compiler/arm_5.1.1
29 CC=$(ARM_COMPILER_DIR)/bin/armcl
30 AR=$(ARM_COMPILER_DIR)/bin/armar
33 # Include definition of $(rpp_lib_INCLUDES)
34 include $(makefile_rules_arm_dir)/../Makefile.var
36 # Include UPPERCASE function
37 include $(makefile_rules_dir)/../common.mk
39 # Construct target specific CFLAGS. Start from what's in Makefile.config.
40 RPP_TARGET_CFLAGS = $(TARGET_CFLAGS)
43 RPP_TARGET_CFLAGS += -DTARGET_$(call UPPERCASE,$(TARGET))
45 # Then add -DTARGET_HAS_xxx for each make variable named TARGET_HAS_*
47 TARGET_HAS_NAMES = $(filter TARGET_HAS_%,$(.VARIABLES))
48 RPP_TARGET_CFLAGS += $(foreach name,$(TARGET_HAS_NAMES),$(if $(filter y,$($(name))),-D$(name)))
50 ARM_COMPILER_CFLAGS = --gcc --diag_warning=225 --display_error_number \
51 --diag_wrap=off --gen_func_subsections=on --enum_type=packed
53 RPP_CFLAGS = $(RPP_TARGET_CFLAGS) -I$(ARM_COMPILER_DIR)/include \
54 $(rpp_lib_INCLUDES:%=-I$(makefile_rules_arm_dir)/../%) \
55 $(ARM_COMPILER_CFLAGS)
58 --preproc_dependency=$(@:%=%.dep) --obj_directory=$(dir $@) \
59 --preproc_with_compile
61 RPP_COMPILE_CMD = $(CC) $(RPP_CFLAGS) $(RPP_MAKE_CFLAGS) $<
64 RPP_LIB_DIR = $(makefile_rules_arm_dir)/$(TARGET)/$(BUILD_DIR)
67 --run_linker -m"${@:%=%.map}" $(TARGET_LDFLAGS) --diag_wrap=on \
68 --reread_libs --warn_sections --display_error_number \
69 --rom_model --search_path=$(ARM_COMPILER_DIR)/lib \
70 --generate_dead_funcs_list=$(@:%=%.deadfuncs.xml) \
73 RPP_LDLIBS = $(makefile_rules_arm_dir)/$(TARGET)/$(TARGET_LDCMD) -l$(RPP_LIB_DIR)/rpp-lib.lib $(TARGET_LDLIBS)
75 # Do not define any rules when compiling Simulink models
76 ifeq ($(MATLAB_ROOT),)
77 $(RPP_LIB_DIR)/rpp-lib.lib: