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
17M3DEBUG ?= m3debug
18
19ifneq ($(CPU),cortexm4f)
20        $(error "stm32f4xx cplatform only supports Cortex-M4F CPUs")
21endif
22
23DELIVERABLES = os.checked.bin bl.unchecked.bin full.bin showsizes
24BL_FILE = bl.unchecked.bin
25OS_FILE = os.checked.bin
26
27FLAGS += -I. -fno-unwind-tables -fstack-reuse=all -ffunction-sections -fdata-sections
28FLAGS += -Wl,--gc-sections
29FLAGS += -Iinc/platform/$(PLATFORM)/cmsis
30
31APPFLAGS += -msingle-pic-base -mpic-register=r9 -nostartfiles -fpic -shared
32
33#platform bootloader
34SRCS_bl += src/platform/$(PLATFORM)/bl.c
35
36#platform runtime
37SRCS_os +=  src/platform/$(PLATFORM)/crt_$(PLATFORM).c
38
39#platform drivers
40SRCS_os += src/platform/$(PLATFORM)/platform.c \
41	src/platform/$(PLATFORM)/usart.c \
42	src/platform/$(PLATFORM)/gpio.c \
43	src/platform/$(PLATFORM)/pwr.c \
44	src/platform/$(PLATFORM)/i2c.c \
45	src/platform/$(PLATFORM)/exti.c \
46	src/platform/$(PLATFORM)/syscfg.c \
47	src/platform/$(PLATFORM)/spi.c \
48	src/platform/$(PLATFORM)/rtc.c \
49	src/platform/$(PLATFORM)/mpu.c \
50	src/platform/$(PLATFORM)/dma.c \
51	src/platform/$(PLATFORM)/crc.c \
52	src/platform/$(PLATFORM)/hostIntf.c \
53	src/platform/$(PLATFORM)/apInt.c \
54	src/platform/$(PLATFORM)/eeData.c
55
56
57#platform drivers for bootloader
58SRCS_bl += src/platform/$(PLATFORM)/pwr.c src/platform/$(PLATFORM)/gpio.c
59
60#extra deps
61DEPS += $(wildcard inc/platform/$(PLATFORM)/*.h)
62DEPS += $(wildcard inc/platform/$(PLATFORM)/cmsis/*.h)
63
64#platform flags
65PLATFORM_HAS_HARDWARE_CRC = true
66FLAGS += -DPLATFORM_HW_VER=0
67
68#platform-specific rules
69OBJCOPY_PARAMS = -I elf32-littlearm -O binary
70
71bl.%.bin : bl.%.elf
72	$(OBJCOPY) -j .bl -j .blrodata -j .eedata $(OBJCOPY_PARAMS) $< $@
73
74os.%.bin : os.%.elf
75	$(OBJCOPY) -j .data -j .text $(OBJCOPY_PARAMS) $< $@
76
77showsizes: os.unchecked.elf
78	misc/platform/$(PLATFORM)/showsizes.sh $<
79
80