# Copyright (C) 2013-2015 Czech Technical University in Prague # # Authors: # - Michal Sojka # # This document contains proprietary information belonging to Czech # Technical University in Prague. Passing on and copying of this # document, and communication of its contents is not permitted # without prior written authorization. # # File : Makefile.rules.arm # # This file contains variables and rules specific for compilation for # ARM platforms. makefile_rules_arm_dir := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST)))) ifeq ($(TARGET_CFLAGS),) $(error "Makefile.config must be included before this file") endif # Code composer studio sets this variable when it invokes make. Let's use it # as a hint for where is the compiler installed. CCS_UTILS_DIR ?= $(or $(wildcard /opt/ti/ccsv5/utils),\ $(error Please set CCS_UTILS_DIR variable, e.g. by running 'make CCS_UTILS_DIR=$$HOME/ti/ccsv5/utils')) ARM_COMPILER_DIR ?= $(dir $(CCS_UTILS_DIR))/tools/compiler/arm_5.1.1 CC=$(ARM_COMPILER_DIR)/bin/armcl AR=$(ARM_COMPILER_DIR)/bin/armar LD=$(CC) # Include definition of $(rpp_lib_INCLUDES) include $(makefile_rules_arm_dir)/../Makefile.var # Include UPPERCASE function include $(makefile_rules_dir)/../common.mk # Construct target specific CFLAGS. Start from what's in Makefile.config. RPP_TARGET_CFLAGS = $(TARGET_CFLAGS) # Add -DTARGET_ RPP_TARGET_CFLAGS += -DTARGET_$(call UPPERCASE,$(TARGET)) # Then add -DTARGET_HAS_xxx for each make variable named TARGET_HAS_* # having value 'y' TARGET_HAS_NAMES = $(filter TARGET_HAS_%,$(.VARIABLES)) RPP_TARGET_CFLAGS += $(foreach name,$(TARGET_HAS_NAMES),$(if $(filter y,$($(name))),-D$(name))) RPP_CFLAGS = $(RPP_TARGET_CFLAGS) --gcc -I$(ARM_COMPILER_DIR)/include \ $(rpp_lib_INCLUDES:%=-I$(makefile_rules_arm_dir)/../%) \ --diag_warning=225 --display_error_number --diag_wrap=off \ --gen_func_subsections=on --enum_type=packed RPP_MAKE_CFLAGS = \ --preproc_dependency=$(@:%=%.dep) --obj_directory=$(dir $@) \ --preproc_with_compile RPP_COMPILE_CMD = $(CC) $(RPP_CFLAGS) $(RPP_MAKE_CFLAGS) $< BUILD_DIR ?= Debug RPP_LIB_DIR = $(makefile_rules_arm_dir)/$(TARGET)/$(BUILD_DIR) RPP_LDFLAGS = \ --run_linker -m"${@:%=%.map}" $(TARGET_LDFLAGS) --diag_wrap=on \ --reread_libs --warn_sections --display_error_number \ --rom_model --search_path=$(ARM_COMPILER_DIR)/lib \ --generate_dead_funcs_list=$(@:%=%.deadfuncs.xml) \ --stack_size=0x800 RPP_LDLIBS = $(makefile_rules_arm_dir)/$(TARGET)/$(TARGET_LDCMD) -l$(RPP_LIB_DIR)/rpp-lib.lib $(TARGET_LDLIBS) # Do not define any rules when compiling Simulink models ifeq ($(MATLAB_ROOT),) $(RPP_LIB_DIR)/rpp-lib.lib: $(MAKE) -C $(dir $@) endif