3 # Copyright (c) 2020 Project CHIP Authors
4 # Copyright (c) 2020 Google LLC.
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
11 # http://www.apache.org/licenses/LICENSE-2.0
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
22 # Makefile for building the CHIP K32W Lock Example Application.
25 PROJECT_ROOT := $(realpath .)
27 CHIP_ROOT ?= $(realpath $(PROJECT_ROOT)/third_party/connectedhomeip)
28 BUILD_SUPPORT_DIR = $(CHIP_ROOT)/config/k32w
30 include $(BUILD_SUPPORT_DIR)/k32w061-app.mk
31 include $(BUILD_SUPPORT_DIR)/k32w061-chip.mk
33 APP = chip-k32w061-lock-example
36 $(PROJECT_ROOT)/main/main.cpp \
37 $(PROJECT_ROOT)/main/AppTask.cpp \
38 $(PROJECT_ROOT)/main/BoltLockManager.cpp \
39 $(PROJECT_ROOT)/main/ZclCallbacks.cpp \
40 $(CHIP_ROOT)/examples/platform/k32w/util/LEDWidget.cpp \
41 $(CHIP_ROOT)/examples/platform/k32w/app/support/FreeRtosMbedtlsMutex.c \
42 ${CHIP_ROOT}/src/app/util/af-event.cpp \
43 ${CHIP_ROOT}/src/app/util/af-main-common.c \
44 $(CHIP_ROOT)/src/app/util/attribute-size.c \
45 $(CHIP_ROOT)/src/app/util/attribute-storage.c \
46 $(CHIP_ROOT)/src/app/util/attribute-table.c \
47 $(CHIP_ROOT)/src/app/util/chip-message-send.cpp \
48 $(CHIP_ROOT)/src/app/util/client-api.c \
49 $(CHIP_ROOT)/src/app/util/ember-print.cpp \
50 $(CHIP_ROOT)/src/app/util/message.c \
51 $(CHIP_ROOT)/src/app/util/process-cluster-message.c \
52 $(CHIP_ROOT)/src/app/util/process-global-message.c \
53 $(CHIP_ROOT)/src/app/util/util.c \
54 $(CHIP_ROOT)/src/app/clusters/on-off-server/on-off.c \
55 $(CHIP_ROOT)/examples/common/chip-app-server/DataModelHandler.cpp \
56 $(CHIP_ROOT)/examples/common/chip-app-server/Server.cpp \
57 $(CHIP_ROOT)/examples/lock-app/lock-common/gen/call-command-handler.c \
58 $(CHIP_ROOT)/examples/lock-app/lock-common/gen/callback-stub.c \
59 $(K32W061_SDK_ROOT)/rtos/amazon-freertos/lib/FreeRTOS/tasks.c \
60 $(K32W061_SDK_ROOT)/rtos/amazon-freertos/lib/FreeRTOS/portable/MemMang/heap_3.c \
61 $(K32W061_SDK_ROOT)/rtos/amazon-freertos/lib/FreeRTOS/list.c \
62 $(K32W061_SDK_ROOT)/rtos/amazon-freertos/lib/FreeRTOS/portable/GCC/ARM_CM3/port.c \
63 $(K32W061_SDK_ROOT)/rtos/amazon-freertos/lib/FreeRTOS/queue.c \
64 $(K32W061_SDK_ROOT)/rtos/amazon-freertos/lib/FreeRTOS/timers.c \
65 $(K32W061_SDK_ROOT)/rtos/amazon-freertos/lib/FreeRTOS/event_groups.c \
66 $(K32W061_SDK_ROOT)/middleware/wireless/framework/PDM/pdm_port.c \
67 $(K32W061_SDK_ROOT)/middleware/wireless/framework/FunctionLib/FunctionLib.c \
68 $(K32W061_SDK_ROOT)/middleware/wireless/framework/Flash/Internal/Flash_Adapter.c \
69 $(K32W061_SDK_ROOT)/middleware/wireless/framework/Panic/Source/Panic.c \
70 $(K32W061_SDK_ROOT)/middleware/wireless/framework/OSAbstraction/Source/fsl_os_abstraction_free_rtos.c \
71 $(K32W061_SDK_ROOT)/middleware/wireless/framework/Reset/Reset.c \
72 $(K32W061_SDK_ROOT)/middleware/wireless/framework/LED/Source/LED.c \
73 $(K32W061_SDK_ROOT)/middleware/wireless/framework/Keyboard/Source/Keyboard.c \
74 $(K32W061_SDK_ROOT)/middleware/wireless/framework/GPIO/GPIO_Adapter.c \
75 $(K32W061_SDK_ROOT)/middleware/wireless/framework/TimersManager/Source/TimersManager.c \
76 $(K32W061_SDK_ROOT)/middleware/wireless/framework/TimersManager/Source/TMR_Adapter.c \
77 $(K32W061_SDK_ROOT)/boards/k32w061dk6/wireless_examples/openthread/reed/bm/board_utility.c \
78 $(K32W061_SDK_ROOT)/boards/k32w061dk6/wireless_examples/openthread/reed/bm/board.c \
79 $(K32W061_SDK_ROOT)/boards/k32w061dk6/wireless_examples/openthread/reed/bm/hardware_init.c \
80 $(K32W061_SDK_ROOT)/devices/K32W061/drivers/fsl_common.c \
81 $(K32W061_SDK_ROOT)/devices/K32W061/drivers/fsl_inputmux.c \
82 $(K32W061_SDK_ROOT)/devices/K32W061/drivers/fsl_pint.c \
83 $(K32W061_SDK_ROOT)/devices/K32W061/drivers/fsl_reset.c
86 $(K32W061_SDK_ROOT)/rtos/amazon-freertos/lib/include \
87 $(K32W061_SDK_ROOT)/rtos/amazon-freertos/lib/include/private \
88 $(K32W061_SDK_ROOT)/rtos/amazon-freertos/lib/FreeRTOS/portable/GCC/ARM_CM3 \
89 $(K32W061_SDK_ROOT)/rtos/amazon-freertos/lib/third_party/unity/src \
90 $(K32W061_SDK_ROOT)/rtos/amazon-freertos/lib/include/ \
91 $(K32W061_SDK_ROOT)/middleware/wireless/framework/OSAbstraction/Interface \
92 $(K32W061_SDK_ROOT)/middleware/wireless/framework/FunctionLib/ \
93 $(K32W061_SDK_ROOT)/middleware/wireless/framework/Flash/Internal/ \
94 $(K32W061_SDK_ROOT)/middleware/wireless/framework/Panic/Interface/ \
95 $(K32W061_SDK_ROOT)/middleware/wireless/framework/LED/Interface/ \
96 $(K32W061_SDK_ROOT)/middleware/wireless/framework/Keyboard/Interface/ \
97 $(K32W061_SDK_ROOT)/middleware/wireless/framework/TimersManager/Interface/ \
98 $(K32W061_SDK_ROOT)/middleware/wireless/framework/RNG/Interface/ \
99 $(K32W061_SDK_ROOT)/middleware/wireless/framework/GPIO/ \
100 $(K32W061_SDK_ROOT)/middleware/wireless/framework/XCVR/DK6/ \
101 $(K32W061_SDK_ROOT)/boards/k32w061dk6/wireless_examples/openthread/reed/bm/ \
102 $(K32W061_SDK_ROOT)/devices/K32W061/drivers/ \
103 $(K32W061_SDK_ROOT)/components/serial_manager/ \
105 $(PROJECT_ROOT)/src \
106 $(PROJECT_ROOT)/main \
107 $(PROJECT_ROOT)/main/include \
108 $(CHIP_ROOT)/examples/platform/k32w/util/include \
109 $(CHIP_ROOT)/examples/platform/k32w/app/support \
110 $(CHIP_ROOT)/examples/platform/k32w/app/project_include \
111 $(CHIP_ROOT)/examples/lock-app/lock-common/ \
112 $(CHIP_ROOT)/examples/common/chip-app-server/include/ \
113 $(CHIP_ROOT)/src/include/ \
114 $(CHIP_ROOT)/src/lib \
116 $(CHIP_ROOT)/src/app/util \
117 $(CHIP_ROOT)/src/system \
118 $(CHIP_ROOT)/third_party/openthread/repo/src/core
121 -lopenthread-cli-ftd \
123 -lopenthread-k32w061_plat \
124 -lopenthread-k32w061_sdk \
125 $(K32W061_SDK_ROOT)/middleware/wireless/ieee-802.15.4/lib/libMiniMac.a \
126 $(K32W061_SDK_ROOT)/middleware/wireless/framework/XCVR/lib/libRadio.a \
127 $(K32W061_SDK_ROOT)/middleware/wireless/framework/PDM/Library/libPDM.a \
133 JENNIC_CHIP_FAMILY_NAME=_JN518x \
136 FSL_RTOS_FREE_RTOS=1 \
137 gUartDebugConsole_d=0 \
140 gKeyBoardSupported_d \
145 gLEDsOnTargetBoardCnt_c=2 \
146 gLED_InvertedMode_d=1 \
147 ENABLE_RAM_VECTOR_TABLE=1 \
149 gTimestamp_Enabled_d=0 \
150 gMainThreadStackSize_c=2048 \
152 CHIP_ENABLE_OPENTHREAD=1
160 ifdef DEVICE_FIRMWARE_REVISION
162 CHIP_DEVICE_CONFIG_DEVICE_FIRMWARE_REVISION=\"$(DEVICE_FIRMWARE_REVISION)\"
165 # A product's firmware usually comes with two build "flavors":
166 # 1) a "development" build which typically enables debugging artifacts along with logging,
167 # and disables security and optimizations and
168 # 2) a "release" build which targets end-user devices
169 # and disables debugging artifacts and logging, and enables security and optimizations.
171 # To facilitate supporting these two build flavors, the sample app source code supports
172 # the build configuration option BUILD_RELEASE. By default, BUILD_RELEASE is not defined
173 # and a development build is produced. If make is invoked with BUILD_RELEASE=1, then
174 # a "pseudo-release" build is produced.
176 # We say "pseudo-release" build because the sample app is never to be used as-is
177 # as the firmware for an end-user device. However, since real products may start off with
178 # the sample app source code, we show how the BUILD_RELEASE build configuration option
179 # can be used to produce two build flavors (development and release) of the firmware.
181 # IMPORTANT: By no means does the use of BUILD_RELEASE in the sample app cover all key aspects that
182 # one should be concerned with (e.g. security, performance) when targeting real world end-user
183 # devices. This is simply provided for guidance on how to support two build flavors.
186 DEFINES += BUILD_RELEASE=1
187 # Disable Thread logging.
188 CHIP_DEFINES += CHIP_CONFIG_LOG_LEVEL=OT_LOG_LEVEL_NONE
190 DEFINES += BUILD_RELEASE=0
191 # Increase Tread logging level to INFO.
192 CHIP_DEFINES += CHIP_CONFIG_LOG_LEVEL=OT_LOG_LEVEL_DEBG
195 CHIP_PROJECT_CONFIG = ${CHIP_ROOT}/examples/platform/k32w/app/project_include/CHIPProjectConfig.h
197 OPENTHREAD_CONFIGURE_OPTIONS += \
198 --enable-child-supervision \
199 --enable-jam-detection
201 LINKER_SCRIPT = ${CHIP_ROOT}/examples/platform/k32w/app/ldscripts/chip-k32w061-lock-example.ld
203 $(call GenerateBuildRules)