1################################################################################
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
30
31THIS_APP_PATH = $(PRJ_DIR)/libs
32MBEDTLS_PATH = $(PRJ_DIR)/../../ext
33
34# Add platform folder to build
35SOURCES_PLATFORM += $(wildcard $(PRJ_DIR)/platforms/*.c)
36SOURCES_WATCHDOG := $(wildcard $(THIS_APP_PATH)/watchdog/*.c)
37
38# Add retartget IO implementation using pdl
39SOURCES_RETARGET_IO_PDL += $(wildcard $(THIS_APP_PATH)/retarget_io_pdl/*.c)
40
41# Collect dirrectories containing headers for PLATFORM
42INCLUDE_RETARGET_IO_PDL += $(THIS_APP_PATH)/retarget_io_pdl
43
44# PSOC6HAL source files
45SOURCES_HAL += $(THIS_APP_PATH)/psoc6hal/COMPONENT_PSOC6HAL/source/cyhal_crypto_common.c
46SOURCES_HAL += $(THIS_APP_PATH)/psoc6hal/COMPONENT_PSOC6HAL/source/cyhal_hwmgr.c
47
48# MbedTLS source files
49SOURCES_MBEDTLS := $(wildcard $(MBEDTLS_PATH)/mbedtls/library/*.c)
50
51# Collected source files for libraries
52SOURCES_LIBS += $(SOURCES_HAL)
53SOURCES_LIBS += $(SOURCES_MBEDTLS)
54SOURCES_LIBS += $(SOURCES_WATCHDOG)
55SOURCES_LIBS += $(SOURCES_PLATFORM)
56SOURCES_LIBS += $(SOURCES_RETARGET_IO_PDL)
57
58# Include platforms folder
59INCLUDE_DIRS_PLATFORM := $(PRJ_DIR)/platforms
60
61# needed for Crypto HW Acceleration and headers inclusion, do not use for peripherals
62# peripherals should be accessed
63INCLUDE_DIRS_HAL := $(THIS_APP_PATH)/psoc6hal/COMPONENT_PSOC6HAL/include
64INCLUDE_DIRS_HAL += $(THIS_APP_PATH)/psoc6hal/include
65INCLUDE_DIRS_HAL += $(THIS_APP_PATH)/psoc6hal/COMPONENT_PSOC6HAL/include/pin_packages
66
67# MbedTLS related include directories
68INCLUDE_DIRS_MBEDTLS += $(MBEDTLS_PATH)/mbedtls/include
69INCLUDE_DIRS_MBEDTLS += $(MBEDTLS_PATH)/mbedtls/include/mbedtls
70INCLUDE_DIRS_MBEDTLS += $(MBEDTLS_PATH)/mbedtls/include/psa
71INCLUDE_DIRS_MBEDTLS += $(MBEDTLS_PATH)/mbedtls/library
72
73# Watchdog related includes
74INCLUDE_DIRS_WATCHDOG := $(THIS_APP_PATH)/watchdog
75
76# Collected include directories for libraries
77INCLUDE_DIRS_LIBS += $(addprefix -I,$(INCLUDE_DIRS_HAL))
78INCLUDE_DIRS_LIBS += $(addprefix -I,$(INCLUDE_DIRS_WATCHDOG))
79INCLUDE_DIRS_LIBS += $(addprefix -I,$(INCLUDE_DIRS_MBEDTLS))
80INCLUDE_DIRS_LIBS += $(addprefix -I,$(INCLUDE_RETARGET_IO_PDL))
81INCLUDE_DIRS_LIBS += $(addprefix -I,$(INCLUDE_DIRS_PLATFORM))
82
83################################################################################
84# mbedTLS hardware acceleration settings
85################################################################################
86ifeq ($(USE_CRYPTO_HW), 1)
87# cy-mbedtls-acceleration related include directories
88INCLUDE_DIRS_MBEDTLS_MXCRYPTO := $(THIS_APP_PATH)/cy-mbedtls-acceleration/mbedtls_MXCRYPTO
89# Collect source files for MbedTLS acceleration
90SOURCES_MBEDTLS_MXCRYPTO := $(wildcard $(THIS_APP_PATH)/cy-mbedtls-acceleration/mbedtls_MXCRYPTO/*.c)
91#
92INCLUDE_DIRS_LIBS += $(addprefix -I,$(INCLUDE_DIRS_MBEDTLS_MXCRYPTO))
93# Collected source files for libraries
94SOURCES_LIBS += $(SOURCES_MBEDTLS_MXCRYPTO)
95endif
96