Roman Okhrimenko | 89ecdac | 2020-02-28 17:05:55 +0200 | [diff] [blame] | 1 | ################################################################################ |
Bohdan Kovalchuk | 7725652 | 2020-04-15 18:03:43 +0300 | [diff] [blame] | 2 | # \file MCUBootApp.mk |
Roman Okhrimenko | 89ecdac | 2020-02-28 17:05:55 +0200 | [diff] [blame] | 3 | # \version 1.0 |
| 4 | # |
| 5 | # \brief |
Bohdan Kovalchuk | 7725652 | 2020-04-15 18:03:43 +0300 | [diff] [blame] | 6 | # Makefile for Cypress MCUBoot-based application. |
Roman Okhrimenko | 89ecdac | 2020-02-28 17:05:55 +0200 | [diff] [blame] | 7 | # |
| 8 | ################################################################################ |
| 9 | # \copyright |
| 10 | # Copyright 2018-2019 Cypress Semiconductor Corporation |
| 11 | # SPDX-License-Identifier: Apache-2.0 |
| 12 | # |
| 13 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 14 | # you may not use this file except in compliance with the License. |
| 15 | # You may obtain a copy of the License at |
| 16 | # |
| 17 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 18 | # |
| 19 | # Unless required by applicable law or agreed to in writing, software |
| 20 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 21 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 22 | # See the License for the specific language governing permissions and |
| 23 | # limitations under the License. |
| 24 | ################################################################################ |
| 25 | |
| 26 | # Cypress' MCUBoot Application supports GCC ARM only at this moment |
| 27 | # Set default compiler to GCC if not specified from command line |
| 28 | COMPILER ?= GCC_ARM |
| 29 | |
Roman Okhrimenko | 38aa6c4 | 2020-01-31 16:10:28 +0200 | [diff] [blame] | 30 | USE_CRYPTO_HW ?= 1 |
Roman Okhrimenko | 89ecdac | 2020-02-28 17:05:55 +0200 | [diff] [blame] | 31 | MCUBOOT_IMAGE_NUMBER ?= 1 |
| 32 | |
| 33 | ifneq ($(COMPILER), GCC_ARM) |
| 34 | $(error Only GCC ARM is supported at this moment) |
| 35 | endif |
| 36 | |
| 37 | CUR_APP_PATH = $(CURDIR)/$(APP_NAME) |
| 38 | |
| 39 | include $(CUR_APP_PATH)/platforms.mk |
| 40 | include $(CUR_APP_PATH)/libs.mk |
| 41 | include $(CUR_APP_PATH)/toolchains.mk |
| 42 | |
| 43 | # Application-specific DEFINES |
| 44 | DEFINES_APP := -DMBEDTLS_CONFIG_FILE="\"mcuboot_crypto_config.h\"" |
| 45 | DEFINES_APP += -DECC256_KEY_FILE="\"keys/$(SIGN_KEY_FILE).pub\"" |
| 46 | DEFINES_APP += -DCORE=$(CORE) |
| 47 | DEFINES_APP += -DMCUBOOT_IMAGE_NUMBER=$(MCUBOOT_IMAGE_NUMBER) |
| 48 | |
Roman Okhrimenko | 38aa6c4 | 2020-01-31 16:10:28 +0200 | [diff] [blame] | 49 | ifeq ($(USE_CRYPTO_HW), 1) |
| 50 | DEFINES_APP += -DMBEDTLS_USER_CONFIG_FILE="\"mcuboot_crypto_acc_config.h\"" |
| 51 | endif |
Roman Okhrimenko | 89ecdac | 2020-02-28 17:05:55 +0200 | [diff] [blame] | 52 | # Collect MCUBoot sourses |
| 53 | SOURCES_MCUBOOT := $(wildcard $(CURDIR)/../bootutil/src/*.c) |
| 54 | # Collect MCUBoot Application sources |
| 55 | SOURCES_APP_SRC := $(wildcard $(CUR_APP_PATH)/*.c) |
| 56 | # Collect Flash Layer port sources |
| 57 | SOURCES_FLASH_PORT := $(wildcard $(CURDIR)/cy_flash_pal/*.c) |
| 58 | # Collect all the sources |
| 59 | SOURCES_APP := $(SOURCES_MCUBOOT) |
| 60 | SOURCES_APP += $(SOURCES_APP_SRC) |
| 61 | SOURCES_APP += $(SOURCES_FLASH_PORT) |
| 62 | |
Bohdan Kovalchuk | 7725652 | 2020-04-15 18:03:43 +0300 | [diff] [blame] | 63 | INCLUDE_DIRS_MCUBOOT := $(addprefix -I, $(CURDIR)/../bootutil/include) |
| 64 | INCLUDE_DIRS_MCUBOOT += $(addprefix -I, $(CURDIR)/../bootutil/src) |
| 65 | INCLUDE_DIRS_MCUBOOT += $(addprefix -I, $(CURDIR)/..) |
Roman Okhrimenko | 89ecdac | 2020-02-28 17:05:55 +0200 | [diff] [blame] | 66 | |
| 67 | INCLUDE_DIRS_APP := $(addprefix -I, $(CURDIR)) |
| 68 | INCLUDE_DIRS_APP += $(addprefix -I, $(CURDIR)/cy_flash_pal/include) |
| 69 | INCLUDE_DIRS_APP += $(addprefix -I, $(CURDIR)/cy_flash_pal/include/flash_map_backend) |
| 70 | INCLUDE_DIRS_APP += $(addprefix -I, $(CUR_APP_PATH)) |
| 71 | INCLUDE_DIRS_APP += $(addprefix -I, $(CUR_APP_PATH)/config) |
| 72 | INCLUDE_DIRS_APP += $(addprefix -I, $(CUR_APP_PATH)/os) |
| 73 | |
| 74 | ASM_FILES_APP := |
| 75 | |
| 76 | # Output folder |
| 77 | OUT := $(APP_NAME)/out |
| 78 | # Output folder to contain build artifacts |
| 79 | OUT_TARGET := $(OUT)/$(PLATFORM) |
| 80 | |
| 81 | OUT_CFG := $(OUT_TARGET)/$(BUILDCFG) |
| 82 | |
Bohdan Kovalchuk | 7725652 | 2020-04-15 18:03:43 +0300 | [diff] [blame] | 83 | # Overwite path to linker script if custom is required |
Roman Okhrimenko | 89ecdac | 2020-02-28 17:05:55 +0200 | [diff] [blame] | 84 | ifeq ($(COMPILER), GCC_ARM) |
| 85 | LINKER_SCRIPT := $(subst /cygdrive/c,c:,$(CUR_APP_PATH)/$(APP_NAME).ld) |
| 86 | else |
| 87 | $(error Only GCC ARM is supported at this moment) |
| 88 | endif |