1################################################################################
2# \file common_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-2021 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
26include host.mk
27
28################################################################################
29# PDL library
30################################################################################
31PSOC6_LIBS_PATH = $(PRJ_DIR)/libs
32
33ifeq ($(CORE),CM0P)
34CORE_SIFFX=m0plus
35else
36CORE_SIFFX=m4
37endif
38
39# Collect source files for PDL
40SOURCES_PDL := $(wildcard $(PSOC6_LIBS_PATH)/mtb-pdl-cat1/drivers/source/*.c)
41SOURCES_PDL += $(wildcard $(PSOC6_LIBS_PATH)/mtb-pdl-cat1/devices/COMPONENT_CAT1A/source/*.c)
42
43# PDL startup related files
44SOURCES_PDL_STARTUP := $(PSOC6_LIBS_PATH)/mtb-pdl-cat1/devices/COMPONENT_CAT1A/templates/COMPONENT_MTB/COMPONENT_$(CORE)/system_psoc6_c$(CORE_SIFFX).c
45
46# PDL related include directories
47INCLUDE_DIRS_PDL := $(PSOC6_LIBS_PATH)/mtb-pdl-cat1/drivers/include
48INCLUDE_DIRS_PDL += $(PSOC6_LIBS_PATH)/mtb-pdl-cat1/devices/COMPONENT_CAT1A/include/ip
49INCLUDE_DIRS_PDL += $(PSOC6_LIBS_PATH)/mtb-pdl-cat1/devices/COMPONENT_CAT1A/include
50INCLUDE_DIRS_PDL += $(PSOC6_LIBS_PATH)/mtb-pdl-cat1/cmsis/include
51
52# PDL startup related files
53INCLUDE_DIRS_PDL_STARTUP := $(PSOC6_LIBS_PATH)/mtb-pdl-cat1/devices/COMPONENT_CAT1A/templates/COMPONENT_MTB
54
55# core-libs related include directories
56INCLUDE_DIRS_CORE_LIB := $(PSOC6_LIBS_PATH)/core-lib/include
57
58STARTUP_FILE := $(PSOC6_LIBS_PATH)/mtb-pdl-cat1/devices/COMPONENT_CAT1A/templates/COMPONENT_MTB/COMPONENT_$(CORE)/TOOLCHAIN_$(COMPILER)/startup_psoc6_$(PLATFORM_SUFFIX)_c$(CORE_SIFFX)
59
60ifeq ($(COMPILER), GCC_ARM)
61	ASM_FILES_STARTUP := $(STARTUP_FILE).S
62else
63$(error Only GCC ARM is supported at this moment)
64endif
65
66
67# Collected source files for libraries
68SOURCES_LIBS := $(SOURCES_PDL)
69SOURCES_LIBS += $(SOURCES_PDL_STARTUP)
70
71# Collected include directories for libraries
72INCLUDE_DIRS_LIBS := $(addprefix -I,$(INCLUDE_DIRS_PDL))
73INCLUDE_DIRS_LIBS += $(addprefix -I,$(INCLUDE_DIRS_PDL_STARTUP))
74INCLUDE_DIRS_LIBS += $(addprefix -I,$(INCLUDE_DIRS_CORE_LIB))
75
76ASM_FILES_PDL :=
77ifeq ($(COMPILER), GCC_ARM)
78ASM_FILES_PDL += $(PSOC6_LIBS_PATH)/mtb-pdl-cat1/drivers/source/TOOLCHAIN_GCC_ARM/cy_syslib_gcc.S
79else
80$(error Only GCC ARM is supported at this moment)
81endif
82
83ASM_FILES_LIBS := $(ASM_FILES_PDL)
84
85# Add define for PDL version
86DEFINES_PDL += -DPDL_VERSION=$(PDL_VERSION)
87
88DEFINES_LIBS := $(DEFINES_PLATFORM)
89DEFINES_LIBS += $(DEFINES_PDL)
90