-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
411 lines (341 loc) · 13.4 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
################################################################################
# \file Makefile
# \version 1.0
#
# \brief
# Top-level application make file.
#
################################################################################
# \copyright
# Copyright 2018-2021, Cypress Semiconductor Corporation (an Infineon company)
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
################################################################################
################################################################################
# Basic Configuration
################################################################################
# Type of ModusToolbox Makefile Options include:
#
# COMBINED -- Top Level Makefile usually for single standalone application
# APPLICATION -- Top Level Makefile usually for multi project application
# PROJECT -- Project Makefile under Application
MTB_TYPE=COMBINED
# Target board/hardware (BSP).
# To change the target, it is recommended to use the Library manager
# ('make modlibs' from command line), which will also update Eclipse IDE launch
# configurations. If TARGET is manually edited, ensure TARGET_<BSP>.mtb with a
# valid URL exists in the application, run 'make getlibs' to fetch BSP contents
# and update or regenerate launch configurations for your IDE.
TARGET=APP_CY8CPROTO-062-4343W
# Name of application (used to derive name of final linked file).
#
# If APPNAME is edited, ensure to update or regenerate launch
# configurations for your IDE.
APPNAME=iotc-modustoolbox-example
# Name of toolchain to use. Options include:
#
# GCC_ARM -- GCC provided with ModusToolbox software
# ARM -- ARM Compiler (must be installed separately)
# IAR -- IAR Compiler (must be installed separately)
#
# See also: CY_COMPILER_PATH below
TOOLCHAIN=GCC_ARM
# Default build configuration. Options include:
#
# Debug -- build with minimal optimizations, focus on debugging.
# Release -- build with full optimizations
# Custom -- build with custom configuration, set the optimization flag in CFLAGS
#
# If CONFIG is manually edited, ensure to update or regenerate launch configurations
# for your IDE.
CONFIG=Debug
# Default value for CORE = CM4
# You can change it to CM0P to port your application to CM0P.
#
CORE=CM4
# If set to "true" or "1", display full command-lines when building.
VERBOSE=
##### OTA MAKEFILE MERGED FROM mtb-example-ota-https ######
# Set Platform type
# E.g. PLATFORM=PSOC_062_512K, PLATFORM=PSOC_062_2M, PLATFORM=XMC7200
ifeq ($(TARGET), APP_KIT_XMC72_EVK_MUR_43439M2)
PLATFORM=XMC7200
else
ifeq ($(TARGET), APP_CY8CPROTO-062S3-4343W)
PLATFORM=PSOC_062_512K
else
PLATFORM=PSOC_062_2M
endif
endif
# Core processor
ifneq ($(PLATFORM), XMC7200)
CORE=CM4
else
CORE=CM7
endif
##### END OTA MAKEFILE MERGED FROM mtb-example-ota-https ######
################################################################################
# Advanced Configuration
################################################################################
# Enable optional code that is ordinarily disabled by default.
#
# Available components depend on the specific targeted hardware and firmware
# in use. In general, if you have
#
# COMPONENTS=foo bar
#
# ... then code in directories named COMPONENT_foo and COMPONENT_bar will be
# added to the build
#
COMPONENTS=FREERTOS LWIP MBEDTLS SECURE_SOCKETS
# Like COMPONENTS, but disable optional code that was enabled by default.
DISABLE_COMPONENTS=
# By default the build system automatically looks in the Makefile's directory
# tree for source code and builds it. The SOURCES variable can be used to
# manually add source code to the build process from a location not searched
# by default, or otherwise not found by the build system.
SOURCES=
# Like SOURCES, but for include directories. Value should be paths to
# directories (without a leading -I).
INCLUDES=./configs
DEFINES=
# Custom configuration of mbedtls library.
MBEDTLSFLAGS=MBEDTLS_USER_CONFIG_FILE='"mbedtls_user_config.h"'
# Support IoTConnect OTA in the application along with Infineon's OTA components
# This setting drives the behavior of this makefile
OTA_SUPPORT=0
ifeq ($(OTA_SUPPORT),1)
##### OTA MAKEFILE MERGED FROM mtb-example-ota-https ######
# Like COMPONENTS, but disable optional code that was enabled by default.
ifneq ($(PLATFORM), XMC7200)
DISABLE_COMPONENTS=CM0P_SLEEP CM0P_SECURE CM0P_CRYPTO CM0P_BLESS
else
DISABLE_COMPONENTS=XMC7xDUAL_CM0P_SLEEP XMC7x_CM0P_SLEEP
endif
##### END OTA MAKEFILE MERGED FROM mtb-example-ota-https ######
endif # OTA_SUPPORT
# The basic sample can support OTA, so enable the OTA code into the IoTConnect SDK
ifeq ($(OTA_SUPPORT),1)
DEFINES+=IOTC_OTA_SUPPORT
endif
# Turn off making tests for CJSON
CJSONFLAGS=ENABLE_CJSON_TEST=Off ENABLE_CJSON_UTILS=Off
# Add additional defines to the build process (without a leading -D).
DEFINES+=$(MBEDTLSFLAGS) $(CJSONFLAGS) CYBSP_WIFI_CAPABLE CY_RETARGET_IO_CONVERT_LF_TO_CRLF
DEFINES+=CY_RTOS_AWARE
# for http client
DEFINES+=ENABLE_HTTP_CLIENT_LOGS MQTT_DO_NOT_USE_CUSTOM_CONFIG
DEFINES+=HTTP_DO_NOT_USE_CUSTOM_CONFIG
# for sntp
DEFINES+=SNTP_SERVER_DNS
# Define to enable qualification code in the SDK
# This define should NOT be used in production,
# as it could make your device vulnerable to MITM attacks
# DEFINES+=IOTC_AWS_DEVICE_QUALIFICATION
# Configure response header maximum length with the specified value - HTTP
DEFINES+=HTTP_MAX_RESPONSE_HEADERS_SIZE_BYTES=2048
### MQTT SETTINGS
# Number of milliseconds to wait for a ping response to a ping
DEFINES+= MQTT_PINGRESP_TIMEOUT_MS=5000
# The number of retries for receiving CONNACK
DEFINES+= MQTT_MAX_CONNACK_RECEIVE_RETRY_COUNT=2
# CY8CPROTO-062-4343W board shares the same GPIO for the user button (USER BTN1)
# and the CYW4343W host wake up pin. Since this example uses the GPIO for
# interfacing with the user button, the SDIO interrupt to wake up the host is
# disabled by setting CY_WIFI_HOST_WAKE_SW_FORCE to '0'.
#
# If you wish to enable this host wake up feature, Comment DEFINES+=CY_WIFI_HOST_WAKE_SW_FORCE=0.
# If you want this feature on CY8CPROTO-062-4343W, change the GPIO pin for USER BTN
# in design/hardware & Comment DEFINES+=CY_WIFI_HOST_WAKE_SW_FORCE=0.
DEFINES+=CY_WIFI_HOST_WAKE_SW_FORCE=0
# Select softfp or hardfp floating point. Default is softfp.
VFP_SELECT=hardfp
# Additional / custom C compiler flags.
#
# NOTE: Includes and defines should use the INCLUDES and DEFINES variable
# above.
CFLAGS=
# Additional / custom C++ compiler flags.
#
# NOTE: Includes and defines should use the INCLUDES and DEFINES variable
# above.
CXXFLAGS=
# Additional / custom assembler flags.
#
# NOTE: Includes and defines should use the INCLUDES and DEFINES variable
# above.
ASFLAGS=
##### OTA MAKEFILE MERGED FROM mtb-example-ota-https ######
# Additional / custom linker flags.
ifeq ($(TOOLCHAIN), GCC_ARM)
LDFLAGS=-Wl,--undefined=uxTopUsedPriority
CY_TOOLCHAIN_LS_EXT=ld
else
ifeq ($(TOOLCHAIN), IAR)
LDFLAGS=--keep uxTopUsedPriority
CY_TOOLCHAIN_LS_EXT=icf
else
ifeq ($(TOOLCHAIN), ARM)
LDFLAGS=--undefined=uxTopUsedPriority
LDFLAGS+=--diag_suppress=L6314W
CY_TOOLCHAIN_LS_EXT=sct
else
LDFLAGS=
$(error Selected toolchain is not supported at this moment)
endif
endif
endif
##### OTA MAKEFILE MERGED FROM mtb-example-ota-https ######
# Additional / custom libraries to link in to the application.
LDLIBS=
# Path to the linker script to use (if empty, use the default linker script).
LINKER_SCRIPT=
# Custom pre-build commands to run.
PREBUILD=
# Custom post-build commands to run.
POSTBUILD=
###############################################################################
#
# OTA Setup
#
###############################################################################
ifeq ($(OTA_SUPPORT),1)
# Enable HTTP Support
OTA_HTTP_SUPPORT=1
# Set OTA platform type (added to defines and used when finding the linker script)
# E.g. PSOC_062_2M, PSOC_062_512K and XMC7200
OTA_PLATFORM=$(PLATFORM)
# XIP_MODE only support for PSOC_062_512K platform
XIP_MODE=XIP
# Flashmap JSON file name
ifneq ($(PLATFORM), XMC7200)
ifeq ($(PLATFORM), PSOC_062_512K)
ifeq ($(XIP_MODE), XIP)
OTA_FLASH_MAP=flashmap/psoc62_512k_xip_swap_single.json
LD_SUFFIX=_xip
endif
else
OTA_FLASH_MAP=flashmap/psoc62_2m_ext_swap_single.json
endif
else
OTA_FLASH_MAP=flashmap/xmc7200_int_swap_single.json
endif
ifneq ($(PLATFORM), XMC7200)
# To enable QSPI support
COMPONENTS+=OTA_PSOC_062
endif
# Starting from the 4.0 version of the ota-update library, the library is now fully separated from the MCUBootloader.
# This means that it can function independently and work with any bootloader.
# This code example only supports MCUboot at this moment.
CY_BOOTLOADER=MCUBOOT
COMPONENTS+=$(CY_BOOTLOADER)
ifneq ($(CY_BOOTLOADER), MCUBOOT)
$(error This code example only supports MCUboot based bootloader at this moment)
endif
# Set the version of the app using the following three variables.
# This version information is passed to the Python module "imgtool" or "cysecuretools" while
# signing the image in the post build step. Default values are set as follows.
# Change the version here or over-ride by setting an environment variable
# before building the application.
#
# export APP_VERSION_MAJOR=2
#
APP_VERSION_MAJOR?=1
APP_VERSION_MINOR?=0
APP_VERSION_BUILD?=0
DEFINES+=OTA_SUPPORT=1\
APP_VERSION_MAJOR=$(APP_VERSION_MAJOR)\
APP_VERSION_MINOR=$(APP_VERSION_MINOR)\
APP_VERSION_BUILD=$(APP_VERSION_BUILD)
# To enable the HTTP and secure socket logs.
#OTA_HTTP_DEBUG=1
#DEFINES+=OTA_HTTP_DEBUG=1
# Disable custom config header file
OTA_HTTP_USE_CUSTOM_CONFIG=0
# Set user agent name in all request headers with the specified name
OTA_HTTP_USER_AGENT_VALUE="\"ota-http-client\""
# Configure response header maximum length with the specified value - HTTP
OTA_HTTP_MAX_HDR_SIZE=2048
DEFINES+=ENABLE_OTA_LOGS\
ENABLE_OTA_BOOTLOADER_ABSTRACTION_LOGS
# Enable the CY_PYTHON_PATH requirement.
CY_PYTHON_REQUIREMENT=true
# Python path for ota-bootloader-abstraction middlewares.
# Set Python path
ifeq ($(CY_PYTHON_PATH),)
ifeq ($(OS),Windows_NT)
CY_PYTHON_PATH?=$(shell which python)
else
CY_PYTHON_PATH?=$(shell which python3)
endif
endif # checking for Python path
# Build folder path for ota-bootloader-abstraction middleware.
CY_BUILD_LOCATION=./build
# Linker file path for ota-bootloader-abstraction middleware.
OTA_LINKER_FILE=$(wildcard bsps/TARGET_$(TARGET)/COMPONENT_$(CORE)/TOOLCHAIN_$(TOOLCHAIN)/linker$(LD_SUFFIX).$(CY_TOOLCHAIN_LS_EXT))
LINKER_SCRIPT=$(wildcard bsps/TARGET_$(TARGET)/COMPONENT_$(CORE)/TOOLCHAIN_$(TOOLCHAIN)/linker$(LD_SUFFIX).$(CY_TOOLCHAIN_LS_EXT))
# Include the ota_update.mk and mcuboot_support.mk makefiles from the middlewares.
ifneq ($(MAKECMDGOALS),getlibs)
ifneq ($(MAKECMDGOALS),get_app_info)
ifneq ($(MAKECMDGOALS),printlibs)
include ../mtb_shared/ota-update/*-v*/makefiles/ota_update.mk
include ../mtb_shared/ota-bootloader-abstraction/*-v*/makefiles/mcuboot/mcuboot_support.mk
endif
endif
endif
endif # OTA_SUPPORT
################################################################################
# Paths
################################################################################
# Relative path to the project directory (default is the Makefile's directory).
#
# This controls where automatic source code discovery looks for code.
CY_APP_PATH=
# Relative path to the shared repo location.
#
# All .mtb files have the format, <URI>#<COMMIT>#<LOCATION>. If the <LOCATION> field
# begins with $$ASSET_REPO$$, then the repo is deposited in the path specified by
# the CY_GETLIBS_SHARED_PATH variable. The default location is one directory level
# above the current app directory.
# This is used with CY_GETLIBS_SHARED_NAME variable, which specifies the directory name.
CY_GETLIBS_SHARED_PATH=../
# Directory name of the shared repo location.
#
CY_GETLIBS_SHARED_NAME=mtb_shared
# Absolute path to the compiler's "bin" directory. The variable name depends on the
# toolchain used for the build. Refer to the ModusToolbox user guide to get the correct
# variable name for the toolchain used in your build.
#
# The default depends on the selected TOOLCHAIN (GCC_ARM uses the ModusToolbox
# software provided compiler by default).
CY_COMPILER_GCC_ARM_DIR=
# Locate ModusToolbox helper tools folders in default installation
# locations for Windows, Linux, and macOS.
CY_WIN_HOME=$(subst \,/,$(USERPROFILE))
CY_TOOLS_PATHS ?= $(wildcard \
$(CY_WIN_HOME)/ModusToolbox/tools_* \
$(HOME)/ModusToolbox/tools_* \
/Applications/ModusToolbox/tools_*)
# If you install ModusToolbox software in a custom location, add the path to its
# "tools_X.Y" folder (where X and Y are the version number of the tools
# folder). Make sure you use forward slashes.
CY_TOOLS_PATHS+=
# Default to the newest installed tools folder, or the users override (if it's
# found).
CY_TOOLS_DIR=$(lastword $(sort $(wildcard $(CY_TOOLS_PATHS))))
ifeq ($(CY_TOOLS_DIR),)
$(error Unable to find any of the available CY_TOOLS_PATHS -- $(CY_TOOLS_PATHS). On Windows, use forward slashes.)
endif
$(info Tools Directory: $(CY_TOOLS_DIR))
include $(CY_TOOLS_DIR)/make/start.mk