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