]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lib.git/blob - build/Makefile.rules.arm
a7eb8b1e4e5727ca267d69f1cd2006264bf330e4
[pes-rpp/rpp-lib.git] / build / Makefile.rules.arm
1 # Copyright (C) 2013-2015 Czech Technical University in Prague
2 #
3 # Authors:
4 #     - Michal Sojka <sojkam1@fel.cvut.cz>
5 #
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.
10 #
11 # File : Makefile.rules.arm
12 #
13 # This file contains variables and rules specific for compilation for
14 # ARM platforms.
15
16 makefile_rules_arm_dir := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))
17
18 ifeq ($(TARGET_CFLAGS),)
19 $(error "Makefile.config must be included before this file")
20 endif
21
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 ?= /opt/ti/ccsv5/utils
25
26 ARM_COMPILER_DIR ?= $(dir $(CCS_UTILS_DIR))/tools/compiler/arm_5.1.1
27
28 ifeq ($(wildcard $(CCS_UTILS_DIR)),)
29 define msg
30 '$(CCS_UTILS_DIR)' directory does not exist.
31 Please set CCS_UTILS_DIR variable, e.g. by running 'make CCS_UTILS_DIR=$$HOME/ti/ccsv5/utils'
32 endef
33 $(error $(msg))
34 endif
35
36 include $(makefile_rules_arm_dir)/../common.mk
37
38 CC=$(ARM_COMPILER_DIR)/bin/armcl
39 AR=$(ARM_COMPILER_DIR)/bin/armar
40 LD=$(CC)
41
42 # Include definition of $(rpp_lib_INCLUDES)
43 include $(makefile_rules_arm_dir)/../Makefile.var
44
45 RPP_CFLAGS = $(TARGET_CFLAGS) --gcc -I$(ARM_COMPILER_DIR)/include       \
46                 $(rpp_lib_INCLUDES:%=-I$(makefile_rules_arm_dir)/../%)                  \
47                 --diag_warning=225 --display_error_number --diag_wrap=off               \
48                 --gen_func_subsections=on --enum_type=packed
49
50 RPP_MAKE_CFLAGS = \
51                 --preproc_dependency=$(@:%=%.dep) --obj_directory=$(dir $@)     \
52                 --preproc_with_compile
53
54 RPP_COMPILE_CMD = $(CC) $(RPP_CFLAGS) $(RPP_MAKE_CFLAGS) $<
55
56 BUILD_DIR ?= Debug
57 RPP_LIB_DIR = $(makefile_rules_arm_dir)/$(TARGET)/$(BUILD_DIR)
58
59 RPP_LDFLAGS = \
60                 --run_linker -m"${@:%=%.map}" $(TARGET_LDFLAGS) --diag_wrap=on  \
61                 --reread_libs --warn_sections --display_error_number                    \
62                 --rom_model --search_path=$(ARM_COMPILER_DIR)/lib                               \
63                 --generate_dead_funcs_list=$(@:%=%.deadfuncs.xml)                               \
64                 --stack_size=0x800
65
66 RPP_LDLIBS = $(TARGET_LDCMD) -l$(RPP_LIB_DIR)/rpp-lib.lib $(TARGET_LDLIBS)
67
68 $(RPP_LIB_DIR)/rpp-lib.lib:
69         $(MAKE) -C $(dir $@)