blob: 3605bb3c925f6f46bbaeb91ddd970eec20a181b2 [file] [log] [blame]
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +02001################################################################################
2# \file libs.mk
3# \version 1.0
4#
5# \brief
6# Makefile to describe libraries needed for Cypress MCUBoot based applications.
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################################################################################
27# PDL library
28################################################################################
29PDL_VERSION = 121
Bohdan Kovalchuk77256522020-04-15 18:03:43 +030030
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +020031CUR_LIBS_PATH = $(CURDIR)/libs
32MBEDTLS_PATH = $(CURDIR)/../../ext
33
34# Collect source files for PDL
35SOURCES_PDL := $(wildcard $(CUR_LIBS_PATH)/pdl/psoc6pdl/drivers/source/*.c)
Roman Okhrimenko0c7aebc2020-09-02 13:37:51 +030036SOURCES_WATCHDOG := $(wildcard $(CUR_LIBS_PATH)/watchdog/*.c)
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +020037
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +020038# PDL related include directories
39INCLUDE_DIRS_PDL := $(CUR_LIBS_PATH)/pdl/psoc6pdl/drivers/include
40INCLUDE_DIRS_PDL += $(CUR_LIBS_PATH)/pdl/psoc6pdl/devices/include/ip
41INCLUDE_DIRS_PDL += $(CUR_LIBS_PATH)/pdl/psoc6pdl/devices/include
42INCLUDE_DIRS_PDL += $(CUR_LIBS_PATH)/pdl/psoc6pdl/cmsis/include
43
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +020044# core-libs related include directories
45INCLUDE_DIRS_CORE_LIB := $(CUR_LIBS_PATH)/core-lib/include
Roman Okhrimenko0c7aebc2020-09-02 13:37:51 +030046INCLUDE_DIRS_WATCHDOG := $(CUR_LIBS_PATH)/watchdog
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +020047
Bohdan Kovalchuk77256522020-04-15 18:03:43 +030048SOURCES_HAL += $(CUR_LIBS_PATH)/psoc6hal/COMPONENT_PSOC6HAL/source/cyhal_crypto_common.c
49SOURCES_HAL += $(CUR_LIBS_PATH)/psoc6hal/COMPONENT_PSOC6HAL/source/cyhal_hwmgr.c
50
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +020051# Collected source files for libraries
52SOURCES_LIBS := $(SOURCES_PDL)
Roman Okhrimenko0c7aebc2020-09-02 13:37:51 +030053SOURCES_LIBS += $(SOURCES_WATCHDOG)
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +020054SOURCES_LIBS += $(SOURCES_PLATFORM)
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +020055SOURCES_LIBS += $(SOURCES_HAL)
56
Bohdan Kovalchuk77256522020-04-15 18:03:43 +030057# needed for Crypto HW Acceleration and headers inclusion, do not use for peripherals
58# peripherals should be accessed
59INCLUDE_DIRS_HAL := $(CUR_LIBS_PATH)/psoc6hal/COMPONENT_PSOC6HAL/include
60INCLUDE_DIRS_HAL += $(CUR_LIBS_PATH)/psoc6hal/include
61INCLUDE_DIRS_HAL += $(CUR_LIBS_PATH)/psoc6hal/COMPONENT_PSOC6HAL/include/pin_packages
62
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +020063# Collected include directories for libraries
64INCLUDE_DIRS_LIBS := $(addprefix -I,$(INCLUDE_DIRS_PDL))
65INCLUDE_DIRS_LIBS += $(addprefix -I,$(INCLUDE_DIRS_PLATFORM))
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +020066INCLUDE_DIRS_LIBS += $(addprefix -I,$(INCLUDE_DIRS_CORE_LIB))
Roman Okhrimenko0c7aebc2020-09-02 13:37:51 +030067INCLUDE_DIRS_LIBS += $(addprefix -I,$(INCLUDE_DIRS_WATCHDOG))
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +020068INCLUDE_DIRS_LIBS += $(addprefix -I,$(INCLUDE_DIRS_HAL))
69
70################################################################################
71# mbedTLS settings
72################################################################################
73# MbedTLS related include directories
74INCLUDE_DIRS_MBEDTLS += $(MBEDTLS_PATH)/mbedtls/include
75INCLUDE_DIRS_MBEDTLS += $(MBEDTLS_PATH)/mbedtls/include/mbedtls
76INCLUDE_DIRS_MBEDTLS += $(MBEDTLS_PATH)/mbedtls/crypto/include
77INCLUDE_DIRS_MBEDTLS += $(MBEDTLS_PATH)/mbedtls/crypto/include/mbedtls
78#
79INCLUDE_DIRS_LIBS += $(addprefix -I,$(INCLUDE_DIRS_MBEDTLS))
80# Collect source files for MbedTLS
81SOURCES_MBEDTLS := $(wildcard $(MBEDTLS_PATH)/mbedtls/library/*.c)
82SOURCES_MBEDTLS += $(wildcard $(MBEDTLS_PATH)/mbedtls/crypto/library/*.c)
83# Collected source files for libraries
84SOURCES_LIBS += $(SOURCES_MBEDTLS)
85## mbedTLS settings
86
87################################################################################
88# mbedTLS acceleration settings
89################################################################################
90ifeq ($(USE_CRYPTO_HW), 1)
91# cy-mbedtls-acceleration related include directories
92INCLUDE_DIRS_MBEDTLS_MXCRYPTO := $(CUR_LIBS_PATH)/cy-mbedtls-acceleration/mbedtls_MXCRYPTO
93# Collect source files for MbedTLS acceleration
94SOURCES_MBEDTLS_MXCRYPTO := $(wildcard $(CUR_LIBS_PATH)/cy-mbedtls-acceleration/mbedtls_MXCRYPTO/*.c)
95#
96INCLUDE_DIRS_LIBS += $(addprefix -I,$(INCLUDE_DIRS_MBEDTLS_MXCRYPTO))
97# Collected source files for libraries
98SOURCES_LIBS += $(SOURCES_MBEDTLS_MXCRYPTO)
99endif
100## mbedTLS acceleration settings
101
102ASM_FILES_PDL :=
103ifeq ($(COMPILER), GCC_ARM)
104ASM_FILES_PDL += $(CUR_LIBS_PATH)/pdl/psoc6pdl/drivers/source/TOOLCHAIN_GCC_ARM/cy_syslib_gcc.S
105else
106$(error Only GCC ARM is supported at this moment)
107endif
108
109ASM_FILES_LIBS := $(ASM_FILES_PDL)
110ASM_FILES_LIBS += $(ASM_FILES_PLATFORM)
111
112# Add define for PDL version
113DEFINES_PDL += -DPDL_VERSION=$(PDL_VERSION)
114
115DEFINES_LIBS := $(DEFINES_PLATFORM)
116DEFINES_LIBS += $(DEFINES_PDL)