Roman Okhrimenko | 89ecdac | 2020-02-28 17:05:55 +0200 | [diff] [blame] | 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 | ################################################################################ |
| 29 | PDL_VERSION = 121 |
Bohdan Kovalchuk | 7725652 | 2020-04-15 18:03:43 +0300 | [diff] [blame^] | 30 | |
Roman Okhrimenko | 89ecdac | 2020-02-28 17:05:55 +0200 | [diff] [blame] | 31 | CUR_LIBS_PATH = $(CURDIR)/libs |
| 32 | MBEDTLS_PATH = $(CURDIR)/../../ext |
| 33 | |
| 34 | # Collect source files for PDL |
| 35 | SOURCES_PDL := $(wildcard $(CUR_LIBS_PATH)/pdl/psoc6pdl/drivers/source/*.c) |
| 36 | |
Roman Okhrimenko | 89ecdac | 2020-02-28 17:05:55 +0200 | [diff] [blame] | 37 | # PDL related include directories |
| 38 | INCLUDE_DIRS_PDL := $(CUR_LIBS_PATH)/pdl/psoc6pdl/drivers/include |
| 39 | INCLUDE_DIRS_PDL += $(CUR_LIBS_PATH)/pdl/psoc6pdl/devices/include/ip |
| 40 | INCLUDE_DIRS_PDL += $(CUR_LIBS_PATH)/pdl/psoc6pdl/devices/include |
| 41 | INCLUDE_DIRS_PDL += $(CUR_LIBS_PATH)/pdl/psoc6pdl/cmsis/include |
| 42 | |
Roman Okhrimenko | 89ecdac | 2020-02-28 17:05:55 +0200 | [diff] [blame] | 43 | # core-libs related include directories |
| 44 | INCLUDE_DIRS_CORE_LIB := $(CUR_LIBS_PATH)/core-lib/include |
| 45 | |
Bohdan Kovalchuk | 7725652 | 2020-04-15 18:03:43 +0300 | [diff] [blame^] | 46 | SOURCES_HAL += $(CUR_LIBS_PATH)/psoc6hal/COMPONENT_PSOC6HAL/source/cyhal_crypto_common.c |
| 47 | SOURCES_HAL += $(CUR_LIBS_PATH)/psoc6hal/COMPONENT_PSOC6HAL/source/cyhal_hwmgr.c |
| 48 | |
Roman Okhrimenko | 89ecdac | 2020-02-28 17:05:55 +0200 | [diff] [blame] | 49 | # Collected source files for libraries |
| 50 | SOURCES_LIBS := $(SOURCES_PDL) |
| 51 | SOURCES_LIBS += $(SOURCES_PLATFORM) |
Roman Okhrimenko | 89ecdac | 2020-02-28 17:05:55 +0200 | [diff] [blame] | 52 | SOURCES_LIBS += $(SOURCES_HAL) |
| 53 | |
Bohdan Kovalchuk | 7725652 | 2020-04-15 18:03:43 +0300 | [diff] [blame^] | 54 | # needed for Crypto HW Acceleration and headers inclusion, do not use for peripherals |
| 55 | # peripherals should be accessed |
| 56 | INCLUDE_DIRS_HAL := $(CUR_LIBS_PATH)/psoc6hal/COMPONENT_PSOC6HAL/include |
| 57 | INCLUDE_DIRS_HAL += $(CUR_LIBS_PATH)/psoc6hal/include |
| 58 | INCLUDE_DIRS_HAL += $(CUR_LIBS_PATH)/psoc6hal/COMPONENT_PSOC6HAL/include/pin_packages |
| 59 | |
Roman Okhrimenko | 89ecdac | 2020-02-28 17:05:55 +0200 | [diff] [blame] | 60 | # Collected include directories for libraries |
| 61 | INCLUDE_DIRS_LIBS := $(addprefix -I,$(INCLUDE_DIRS_PDL)) |
| 62 | INCLUDE_DIRS_LIBS += $(addprefix -I,$(INCLUDE_DIRS_PLATFORM)) |
Roman Okhrimenko | 89ecdac | 2020-02-28 17:05:55 +0200 | [diff] [blame] | 63 | INCLUDE_DIRS_LIBS += $(addprefix -I,$(INCLUDE_DIRS_CORE_LIB)) |
| 64 | INCLUDE_DIRS_LIBS += $(addprefix -I,$(INCLUDE_DIRS_HAL)) |
| 65 | |
| 66 | ################################################################################ |
| 67 | # mbedTLS settings |
| 68 | ################################################################################ |
| 69 | # MbedTLS related include directories |
| 70 | INCLUDE_DIRS_MBEDTLS += $(MBEDTLS_PATH)/mbedtls/include |
| 71 | INCLUDE_DIRS_MBEDTLS += $(MBEDTLS_PATH)/mbedtls/include/mbedtls |
| 72 | INCLUDE_DIRS_MBEDTLS += $(MBEDTLS_PATH)/mbedtls/crypto/include |
| 73 | INCLUDE_DIRS_MBEDTLS += $(MBEDTLS_PATH)/mbedtls/crypto/include/mbedtls |
| 74 | # |
| 75 | INCLUDE_DIRS_LIBS += $(addprefix -I,$(INCLUDE_DIRS_MBEDTLS)) |
| 76 | # Collect source files for MbedTLS |
| 77 | SOURCES_MBEDTLS := $(wildcard $(MBEDTLS_PATH)/mbedtls/library/*.c) |
| 78 | SOURCES_MBEDTLS += $(wildcard $(MBEDTLS_PATH)/mbedtls/crypto/library/*.c) |
| 79 | # Collected source files for libraries |
| 80 | SOURCES_LIBS += $(SOURCES_MBEDTLS) |
| 81 | ## mbedTLS settings |
| 82 | |
| 83 | ################################################################################ |
| 84 | # mbedTLS acceleration settings |
| 85 | ################################################################################ |
| 86 | ifeq ($(USE_CRYPTO_HW), 1) |
| 87 | # cy-mbedtls-acceleration related include directories |
| 88 | INCLUDE_DIRS_MBEDTLS_MXCRYPTO := $(CUR_LIBS_PATH)/cy-mbedtls-acceleration/mbedtls_MXCRYPTO |
| 89 | # Collect source files for MbedTLS acceleration |
| 90 | SOURCES_MBEDTLS_MXCRYPTO := $(wildcard $(CUR_LIBS_PATH)/cy-mbedtls-acceleration/mbedtls_MXCRYPTO/*.c) |
| 91 | # |
| 92 | INCLUDE_DIRS_LIBS += $(addprefix -I,$(INCLUDE_DIRS_MBEDTLS_MXCRYPTO)) |
| 93 | # Collected source files for libraries |
| 94 | SOURCES_LIBS += $(SOURCES_MBEDTLS_MXCRYPTO) |
| 95 | endif |
| 96 | ## mbedTLS acceleration settings |
| 97 | |
| 98 | ASM_FILES_PDL := |
| 99 | ifeq ($(COMPILER), GCC_ARM) |
| 100 | ASM_FILES_PDL += $(CUR_LIBS_PATH)/pdl/psoc6pdl/drivers/source/TOOLCHAIN_GCC_ARM/cy_syslib_gcc.S |
| 101 | else |
| 102 | $(error Only GCC ARM is supported at this moment) |
| 103 | endif |
| 104 | |
| 105 | ASM_FILES_LIBS := $(ASM_FILES_PDL) |
| 106 | ASM_FILES_LIBS += $(ASM_FILES_PLATFORM) |
| 107 | |
| 108 | # Add define for PDL version |
| 109 | DEFINES_PDL += -DPDL_VERSION=$(PDL_VERSION) |
| 110 | |
| 111 | DEFINES_LIBS := $(DEFINES_PLATFORM) |
| 112 | DEFINES_LIBS += $(DEFINES_PDL) |