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)/wdt.c \ 45 src/platform/$(PLATFORM)/i2c.c \ 46 src/platform/$(PLATFORM)/exti.c \ 47 src/platform/$(PLATFORM)/syscfg.c \ 48 src/platform/$(PLATFORM)/spi.c \ 49 src/platform/$(PLATFORM)/rtc.c \ 50 src/platform/$(PLATFORM)/mpu.c \ 51 src/platform/$(PLATFORM)/dma.c \ 52 src/platform/$(PLATFORM)/crc.c \ 53 src/platform/$(PLATFORM)/hostIntf.c \ 54 src/platform/$(PLATFORM)/apInt.c \ 55 src/platform/$(PLATFORM)/eeData.c 56 57 58#platform drivers for bootloader 59SRCS_bl += src/platform/$(PLATFORM)/pwr.c src/platform/$(PLATFORM)/gpio.c 60 61#extra deps 62DEPS += $(wildcard inc/platform/$(PLATFORM)/*.h) 63DEPS += $(wildcard inc/platform/$(PLATFORM)/cmsis/*.h) 64 65#platform flags 66PLATFORM_HAS_HARDWARE_CRC = true 67FLAGS += -DPLATFORM_HW_VER=0 68 69#platform-specific rules 70OBJCOPY_PARAMS = -I elf32-littlearm -O binary 71 72bl.%.bin : bl.%.elf 73 $(OBJCOPY) -j .bl -j .blrodata -j .eedata $(OBJCOPY_PARAMS) $< $@ 74 75os.%.bin : os.%.elf 76 $(OBJCOPY) -j .data -j .text $(OBJCOPY_PARAMS) $< $@ 77 78showsizes: os.unchecked.elf 79 misc/platform/$(PLATFORM)/showsizes.sh $< 80 81