1################################################################################
2# \file bsp.mk
3#
4################################################################################
5# \copyright
6# Copyright 2018-2023 Cypress Semiconductor Corporation (an Infineon company) or
7# an affiliate of Cypress Semiconductor Corporation
8#
9# SPDX-License-Identifier: Apache-2.0
10#
11# Licensed under the Apache License, Version 2.0 (the "License");
12# you may not use this file except in compliance with the License.
13# You may obtain a copy of the License at
14#
15#     http://www.apache.org/licenses/LICENSE-2.0
16#
17# Unless required by applicable law or agreed to in writing, software
18# distributed under the License is distributed on an "AS IS" BASIS,
19# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20# See the License for the specific language governing permissions and
21# limitations under the License.
22################################################################################
23
24ifeq ($(WHICHFILE),true)
25$(info Processing $(lastword $(MAKEFILE_LIST)))
26endif
27
28# Define default type of bootloading method [single, dual]
29# single -> CM4 only, multi -> CM0 and CM4
30SECURE_BOOT_STAGE?=single
31
32# Any additional components to apply when using this board.
33# Add secure CM0P image in single stage.
34ifeq ($(SECURE_BOOT_STAGE), single)
35BSP_COMPONENTS:=CM0P_SECURE
36endif
37
38# Any additional defines to apply when using this board.
39BSP_DEFINES:=CY_USING_HAL
40
41ifeq ($(SECURE_BOOT_STAGE),single)
42BSP_LINKER_SUFFIX=
43CY_SECURE_POLICY_NAME?=policy_single_CM0_CM4
44else
45# In multi-boot, we want the "single" linker script for CM4 because that only links
46# in the CM4 image, allowing the CM0 image to be loaded separately.
47BSP_LINKER_SUFFIX=$(if $(call mtb_equals,$(MTB_RECIPE__CORE),CM4), _single,)
48CY_SECURE_POLICY_NAME?=policy_multi_CM0_CM4
49endif
50
51# Specify the path to the linker script to use
52ifeq ($(TOOLCHAIN),GCC_ARM)
53	BSP_LINKER_SCRIPT_EXT:=ld
54else ifeq ($(TOOLCHAIN),ARM)
55	BSP_LINKER_SCRIPT_EXT:=sct
56else ifeq ($(TOOLCHAIN),IAR)
57	BSP_LINKER_SCRIPT_EXT:=icf
58endif
59
60MTB_BSP__LINKER_SCRIPT=$(MTB_TOOLS__TARGET_DIR)/COMPONENT_$(MTB_RECIPE__CORE)/TOOLCHAIN_$(TOOLCHAIN)/linker$(BSP_LINKER_SUFFIX).$(BSP_LINKER_SCRIPT_EXT)
61
62#Define the toolchain path
63ifeq ($(TOOLCHAIN),ARM)
64TOOLCHAIN_PATH=$(MTB_TOOLCHAIN_ARM__BASE_DIR)
65else
66TOOLCHAIN_PATH=$(MTB_TOOLCHAIN_GCC_ARM__BASE_DIR)
67endif
68
69# Python path definition
70CY_PYTHON_REQUIREMENT=true
71
72POST_BUILD_CM0_LIB_PATH=$(SEARCH_cat1cm0p)/COMPONENT_CAT1A/COMPONENT_CM0P_SECURE
73POST_BUILD_BSP_LIB_PATH_INTERNAL=$(SEARCH_TARGET_$(TARGET))
74
75POST_BUILD_BSP_LIB_PATH=$(call mtb_path_normalize,$(POST_BUILD_BSP_LIB_PATH_INTERNAL))
76
77# BSP-specific post-build action
78CY_BSP_POSTBUILD=$(CY_PYTHON_PATH) $(POST_BUILD_BSP_LIB_PATH)/psoc64_postbuild.py \
79				--core $(MTB_RECIPE__CORE) \
80				--secure-boot-stage $(SECURE_BOOT_STAGE) \
81				--policy $(CY_SECURE_POLICY_NAME)\
82				--target cyb06xx7 \
83				--toolchain-path $(TOOLCHAIN_PATH) \
84				--toolchain $(TOOLCHAIN) \
85				--build-dir $(MTB_TOOLS__OUTPUT_CONFIG_DIR) \
86				--app-name $(APPNAME) \
87				--cm0-app-path $(POST_BUILD_CM0_LIB_PATH) \
88				--cm0-app-name psoc6_01_cm0p_secure
89
90
91
92################################################################################
93# ALL ITEMS BELOW THIS POINT ARE AUTO GENERATED BY THE BSP ASSISTANT TOOL.
94# DO NOT MODIFY DIRECTLY. CHANGES SHOULD BE MADE THROUGH THE BSP ASSISTANT.
95################################################################################
96
97# Board device selection. MPN_LIST tracks what was selected in the BSP Assistant
98# All other variables are derived by BSP Assistant based on the MPN_LIST.
99MPN_LIST:=
100