add basic secure monitor code for armv7+, for some reason sdram security does not...
[rpi-open-firmware.git] / arm_chainloader / Makefile
1
2 TARGET_ARM_CHAINLOADER = arm_chainloader.bin
3
4 SRCS = \
5 start.s \
6 lib_armv6/arm_bcopy.s \
7 lib_armv6/arm_bzero.s \
8 lib_armv6/arm_locore.s \
9 lib_armv6/arm_strlen.s \
10 lib_armv6/arm_memcmp.s \
11 lib_armv6/string_misc.c \
12 drivers/uart.c \
13 drivers/cprman.cc \
14 drivers/libfdt/fdt.c \
15 drivers/libfdt/fdt_ro.c \
16 drivers/libfdt/fdt_wip.c \
17 drivers/libfdt/fdt_rw.c \
18 drivers/libfdt/fdt_strerror.c \
19 drivers/fatfs/ff.c \
20 drivers/sdhost_impl.cc \
21 drivers/mbr_disk.cc \
22 drivers/mailbox.cc \
23 ../lib/xprintf.c \
24 ../lib/panic.c \
25 ../lib/udelay.c \
26 ../lib/cxx_runtime.c \
27 ../lib/tlsf/tlsf.c \
28 loader.cc \
29 main.c
30
31 ARCH = armv6zk
32
33 BUILD_DIR = build
34 TARGET_BUILD_DIR = $(BUILD_DIR)/$(ARCH)-objects
35 PRODUCT_DIRECTORY = $(BUILD_DIR)
36
37 NO_COLOR=""
38 OK_COLOR=""
39 ERROR_COLOR=""
40 WARN_COLOR=""
41
42 .PHONY: default all clean create_build_directory device
43
44 default: $(TARGET_ARM_CHAINLOADER)
45
46 OBJ := $(addprefix $(TARGET_BUILD_DIR)/, $(addsuffix .o, $(basename $(SRCS))))
47
48 CROSS_COMPILE = arm-none-eabi-
49 CC = $(CROSS_COMPILE)gcc
50 CXX = $(CROSS_COMPILE)gcc
51 AS = $(CC)
52 OBJCOPY = $(CROSS_COMPILE)objcopy
53 LINKFLAGS = -nostdlib -march=$(ARCH) -Wl,--build-id=none -T linker.lds
54 COMMON_FLAGS = -c -nostdlib -nostartfiles -ffreestanding -march=$(ARCH) -I../ -I./ -I./drivers/libfdt/ \
55 -mfpu=vfp -mfloat-abi=hard -mtune=arm1176jzf-s
56
57 CFLAGS = $(COMMON_FLAGS) -std=c11
58 CXXFLAGS = $(COMMON_FLAGS) -std=c++11 -fno-exceptions -fno-rtti
59 ASFLAGS = $(COMMON_FLAGS) -x assembler-with-cpp
60
61 HEADERS := \
62 $(shell find . -type f -name '*.h') \
63 $(shell find . -type f -name '*.hpp')
64
65 create_build_directory:
66 @mkdir -p $(TARGET_BUILD_DIR)
67 @mkdir -p $(PRODUCT_DIRECTORY)
68
69 CREATE_SUBDIR = \
70 @DIR="$(dir $@)"; \
71 if [ ! -d $$DIR ]; then mkdir -p $$DIR; fi
72
73 #
74 # rules to build c/asm files.
75 #
76 $(TARGET_BUILD_DIR)/%.o: %.c $(HEADERS)
77 $(CREATE_SUBDIR)
78 @echo $(WARN_COLOR)CC $(NO_COLOR) $@
79 @$(CC) $(CFLAGS) $< -o $@
80
81 $(TARGET_BUILD_DIR)/%.o: %.cc $(HEADERS)
82 $(CREATE_SUBDIR)
83 @echo $(WARN_COLOR)CXX $(NO_COLOR) $@
84 @$(CXX) $(CXXFLAGS) $< -o $@
85
86 $(TARGET_BUILD_DIR)/%.o: %.s $(HEADERS)
87 $(CREATE_SUBDIR)
88 @echo $(WARN_COLOR)AS $(NO_COLOR) $@
89 @$(AS) $(ASFLAGS) $< -o $@
90
91 .PRECIOUS: $(OBJ)
92
93 $(TARGET_ARM_CHAINLOADER): create_build_directory $(OBJ)
94 @echo $(WARN_COLOR)LD $(NO_COLOR) $@.elf
95 @$(CC) $(LINKFLAGS) $(OBJ) -o $(PRODUCT_DIRECTORY)/$@.elf -lgcc
96 @echo $(WARN_COLOR)OBJ$(NO_COLOR) $@
97 @$(OBJCOPY) -O binary $(PRODUCT_DIRECTORY)/$@.elf $(PRODUCT_DIRECTORY)/$@
98
99 clean:
100 @echo $(ERROR_COLOR)CLEAN$(NO_COLOR)
101 @-rm -rf ./$(BUILD_DIR)
This page took 0.083475 seconds and 4 git commands to generate.